-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added netcdf4 flag to Linux_options.yml * Update CMakeLists.txt * Update Config.c * Added tests for netcdf * fixed potential source of error in developer workflow * removed tarball * restored netcdf tarball * updated some file names * temporarily adding flags to developer workflow to view test coverage * forgot to install libaec in last commit * more tests * Update run_wgrib2_netcdf4_tests.sh * adding more tests * removed recent test - wasn't working * fixed comments * more tests --------- Co-authored-by: Edward Hartnett <[email protected]>
- Loading branch information
1 parent
ef98afb
commit 7264649
Showing
8 changed files
with
272,938 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$nlev 5 | ||
$levs 0.1 0.07 0.04 0.02 0.01 | ||
$grads 1 | ||
UGRD:*:u | ||
VGRD:*:v | ||
TMP:*:temp | ||
HGT:*:hgtprs | ||
RH:*:rh |
272,829 changes: 272,829 additions & 0 deletions
272,829
tests/data/ref_ncdump4.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
Large diffs are not rendered by default.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
tests/data/ref_tablenc.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
netcdf tablenc { | ||
dimensions: | ||
latitude = 181 ; | ||
longitude = 360 ; | ||
time = UNLIMITED ; // (1 currently) | ||
plevel = 5 ; | ||
variables: | ||
double latitude(latitude) ; | ||
latitude:units = "degrees_north" ; | ||
latitude:long_name = "latitude" ; | ||
double longitude(longitude) ; | ||
longitude:units = "degrees_east" ; | ||
longitude:long_name = "longitude" ; | ||
double time(time) ; | ||
time:units = "seconds since 1970-01-01 00:00:00.0 0:00" ; | ||
time:long_name = "verification time generated by wgrib2 function verftime()" ; | ||
time:reference_time = 1714132800. ; | ||
time:reference_time_type = 1 ; | ||
time:reference_date = "2024.04.26 12:00:00 UTC" ; | ||
time:reference_time_description = "analyses, reference date is fixed" ; | ||
time:time_step_setting = "auto" ; | ||
time:time_step = 0. ; | ||
float plevel(plevel) ; | ||
plevel:lev_type = 100 ; | ||
plevel:units = "mb" ; | ||
plevel:long_name = "pressure level" ; | ||
plevel:_FillValue = 9.999e+20f ; | ||
float hgtprs(time, plevel, latitude, longitude) ; | ||
hgtprs:_FillValue = 9.999e+20f ; | ||
hgtprs:short_name = "hgtprs" ; | ||
hgtprs:long_name = "Geopotential Height" ; | ||
hgtprs:level = "pressure level" ; | ||
hgtprs:units = "m" ; | ||
float temp(time, plevel, latitude, longitude) ; | ||
temp:_FillValue = 9.999e+20f ; | ||
temp:short_name = "temp" ; | ||
temp:long_name = "Temperature" ; | ||
temp:level = "pressure level" ; | ||
temp:units = "K" ; | ||
float rh(time, plevel, latitude, longitude) ; | ||
rh:_FillValue = 9.999e+20f ; | ||
rh:short_name = "rh" ; | ||
rh:long_name = "Relative Humidity" ; | ||
rh:level = "pressure level" ; | ||
rh:units = "percent" ; | ||
float u(time, plevel, latitude, longitude) ; | ||
u:_FillValue = 9.999e+20f ; | ||
u:short_name = "u" ; | ||
u:long_name = "U-Component of Wind" ; | ||
u:level = "pressure level" ; | ||
u:units = "m/s" ; | ||
float v(time, plevel, latitude, longitude) ; | ||
v:_FillValue = 9.999e+20f ; | ||
v:short_name = "v" ; | ||
v:long_name = "V-Component of Wind" ; | ||
v:level = "pressure level" ; | ||
v:units = "m/s" ; | ||
|
||
// global attributes: | ||
:Conventions = "COARDS" ; | ||
:History = "created by wgrib2" ; | ||
:GRIB2_grid_template = 0 ; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
#!/bin/sh | ||
# This checks the use of AEC compression, only available if USE_NETCDF4 is turned on in CMake. | ||
# This checks the use of netcdf, only available if USE_NETCDF4 is turned on in CMake. | ||
# | ||
# Alyson Stahl, 4/22/24 | ||
|
||
set -e | ||
set -x | ||
|
||
echo "*** Testing converting from grib to netcdf to grib" | ||
# make template | ||
../wgrib2/wgrib2 data/tmp_int.grb -rpn 0 -grib_out junk.template | ||
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -rpn 0 -grib_out junk_netcdf.template | ||
|
||
# make netcdf file | ||
../wgrib2/wgrib2 data/tmp_int.grb -nc3 -netcdf junk.nc | ||
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -nc3 -netcdf junk_netcdf.nc | ||
|
||
# convert netcdf to grb | ||
../wgrib2/wgrib2 junk.template -import_netcdf junk.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk.grb | ||
../wgrib2/wgrib2 junk_netcdf.template -import_netcdf junk_netcdf.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk_netcdf.grb | ||
|
||
n=`../wgrib2/wgrib2 data/tmp_int.grb -var -lev -rpn "sto_1" -import_grib junk.grb -rpn "rcl_1:print_rms" | \ | ||
n=`../wgrib2/wgrib2 data/ref_simple_packing.grib2 -var -lev -rpn "sto_1" -import_grib junk_netcdf.grb -rpn "rcl_1:print_rms" | \ | ||
grep -v ":rpn=0:" | wc -l` | ||
|
||
rm junk.grb junk.nc junk.template | ||
if [ "$n" -eq 1 ] ; then | ||
echo "success" | ||
exit 0 | ||
else | ||
rm junk_netcdf.grb junk_netcdf.nc junk_netcdf.template | ||
if [ "$n" -ne 1 ] ; then | ||
exit 1 | ||
fi | ||
|
||
echo "*** SUCCESS!" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
#!/bin/sh | ||
# This checks the use of AEC compression, only available if USE_NETCDF4 is turned on in CMake. | ||
# This checks the use of netcdf, only available if USE_NETCDF4 is turned on in CMake. | ||
# | ||
# Alyson Stahl, 4/22/24 | ||
|
||
set -e | ||
set -x | ||
|
||
echo "*** Testing converting from grib to netcdf to grib" | ||
# make template | ||
../wgrib2/wgrib2 data/tmp_int.grb -rpn 0 -grib_out junk.template | ||
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -rpn 0 -grib_out junk_netcdf.template | ||
|
||
# make netcdf file | ||
../wgrib2/wgrib2 data/tmp_int.grb -nc4 -netcdf junk.nc | ||
../wgrib2/wgrib2 data/ref_simple_packing.grib2 -nc4 -netcdf junk_netcdf.nc | ||
|
||
# convert netcdf to grb | ||
../wgrib2/wgrib2 junk.template -import_netcdf junk.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk.grb | ||
../wgrib2/wgrib2 junk_netcdf.template -import_netcdf junk_netcdf.nc TMP_500mb "0:1:0:181:0:360" -grib_out junk_netcdf.grb | ||
|
||
n=`../wgrib2/wgrib2 data/tmp_int.grb -var -lev -rpn "sto_1" -import_grib junk.grb -rpn "rcl_1:print_rms" | \ | ||
n=`../wgrib2/wgrib2 data/ref_simple_packing.grib2 -var -lev -rpn "sto_1" -import_grib junk_netcdf.grb -rpn "rcl_1:print_rms" | \ | ||
grep -v ":rpn=0:" | wc -l` | ||
|
||
rm junk.grb junk.nc junk.template | ||
if [ "$n" -eq 1 ] ; then | ||
echo "success" | ||
exit 0 | ||
else | ||
rm junk_netcdf.grb junk_netcdf.nc junk_netcdf.template | ||
if [ "$n" -ne 1 ] ; then | ||
exit 1 | ||
fi | ||
|
||
echo "*** Testing converting from grib to netcdf with variables stored in 3D structure" | ||
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -nc_nlev 7 -netcdf junk_netcdf.nc -match ":(UGRD|VGRD|HGT|TMP):" | ||
ncdump -v HGT,TMP,UGRD,VGRD junk_netcdf.nc > netcdf.txt | ||
touch netcdf.txt | ||
diff -w data/ref_ncdump4.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt netcdf.txt | ||
|
||
|
||
echo "*** Testing converting from grib to netcdf using table" | ||
../wgrib2/wgrib2 data/gdas.t12z.pgrb2.1p00.anl.75r.grib2 -match ":(UGRD|VGRD|TMP|HGT|RH):" -nc_table data/nctab.table -netcdf tablenc.nc | ||
ncdump -h tablenc.nc > tablenc.txt | ||
touch tablenc.txt | ||
diff -w tablenc.txt data/ref_tablenc.gdas.t12z.pgrb2.1p00.anl.75r.grib2.txt | ||
|
||
echo "*** SUCCESS!" | ||
exit 0 |