[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #GHH-540116]: QG Analysis code ERROR



Hello! Thanks for reaching out.

We are currently in the process of revamping our collection of workshop 
materials, as well as how the website presents these materials. So for the 
moment, this particular notebook is out of date for newer versions of MetPy! As 
of version 1.0 and onward we changed the function signatures for a few of our 
kinematic calculations 
(https://unidata.github.io/MetPy/latest/api/generated/metpy.calc.html#dynamic-kinematic),
 particularly advection and vorticity. Check out the documentation to see the 
specifics of how these have changed. Here are what these specific lines would 
look like,

  # Absolute Vorticity Calculation
  avor_900 = mpcalc.absolute_vorticity(uwnd_900s, vwnd_900s, dx=dx, dy=dy, 
latitude=lats)
  avor_500 = mpcalc.absolute_vorticity(uwnd_500s, vwnd_500s, dx=dx, dy=dy, 
latitude=lats)

  # Advection of Absolute Vorticity
  vortadv_900 = mpcalc.advection(avor_900, uwnd_900s, vwnd_900s, dx=dx, 
dy=dy).to_base_units()
  vortadv_500 = mpcalc.advection(avor_500, uwnd_500s, vwnd_500s, dx=dx, 
dy=dy).to_base_units()

and here is a link to a fully executed version of this notebook with some of 
the necessary changes in place: 
https://gist.github.com/dcamron/84dee25ab2ce81b24624e919186df581

There are a few other ways this notebook can be trimmed down with help of our 
new xarray-focused capabilities, but this should be enough to get it working 
as-is. Hope this helps, and look forward to these workshop materials being 
updated soon! Let me know if there's any further way I can help.


All the best,

Drew


> When I use the codes in this page 
> (https://unidata.github.io/python-training/workshop/MetPy_Advanced/qg-analysis/#interpolation),
>  I always got an error ValueError: Must provide dx, dy, and/or dz arguments 
> or input DataArray with proper coordinates in this line (vortadv_900 = 
> mpcalc.advection(avor_900, (uwnd_900s, vwnd_900s), (dx, 
> dy)).to_base_units()). I did not modify any code in this ipynb file. Before 
> this error line, I can got all correct outputs. Could you give some advice?
> 


Ticket Details
===================
Ticket ID: GHH-540116
Department: Support Python
Priority: Low
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.