-
Notifications
You must be signed in to change notification settings - Fork 69
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
Geomtrophic and Ageostrophic Wind problem in the #132
Comments
That example is very out of date, as are many others on this repository at this moment. Please explore examples in the MetPy docs example gallery instead until we close this issue.I can still help from here. That function signature has been updated a few times since, check out the documentation or in your particular python install (here, the latest version of MetPy, 1.4) with: >>> import metpy.calc as mpcalc
>>> help(mpcalc.geostrophic_wind)
Help on function geostrophic_wind in module metpy.calc:
geostrophic_wind(height, dx=None, dy=None, latitude=None, x_dim=-1, y_dim=-2, *, parallel_scale=None, meridional_scale=None, longitude=None, crs=None)
Calculate the geostrophic wind given from the height or geopotential.
... where we can see that the inputs I'm providing my function don't match up. So, on MetPy 1.4, that particular line could be re-written (without any other changes) as geo_wind_u, geo_wind_v = mpcalc.geostrophic_wind(height * units.m, dx=dx, dy=dy, latitude=lat_2d) Since MetPy 1.4, there are few ways you can do this without calculating ... #continued from the original example
data = ncss.get_data(query)
import xarray as xr
ds = xr.open_dataset(xr.backends.NetCDF4DataStore(data))
geo_wind_u, geo_wind_v = mpcalc.geostrophic_wind(ds['Geopotential_height_isobaric']) Note, if you use xarray with your own netcdf files, or most remote data not accessed using NCSS + netcdf4-python (as in this example), you won't need the import metpy.calc as mpcalc
import xarray as xr
ds = xr.open_dataset('my_data.nc')
mpcalc.geostrophic_wind(my_data['my_height_variable']) 🎉 Hope this helps. Please start a new discussion here if you have further issues or visit the other MetPy support venues if needed. Be sure to update your install of MetPy! |
Thank you for the suggestion. The part you suggested seems to workimport xarray as xr Calculate ageostrophic wind componentsageo_wind_u = u_wind - geo_wind_u ================== # Create new figure ValueError Traceback (most recent call last) /opt/miniconda3/lib/python3.9/site-packages/cartopy/mpl/geoaxes.py in wrapper(self, *args, **kwargs) /opt/miniconda3/lib/python3.9/site-packages/cartopy/mpl/geoaxes.py in quiver(self, x, y, u, v, *args, **kwargs) /opt/miniconda3/lib/python3.9/site-packages/matplotlib/init.py in inner(ax, data, *args, **kwargs) /opt/miniconda3/lib/python3.9/site-packages/matplotlib/axes/_axes.py in quiver(self, *args, **kw) /opt/miniconda3/lib/python3.9/site-packages/matplotlib/quiver.py in init(self, ax, scale, headwidth, headlength, headaxislength, minshaft, minlength, units, scale_units, angles, width, color, pivot, *args, **kw) /opt/miniconda3/lib/python3.9/site-packages/matplotlib/quiver.py in _parse_args(caller_name, *args) ValueError: too many values to unpack (expected 2) Could you give me any suggestions for this issue? |
On the line of Geomtrophic and Ageostrophic Wind,
geo_wind_u, geo_wind_v = mpcalc.geostrophic_wind(height * units.m, f, dx, dy)
the error happened like
ValueError: This function changed in 1.0--double check that the function is being called properly.
geostrophic_wind
given arguments with incorrect units:dx
requires "[length]" but given "1 / second",latitude
requires "[dimensionless]" but given "meter"Could you tell me how to solve the problem?
The text was updated successfully, but these errors were encountered: