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

[python #UMK-725743]: nexrad level III plotting with Metpy



Greetings!

I think you are kind of on the right path based on what you've found, but I 
think you'll find that metpy.calc.azimuth_range_to_lat_lon will make your life 
a lot easier:

  
https://unidata.github.io/MetPy/latest/api/generated/metpy.calc.azimuth_range_to_lat_lon.html

Calling that function with the az/range coming from Level3File might take care 
of the issues. Regarding the error you ran into about `set_extent` not being 
present, that's because your call `ax=plt.subplot(1,1,1)` is missing a 
`projection` argument being given a CartoPy projection--therefore it creates a 
regular matplotlib Axes that knows nothing about `set_extent`.

If this doesn't help, I'm happy to help dig in further.

Cheers!

Ryan


> Hello there!
> 
> My main goal here is to plot nexrad level 3 data, but on lat lon crs
> instead of x,y.
> 
> I'm plotting nexrad level III data with metpy based on this starting point:
> https://unidata.github.io/MetPy/latest/examples/formats/NEXRAD_Level_3_File.html
> 
> I adapted the code to plot just the reflectivity from FSX (Flagstaff) via
> this code:
> http://www.met.sjsu.edu/weather/radartest/FSX-demo2.py
> <http://www.met.sjsu.edu/weather/radartest/FSX-demo2.py>
> which  produces this image:
> http://www.met.sjsu.edu/weather/radartest/demo-2.png
> So far so good....
> 
> Now I want to convert this to lat lon coordinates. After searching the  web
> it seems I need to use arm_pyart or convert using some suggestions.
> 
> I found this suggestion:
> https://kbkb-wx-python.blogspot.com/2016/07/plotting-radar-data-with-metpy-pyproj.html
> 
> I adapted this to my code here:
> http://www.met.sjsu.edu/weather/radartest/FSX-demo3.py
> which  produces this image:
> http://www.met.sjsu.edu/weather/radartest/demo-3.png
> 
> So it works, this is the same data, but rotated 90 degrees, and transposed
> it looks like....weird.
> 
> Anyway, then I tried to set extent to limit the plotting area, and to see
> if I could plot some base GIS info like state boundaries. but I ran into an
> error which I was confused by:
> -------------
> 
> *ax.set_extent(-112,-110,37,35)AttributeError: 'AxesSubplot' object has no
> attribute 'set_extent'*
> ------------
> 
> I do use ax.set_extent often for other plots of weather maps and sat
> imagery, so this is confusing.  ( I may be using a newer version of
> Matplotlib here)
> 
> So, before I go too much further, I am on the right track for plotting
> nexrad level III on lat lon coordinates?  Is there a more straightforward
> way I might be missing to do this?
> I may just need to get pointed in the right direction here.


Ticket Details
===================
Ticket ID: UMK-725743
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.