Re: [python-users] MetPy NEXRAD Level 2 - Can get lat, lon out to use for plotting map?

Hi Ryan!

There are a couple of directions you can go. As far as I know, there is not
lat/lon grid available in the nexrad files. However, you do have the
lat/lon of the radar itself. From there you can use that point to generate
the lat/lons from your x and y variables using pyproj. The x and y
variables are essentially in azimuthal equidistant projection so  you could
use something like,

def get_lonlat(x,y):
    from pyproj import Proj

    p = Proj(proj=‘aeqd', ellps='sphere',
             lon_0=nexrad_lon,
             lat_0=nexrad_lat)

    return p(x,y,inverse=True)

all you have to do is plug in the proper lon/lat value from the nexrad
file, then feed it the x and y values and it will return two arrays. The
call in a notebook might be

lon, lat = get_lon_lat(xlocs,ylocs)


Alternatively, you could use pyart, which now has the capability to plot
using Cartopy

http://arm-doe.github.io/pyart/dev/user_reference/generated/pyart.graph.RadarMapDisplayCartopy.html#pyart.graph.RadarMapDisplayCartopy

Easy install for pyart

conda install -c conda_forge arm_pyart

-Kevin

On 25 April 2017 at 8:05:35 AM, Ryan Connelly (rconne01@xxxxxxxxx) wrote:

Hi,

Using this code:
https://unidata.github.io/MetPy/examples/formats/NEXRAD_Level_2_File.html#sphx-glr-examples-formats-nexrad-level-2-file-py

Ideally, I should be able to just extract a lat and a lon variable from the
file, except that I don't know if they exist, and if they do, what their
names are.

>From there, I'd like to plot the georeferenced data over a base map using
CartoPy.  Is this possible?  (I just happen to already have some shapefiles
on hand that I want to use that I know CartoPy can read in.)

Thanks,
Ryan

--
Ryan Connelly
M.S. Student in Atmospheric Sciences, Stony Brook University
B.S. in Meteorology with Minors in Mathematics and GIS, Valparaiso
University
rconne01@xxxxxxxxx
ryan.connelly@xxxxxxxxxxxxxx
_______________________________________________
NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web. Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.


python-users mailing list
python-users@xxxxxxxxxxxxxxxxxxxxxxxx
For list information, to unsubscribe, or change your membership options,
visit: http://www.unidata.ucar.edu/mailing_lists/

-- 
Kevin Goebbert, Ph.D.
Associate Professor of Meteorology
Kallay-Christopher Hall, 201-F
1809 Chapel Drive
Valparaiso, IN 46383

(219) 464-5517 <//(219)%20464-5517>
fax: (219) 548-7738 <//(219)%20548-7738>

https://kevingoebbert.youcanbook.me/
  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: