How does MCIP calculate the original X and Y values? These values don't match that by python/proj4 computing?

MCIP calculate the original X and Y values: -1097000.000 -1347000.000.
But I use python/proj4 program to transform lon,lat (from GRIDCRO2D.nc variables) to lcc coordinate value, and then I obtain the minimum X and Y, but these two values (-1083266.994369132, -1333552.5508607288) don’t match with calculating by MCIP. The code as follows:
geo_file = ‘GRIDCRO2D.nc’
data = Dataset(geo_file, mode=‘r’)
lon = data.variables[‘LON’][0,0,:,:]
lat = data.variables[‘LAT’][0,0,:,:]
Proj4To = Proj(’+proj=lcc +a=6370000.0 +b=6370000.0 +lat_1=36 +lat_2=46 +lat_0=42 +lon_0=126’)
Proj4From = Proj(proj=‘latlong’, datum=‘WGS84’)
X = []
Y = []
for i in range(len(lon[:,0])):
for j in range(len(lon[0,:])):
lcc_sinu_bottom = transform(Proj4From, Proj4To, lon[i,j],lat[i,j])
X.append(lcc_sinu_bottom[0]),Y.append(lcc_sinu_bottom[1])
print(max(X),min(X),max(Y),min(Y))

1 Like

CMAQ and MCIP model the Earth as a sphere with a radius of 6370 km. See if you can specify a proj4 projection string that matches that.

Hi Chris,
Thank you for your help ! I found the original value I calculated differs by half a grid (27000) from the value calculated by MCIP. As the follows:
Me : -1083266 - 27000/2 = -1096766, -1333552 - 27000/2 = -1347052
MCIP: -1097000.000, -1347000.000

And, I guess each original point of the WRF is at the center of the grid point in geographic coordinates and the origin is at the lower left corner of the grid in the Lambert projection coordinate?

Chao

I had addressed this question. I can correctly transform by the GRIDDOT2D.nc.

Yes. That is documented here:
https://cjcoats.github.io/ioapi/GRIDS.html

Thank you for your help!