Velocity
You will need to install the following packages:
ipyleaflet
requests
xarray
netcdf4
geemap
In [ ]:
Copied!
from ipyleaflet import TileLayer, basemaps
from ipyleaflet.velocity import Velocity
import xarray as xr
import geemap
from ipyleaflet import TileLayer, basemaps
from ipyleaflet.velocity import Velocity
import xarray as xr
import geemap
In [ ]:
Copied!
center = [44.33956524809713, -130.60546875000003]
zoom = 3
m = geemap.Map(
center=center,
zoom=zoom,
interpolation='nearest',
basemap=basemaps.CartoDB.DarkMatter,
add_google_map=False,
ee_initialize=False,
)
m
center = [44.33956524809713, -130.60546875000003]
zoom = 3
m = geemap.Map(
center=center,
zoom=zoom,
interpolation='nearest',
basemap=basemaps.CartoDB.DarkMatter,
add_google_map=False,
ee_initialize=False,
)
m
In [ ]:
Copied!
import os
if not os.path.exists('wind-global.nc'):
url = 'https://github.com/benbovy/xvelmap/raw/master/notebooks/wind-global.nc'
import requests
r = requests.get(url)
wind_data = r.content
with open('wind-global.nc', 'wb') as f:
f.write(wind_data)
import os
if not os.path.exists('wind-global.nc'):
url = 'https://github.com/benbovy/xvelmap/raw/master/notebooks/wind-global.nc'
import requests
r = requests.get(url)
wind_data = r.content
with open('wind-global.nc', 'wb') as f:
f.write(wind_data)
In [ ]:
Copied!
ds = xr.open_dataset('wind-global.nc')
ds
ds = xr.open_dataset('wind-global.nc')
ds
In [ ]:
Copied!
display_options = {
'velocityType': 'Global Wind',
'displayPosition': 'bottomleft',
'displayEmptyString': 'No wind data',
}
wind = Velocity(
data=ds,
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,
)
m.add_layer(wind)
display_options = {
'velocityType': 'Global Wind',
'displayPosition': 'bottomleft',
'displayEmptyString': 'No wind data',
}
wind = Velocity(
data=ds,
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,
)
m.add_layer(wind)
In [ ]:
Copied!
Last update:
2022-05-23