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

[python #SHL-755782]: Questions Re: MetPy Code Examples



Greetings!

We're in the process of getting the training website updated, but unfortunately 
the HTML page you linked to is out of date. For now, I'd recommend looking 
directly at the notebook for the example you're trying to use, which has been 
updated for the newest release of MetPy:

  
https://github.com/Unidata/python-training/blob/master/pages/gallery/PV_baroclinic_isobaric.ipynb

Regarding the GOES products, you may be interested in our workshop examples:

  
https://github.com/Unidata/python-training/tree/master/pages/workshop/Satellite_Data

You should be able to tweak the code there to point e.g. to the Geocolor 
imagery available on our THREDDS server:

https://thredds.ucar.edu/thredds/catalog/satellite/goes/east/products/GeoColor/CONUS/catalog.html

Hope this helps,

Ryan

> Hello,
> 
> first off — the examples at 
> https://unidata.github.io/python-training/gallery/gallery-home/ are extremely 
> helpful! Thanks for these.
> 
> However it seems the code needs to be updated in a number of places to be 
> compatible with newer versions of MetPy or its dependencies. Mostly these 
> seem to relate to the general change in metpy.calc? syntax in version 1.0 
> from func(u, v, dx, dy, dim_order='yx') to func(u, v, dx=dx, dy=dy).
> 
> One particular question I had relates to a problem I encountered trying to 
> run this example 
> notebook<https://unidata.github.io/python-training/gallery/pv_baroclinic_isobaric/>.
>  When trying to plot the wind barbs, at the following lines
> 
> 
> # Plot the wind barbs at 250 hPa
> wind_slice = slice(None, None, 6)
> ax.barbs(lons[wind_slice], lats[wind_slice],
> uwnd[i250][wind_slice, wind_slice].to('kt').m,
> vwnd[i250][wind_slice, wind_slice].to('kt').m, pivot='middle',
> color='black', length=6.5, transform=datacrs)
> 
> I get an error message
> 
> 
> File ~/conda/envs/xeno/lib/python3.9/site-packages/xarray/core/common.py:239, 
> in AttrAccessMixin.__getattr__(self, name)
> 237         with suppress(KeyError):
> 238             return source[name]
> --> 239 raise AttributeError(
> 240     f"{type(self).__name__!r} object has no attribute {name!r}"
> 241 )
> 
> AttributeError: 'DataArray' object has no attribute 'to'
> 
> 
> Forgive me as I am new to xarray & pint, but I am not sure exactly how to 
> resolve this. I wondered if you may be able to help.
> 
> 
> Lastly, I wondered if you have any code examples for how I can download raw 
> GOES imagery and/or derived products such as GeoColor or Air Mass RGB images. 
> I have had some trouble getting this to work.
> 
> 
> Thanks so much in advance! I am very excited to work with the MetPy package & 
> will greatly appreciate any help you can offer.


Ticket Details
===================
Ticket ID: SHL-755782
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.