Hi Dimitri,
Is the problem you're seeing due to the change in the coordinate reference that is being used between the (south_north, west_east) indices when compared to (XLAT, XLON)? I've come across these issues when trying to import the NEWA download inputs into other software which requires a standard CRS (converting NEWA downloads into .wrg formats for example). (south_north, west_east) falls on a nice neat grid, with in your situation, 7 columns and 7 rows, but when XLAT/XLON are plotted you don't get neat columns and rows due to the warping resulting in 49 unique pairs (one for each point in the grid). It means that for coordinate transformation then I've had to loop through per point using something similar to below.
def ts_coordinate_converter(lon, lat):
crs_wkt = 'PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["unknown",ELLIPSOID["unknown",6370000,0,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",54,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",15,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",30,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",60,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",0,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",0,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]'
custom_transformer = pyproj.Transformer.from_crs(
pyproj.CRS.from_string(crs_wkt),
pyproj.CRS.from_epsg(3035),
always_xy=True
)
x, y = custom_transformer.transform(lon, lat)
return (x, y)