Skip to content

Plotting height anomaly as a cross section #3325

Answered by dopplershift
rolypolyman asked this question in Q&A
Discussion options

You must be logged in to vote

First things, here's how you can accomplish calculating the difference without so much fighting of things:

# This all is assuming we already have a 2D cross section of geopotential height

# This gets the internal data storage for this DataArray to use a Pint Quantity so unit-tracking
# and math "just works"
hgt = cross['Geopotential_height_isobaric'].metpy.quantify()

# Due to limitations in xarray, since "isobaric" is used as coordinates for the dataset, we can't use the "quantify()"
# utility from above, so use MetPy to get "isobaric" as a plain Pint Quantity (a numpy array with units attached)
pressure_levels_Pa = cross['isobaric'].metpy.unit_array

# Calculate standard atmosphere hei…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dopplershift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants