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

[python #KMV-811594]: Absolute momentum calculation problem(metpy)

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [python #KMV-811594]: Absolute momentum calculation problem(metpy)
  • Date: Fri, 10 May 2019 17:27:43 -0600

Hi,

Apologies for the delayed response. Did you ever manage to work around the 
problem?

If not can you send me your code and the data file (or point me to where you 
got it)? The cross-section code assumes it can identify the x and y 
coordinates, so it's likely some missing metadata.

Ryan

> I use the advanced interpolation of xarray to calculate cross-section,and I
> put the cross section U,V into metpy.calc.absolute_momentum(u_wind, v_wind,
> index='index'),but it doesn't work.
> 
> U V array is geostrophic wind.
> 
> The ERROR message:
> 
> File "F:\Anaconda3\lib\site-packages\metpy\calc\cross_sections.py", line
> 125,
> in unit_vectors_from_cross_section
> x, y = distances_from_cross_section(cross)
> File "F:\Anaconda3\lib\site-packages\metpy\calc\cross_sections.py", line
> 36, i
> n distances_from_cross_section
> if (CFConventionHandler.check_axis(cross.metpy.x, 'lon')
> File "F:\Anaconda3\lib\site-packages\metpy\xarray.py", line 100, in x
> return self._axis('x')
> File "F:\Anaconda3\lib\site-packages\metpy\xarray.py", line 77, in _axis
> raise AttributeError(axis + ' attribute is not available.')
> AttributeError: x attribute is not available.


Ticket Details
===================
Ticket ID: KMV-811594
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.