converting cartesian to geographic grid

100 views
Skip to first unread message

Sally Benson

unread,
Jun 1, 2021, 5:34:09 PM6/1/21
to Py-ART Users
Hi, 
I have a file with the pyart cartesian grid.  I need to convert the cartesian grid to lat and lon.  I would like to write this latitude and longitude back out to a file.  The file says that x= "projection_x_coordinate"  and y="projection_y_coordinate" and the projection is = "pyart_aeqd" ;

I tried this in python:

grid=pyart.io.read_grid(fdir+filename)

geogrid=pyart.core.cartesian_to_geographic_aeqd(grid.x['data'],grid.y['data'],grid.origin_longitude['data'],grid.origin_latitude['data'],R=6370997.0)

Following the syntax I see here:  https://arm-doe.github.io/pyart/API/generated/pyart.core.cartesian_to_geographic_aeqd.html

But when I type 'dir(geogrid)', I don't see any latitude or longitude listed in the output..  This is the output from dir(geogrid)

['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']

I must be using this subroutine incorrectly.  Any advice is appreciated.  

Thanks!

Sally

sherma...@gmail.com

unread,
Jun 1, 2021, 5:38:27 PM6/1/21
to Py-ART Users
Hi sally,

The function returns lon then lat as floats, just need to change your code to define each variable:
lon, lat = pyart.core.cartesian_to_geographic_aeqd(grid.x['data'],grid.y['data'],grid.origin_longitude['data'],grid.origin_latitude['data'],R=6370997.0)
with those then can be written to a file,

Cheers,
Zach S.

Reply all
Reply to author
Forward
0 new messages