Skip to content

Calculating temperature advection with ERA5 data and metpy 0.12 #2506

Answered by dcamron
Z-Richard asked this question in Q&A
Discussion options

You must be logged in to vote

If you need to work with MetPy<1.0, you'll have to

  • explicitly pull out U, V numpy arrays from your data arrays: u = ds['u'].values; use these as-is or manually create Pint quantities with units, or
  • use one of the MetPy xarray accessors that was available in 0.12: u = ds['u'].metpy.unit_array to create Pint quantities with units quickly.

You'll have to specifically do this for U, V for this to work. As the return will be a Pint quantity with units, I'd suggest a consistent application of above to Temperature as well, so the result is physically meaningful. Either way, I'd strongly suggest upgrading to a newer MetPy if at all possible. Thanks!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Z-Richard
Comment options

Answer selected by dcamron
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