Convert data, not just coordinates, from polar to Cartesian lat/lon grid in Python

58 Views Asked by At

I have a polar dataset in (theta, r) coordinates in which I reproject to lat/lon coordinates:

x = allrange * np.sin(np.deg2rad(azimuths))[:,None]
y = allrange * np.cos(np.deg2rad(azimuths]))[:,None]

# Setup a projection
dataproj = Proj(f"+proj=eqc +lat_0={latitude} +lat_ts={latitude} +lon_0={longitude} +ellps=WGS84 +units=m")
lons,lats = dataproj(x,y,inverse=True)

I now have a set of latitude and longitudes with dimensions [a,b], the same as the input polar data. I can plot this with cartopy with something like the following:

...
im = ax.pcolormesh(lons,lats,data)
...

And I produce a map. The problem is I would like to be able to actually apply the reprojection to the data so that I can output the data in a lat/lon Cartesian format instead of polar.

0

There are 0 best solutions below