On 7/20/2010 4:45 PM, Todd Plessel wrote:
Hi John,
Thanks for looking into this.
To recap...
WRF polar file contents:
Some relevant attributes are:
west_east = 199 ;
south_north = 199 ;
float LU_INDEX(Time, south_north, west_east) ;
:DX = 108000.f ;
:DY = 108000.f ;
:GRIDTYPE = "C" ;
:MAP_PROJ = 2 ;
:CEN_LAT = 90.f ;
:CEN_LON = -8.f ;
:TRUELAT1 = 45.f ;
:TRUELAT2 = 45.f ;
:MOAD_CEN_LAT = 90.f ;
:STAND_LON = -98.f ;
CEN_LON should probably = -98 = STAND_LON
just as CEN_LAT = 90 = MOAD_CEN_LAT.
Code fix:
ucar.nc2.dataset.conv.WRFConvention, to use centralLat ("CEN_LAT") when
available:
case 2:
// Thanks to Heiko Klein for figuring out WRF Stereographic
double lon0 = (Double.isNaN(standardLon)) ? centralLon : standardLon;
double lat0 = (Double.isNaN(centralLat)) ? lat2 : centralLat; // ??
7/20/2010
double scaleFactor = (1 + Math.abs(Math.sin(Math.toRadians(lat1)))) /
2.; // R Schmunk 9/10/07
// proj = new Stereographic(lat2, lon0, scaleFactor);
proj = new Stereographic(lat0, lon0, scaleFactor);
The code uses STAND_LON instead of CEN_LON.
(These should be the same in the file, but apparently CEN_LON is often bogus.)
apparently
And it computes scale_factor_at_projection_origin = 0.85...
from TRUELAT1 = TRUELAT2 = 45 = secant plane.
That seems correct.
Except there is no way to specify the ellipsoid (e.g., WGS_84, or sphere =
6,370,000m).
the ellipsoid or sphere does not seem to be specified in the WRF file,
is it?
The resulting Projection object is now:
Stereographic type=Projection
grid_mapping_name = stereographic
longitude_of_projection_origin = -98.0
latitude_of_projection_origin = 90.0
scale_factor_at_projection_origin = 0.8535533905932737
Which now matches the object created from CMAQ polar files.
and that change seems to fix the misalignment.
The LU_INDEX now matches the map lines? Great!
seems to
I will have to run my unit tests to see if anything breaks.
Then please let me know when I can download the updated library.
ok
Thanks, for your help, John.
It will fix VERDI and, if rebuilt, IDV also.
Todd
1-919-541-5500