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

"Downloading model fields with NCSS" needs an update #135

Open
dopplershift opened this issue Mar 27, 2023 · 0 comments
Open

"Downloading model fields with NCSS" needs an update #135

dopplershift opened this issue Mar 27, 2023 · 0 comments

Comments

@dopplershift
Copy link
Member

It looks like updates to TDS 5 broke this workshop notebook. Assuming we keep it, the 4th from the end cell needs to look like:

from metpy.units import units
import numpy as np

# get netCDF variables
pressure = point_data.variables["altitude"]
temp = point_data.variables["Temperature_isobaric"]
u_cmp = point_data.variables["u-component_of_wind_isobaric"]
v_cmp = point_data.variables["v-component_of_wind_isobaric"]
relh = point_data.variables["Relative_humidity_isobaric"]

# download data and assign the units based on the variables metadata
# Need to put units on the left to assure things work properly with masked arrays
p = units(pressure.units) * pressure[:].squeeze()
T = units(temp.units) * temp[:].squeeze()
u = units(u_cmp.units) * u_cmp[:].squeeze()
v = units(v_cmp.units) * v_cmp[:].squeeze()
relh = units('percent') * relh[:].squeeze()

This updates to use "altitude" instead of "isobaric", and also removes the code to manually sync the levels since it seems like the server is doing that for us?

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