import geemap
import os
import xarray as xr
from ipyleaflet import Map, Velocity, TileLayer, basemaps
Map = geemap.Map(center=[44.33, -130.60], zoom=3, interpolation='nearest')
Map.add_layer(basemaps.CartoDB.DarkMatter)
Map
file_path = os.path.abspath('../data/wind-global.nc')
if not os.path.exists(file_path):
url = 'https://github.com/giswqs/geemap/raw/master/examples/data/wind-global.nc'
import requests
r = requests.get(url)
wind_data = r.content
with open(file_path, 'wb') as f:
f.write(wind_data)
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)