SunJianping
New member
I'm trying to interpolate some data based on the projection coordinate system, and I find that the output of ll_to_xy() function is different from which returned by cartopy method cartopy.crs.Projection.transform_point(). Here is an example:
Result:
I've tried other map projection calculators and have confirmed that the result given by cartopy is correct. So what excactly does ll_to_xy returns? Looking forward to any replies.
Python:
from netCDF4 import Dataset
from wrf import getvar, CoordPair, xy_to_ll, ll_to_xy, get_cartopy, latlon_coords
import cartopy.crs as ccrs
wrfout = Dataset('wrfout_d01_2019-08-07_00_00_00')
slp = getvar(wrfout, 'slp', timeidx=0)
cart_proj = get_cartopy(slp)
xy_cartopy = cart_proj.transform_point(122, 30, ccrs.PlateCarree())
xy_wrfpy = ll_to_xy(wrfout, 30, 122, as_int=False)
print(xy_cartopy)
print(xy_wrfpy)
Result:
Python:
(204023.2701774671, 70339.28035986092)
<xarray.DataArray 'xy' (x_y: 2)>
array([121.50213256, 119.3614694 ])
Coordinates:
latlon_coord object CoordPair(lat=30, lon=122)
* x_y (x_y) <U1 'x' 'y'
I've tried other map projection calculators and have confirmed that the result given by cartopy is correct. So what excactly does ll_to_xy returns? Looking forward to any replies.
Last edited: