Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot edit displayed speed unit "m/s" #1198

Open
usereight8 opened this issue May 23, 2024 · 0 comments
Open

Cannot edit displayed speed unit "m/s" #1198

usereight8 opened this issue May 23, 2024 · 0 comments

Comments

@usereight8
Copy link

I'm trying to change the velocity units in ipyleaflet's Velocity but it seems that any change in the display_options dictionary is ineffective.

`from ipyleaflet import Map, TileLayer, basemaps
from ipyleaflet.velocity import Velocity
import xarray as xr
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)

center = [0, 0]
zoom = 1
m = Map(center=center, zoom=zoom, interpolation='nearest', basemap=basemaps.CartoDB.DarkMatter)

ds = xr.open_dataset('wind-global.nc')
display_options = {
"velocityType": "Global Wind",
"position": "topleft",
"emptyString": "No velocity data33",
"angleConvention": "bearingCW",
"displayPosition": "topleft",
"displayEmptyString": "No velocity data33",
"speedUnit": "k/h",
}
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(wind)

m`

I've tried editing the dictionary without any noticable changes. I've also tried some editing in the L.Control.Velocity.js file.

My main goal is to be able to display a different string rather than "m/s", as I can do the math conversion for the numbers before feeding them to the velocity module.

@usereight8 usereight8 changed the title Cannot edit display_options in Velocity Cannot edit displayed speed unit "m/s" May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant