Skip to content

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

@dopplershift

Description

@dopplershift

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions