Skip to content

Commit

Permalink
fix for rot lat-lon + 1/n tests
Browse files Browse the repository at this point in the history
  • Loading branch information
webisu committed Jul 31, 2024
1 parent 7eb2504 commit 64ee057
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ option(USE_HDF5 "Use HDF5?" off)
option(USE_REGEX "Use Regex?" on)
option(USE_TIGGE "Use tigge?" on)
option(USE_MYSQL "Use MySQL?" off)
option(USE_IPOLATES "Use Ipolates" off)
option(USE_IPOLATES "Use Ipolates" on)
option(USE_UDF "Use UDF?" off)
option(USE_OPENMP "Use OpenMP?" on)
option(USE_PROJ4 "Use Proj4?" off)
Expand All @@ -29,7 +29,7 @@ option(USE_G2CLIB "Use g2c lib?" off)
option(USE_PNG "Use PNG?" off)
option(USE_JASPER "Use Jasper?" off)
option(USE_OPENJPEG "Use OpenJPEG?" off)
option(USE_AEC "Use AEC?" off)
option(USE_AEC "Use AEC?" of)
option(FTP_TEST_FILES "Fetch and test with files on FTP site." OFF)
option(FTP_LARGE_TEST_FILES "Fetch and test with very large files on FTP site." OFF)
option(FTP_EXTRA_TEST_FILES "Fetch even more large files from FTP and test them." OFF)
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ copy_test_data(ref_sec0.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt)
copy_test_data(ref_sec_len.gdaswave.t00z.wcoast.0p16.f000.grib2.txt)
copy_test_data(ref_sec_len.simple_packing.grib2.txt)
copy_test_data(ref_simple_packing.grib2.spread.txt)
copy_test_data(ref_wmo_rot_lat_lon.txt)

# Run these shell tests.
shell_test(run_wgrib2_tests)
Expand Down
70 changes: 70 additions & 0 deletions tests/data/ncep_grid_wmo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
1:0:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-36.4:(20,80),lon=-9.397244,lat=32.756101,val=-20.4
2:382483:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-22:(20,80),lon=-9.397244,lat=32.756101,val=-19
3:764966:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-37:(20,80),lon=-9.397244,lat=32.756101,val=-28
4:1092836:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-20:(20,80),lon=-9.397244,lat=32.756101,val=-19
5:1475319:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-21.1:(20,80),lon=-9.397244,lat=32.756101,val=-15.1
6:1803189:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-0.4:(20,80),lon=-9.397244,lat=32.756101,val=4.6
7:2131059:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=-6.1:(20,80),lon=-9.397244,lat=32.756101,val=-9.1
8:2458929:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=8.9:(20,80),lon=-9.397244,lat=32.756101,val=17.9
9:2786799:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=1:(20,80),lon=-9.397244,lat=32.756101,val=-6
10:3114669:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=11:(20,80),lon=-9.397244,lat=32.756101,val=14
11:3442539:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=4.9:(20,80),lon=-9.397244,lat=32.756101,val=1.9
12:3770409:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=9:(20,80),lon=-9.397244,lat=32.756101,val=6
13:4043666:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=6.8:(20,80),lon=-9.397244,lat=32.756101,val=6.8
14:4316923:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000:(10,12),lon=-8.771457,lat=28.498272,val=2:(20,80),lon=-9.397244,lat=32.756101,val=5
70 changes: 70 additions & 0 deletions tests/data/ref_wmo_rot_lat_lon.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
1:0:(11,14),lon=-8.743736,lat=28.634338,val=-36.4:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
2:382483:(11,14),lon=-8.743736,lat=28.634338,val=-22:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
3:764966:(11,14),lon=-8.743736,lat=28.634338,val=-37:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
4:1092836:(11,14),lon=-8.743736,lat=28.634338,val=-20:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
5:1475319:(11,14),lon=-8.743736,lat=28.634338,val=-21.1:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
6:1803189:(11,14),lon=-8.743736,lat=28.634338,val=0.6:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
7:2131059:(11,14),lon=-8.743736,lat=28.634338,val=-6.1:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
8:2458929:(11,14),lon=-8.743736,lat=28.634338,val=8.9:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
9:2786799:(11,14),lon=-8.743736,lat=28.634338,val=1:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
10:3114669:(11,14),lon=-8.743736,lat=28.634338,val=11:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
11:3442539:(11,14),lon=-8.743736,lat=28.634338,val=4.9:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
12:3770409:(11,14),lon=-8.743736,lat=28.634338,val=9:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
13:4043666:(11,14),lon=-8.743736,lat=28.634338,val=6.8:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
14:4316923:(11,14),lon=-8.743736,lat=28.634338,val=2:grid_template=1:winds(N/S):
rotated lat-lon grid:(665 x 657) units 1e-06 input WE:SN output WE:SN res 48
lat -20.000000 to 21.000000 by 0.062500
lon 342.000000 to 23.500000 by 0.062500 #points=436905
south pole lat=-40.000000 lon=10.000000 angle of rot=0.000000
5 changes: 5 additions & 0 deletions tests/run_ipolates_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ echo "*** Testing new_grid_order on file in incorrect order."
touch new_grid_reorder.txt
diff -w new_grid_reorder.txt new_grid.txt

echo "*** Testing conversion to wmo rot lat-lon grid"
../wgrib2/wgrib2 test.grb -new_grid_winds earth -new_grid rot-ll:10:-40:0 342:665:0.0625 -20:657:0.0625 \
junk.grb

exit 1
echo "*** Testing conversion to NCEP grid definition 2"
../wgrib2/wgrib2 test.grb -new_grid_winds earth -new_grid ncep grid 2 junk.grb
../wgrib2/wgrib2 junk.grb -grid -v2 -s -lon 10 12 -lon 20 80 > ncep_grid_2.txt
Expand Down
9 changes: 1 addition & 8 deletions wgrib2/New_grid.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,7 @@ int f_new_grid(ARG4) {
if (mode == -1) { // initialization
decode = 1;
output_order_wanted = raw; // in raw order
// ALEX use_ncep_post_arakawa();
// fprintf(stderr,"called use_ncep_post_araka\n");
// use_ncep_post_arakawa();
#ifdef G95
// initialize g95 runtime library
if (g95_runstop == 0) { g95_runtime_start(0,NULL); g95_runstop = 1; }
#endif

use_ncep_post_arakawa();
#ifdef G95
// initialize g95 runtime library
if (g95_runstop == 0) { g95_runtime_start(0,NULL); g95_runstop = 1; }
Expand Down

0 comments on commit 64ee057

Please sign in to comment.