Uncomment the following line to install geemap if needed.
# !pip install geemap
import os
import geemap
import xarray as xr
from ipyleaflet import basemaps
from ipyleaflet.velocity import Velocity
Map = geemap.Map(center=[44.33, -130.60], zoom=3, interpolation="nearest")
Map.add_layer(basemaps.CartoDB.DarkMatter)
Map
file_path = os.path.abspath("wind_global.nc")
if not os.path.exists(file_path):
url = "https://github.com/gee-community/geemap/raw/master/examples/data/wind_global.nc"
geemap.download_file(url)
ds = xr.open_dataset(file_path)
ds
display_options = {
"velocityType": "Global Wind",
"displayPosition": "bottomleft",
"displayEmptyString": "No wind data",
}
wind = Velocity(
data=ds,
name="Velocity",
zonal_speed="u_wind",
meridional_speed="v_wind",
latitude_dimension="lat",
longitude_dimension="lon",
velocity_scale=0.01,
max_velocity=20,
display_options=display_options,
)
Map.add_layer(wind)