import wrf
## x, y to lat, long works fine.
wrf.xy_to_ll_proj(x=203, y=100, map_proj=6, stand_lon=-8,
ref_lat=43.912167, ref_lon=4.119123, pole_lat=43.2,
pole_lon=180, known_x=0, known_y=0, dx=1528.68,
dy=1528.68)
wrf.xy_to_ll_proj(x=204, y=100, map_proj=6, stand_lon=-8,
ref_lat=43.912167, ref_lon=4.119123, pole_lat=43.2,
pole_lon=180, known_x=0, known_y=0, dx=1528.68,
dy=1528.68)
## x=203, y=100 gives latitude=45.35623931, longitude=7.99014617
## x=204, y=100 gives latitude=45.35623932, longitude=8.0097073
## lat, long to x, y produces longitude that is correct until
## longitude >= -1*stand_lon.
wrf.ll_to_xy_proj(latitude=45.35623931, longitude=7.99014617,
map_proj=6, stand_lon=-8, ref_lat=43.912167,
ref_lon=4.119123, pole_lat=43.2, pole_lon=180,
known_x=0, known_y=0, dx=1528.68, dy=1528.68)
wrf.ll_to_xy_proj(latitude=45.35623932, longitude=8.0097073,
map_proj=6, stand_lon=-8, ref_lat=43.912167,
ref_lon=4.119123, pole_lat=43.2, pole_lon=180,
known_x=0, known_y=0, dx=1528.68, dy=1528.68)
## latitude=45.35623931, longitude=7.99014617 gives x=203, y=100
## latitude=45.35623932, longitude=8.0097073 gives x=-25978, y=100
## The amount by which the x value is wrong is 204--25978 = 26182,
## which is the number of dx-sized pixels in the Earth's
## circumference:
dx = 1528.68
np.round((2*wrf.Constants.WRF_EARTH_RADIUS*wrf.Constants.PI)/dx,0)
## Returns 26182.0.