Skip to content

Commit

Permalink
Update velocity notebook example (#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed May 6, 2024
1 parent 86bb671 commit b15db4e
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions examples/notebooks/velocity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"metadata": {},
"source": [
"You will need to install the following packages:\n",
"- `ipyleaflet`\n",
"- `requests`\n",
"- `xarray`\n",
"- `netcdf4`\n",
"- `geemap`"
Expand All @@ -20,7 +18,16 @@
"metadata": {},
"outputs": [],
"source": [
"from ipyleaflet import TileLayer, basemaps\n",
"# %pip install geemap xarray netcdf4"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"from ipyleaflet.velocity import Velocity\n",
"import xarray as xr\n",
"import geemap"
Expand All @@ -29,17 +36,17 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"center = [44.33956524809713, -130.60546875000003]\n",
"center = [44.339565, -130.605468]\n",
"zoom = 3\n",
"m = geemap.Map(\n",
" center=center,\n",
" zoom=zoom,\n",
" interpolation=\"nearest\",\n",
" basemap=basemaps.CartoDB.DarkMatter,\n",
" basemap=\"CartoDB.DarkMatter\",\n",
" add_google_map=False,\n",
" ee_initialize=False,\n",
")\n",
Expand All @@ -49,26 +56,18 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"if not os.path.exists(\"wind_global.nc\"):\n",
" url = \"https://github.com/benbovy/xvelmap/raw/master/notebooks/wind_global.nc\"\n",
" import requests\n",
"\n",
" r = requests.get(url)\n",
" wind_data = r.content\n",
" with open(\"wind_global.nc\", \"wb\") as f:\n",
" f.write(wind_data)"
"url = \"https://github.com/gee-community/geemap/raw/master/examples/data/wind_global.nc\"\n",
"geemap.download_file(url, \"wind_global.nc\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -79,7 +78,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "6",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,21 +99,25 @@
")\n",
"m.add_layer(wind)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b15db4e

Please sign in to comment.