Skip to content

calculation of height from geopotential #1998

Answered by dcamron
met-sree asked this question in Q&A
Discussion options

You must be logged in to vote

I see you have a commented out line constructing a Quantity. You will need to create one with associated units for your geop so that geopotential_to_height() can understand the units of your values, e.g.

geop = gpdata['z'][:]
geop_w_units = units.Quantity(geop, 'm ** 2 / s ** 2')
# geop_w_units = geop * units('m ** 2 / s ** 2') also can work most of the time
hgt = metpy.calc.geopotential_to_height(geop_w_units)

We have a more helpful error to catch this and are not using it here! So thanks for catching that 😄

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@met-sree
Comment options

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