mirror of https://github.com/ecmwf/eccodes.git
Testing: Add test for NetCDF-4 and HDF5
This commit is contained in:
parent
ea7ea3e197
commit
2903d3b06a
|
@ -33,6 +33,8 @@ tempGrib=temp.${label}.grib
|
||||||
tempNetcdf=temp.${label}.nc
|
tempNetcdf=temp.${label}.nc
|
||||||
tempText=temp.${label}.txt
|
tempText=temp.${label}.txt
|
||||||
|
|
||||||
|
have_netcdf4=0
|
||||||
|
|
||||||
# Do we have ncdump?
|
# Do we have ncdump?
|
||||||
NC_DUMPER=""
|
NC_DUMPER=""
|
||||||
if command -v "ncdump" >/dev/null 2>&1; then
|
if command -v "ncdump" >/dev/null 2>&1; then
|
||||||
|
@ -51,6 +53,20 @@ if test "x$NC_DUMPER" != "x"; then
|
||||||
grep -q "short tp_0001" $tempText
|
grep -q "short tp_0001" $tempText
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Test HDF5 decoding ..."
|
||||||
|
# -------------------------
|
||||||
|
# Note: this is only available in NetCDF-4. So need to check if the command worked with -k3
|
||||||
|
input=${data_dir}/sample.grib2
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_to_netcdf -k3 -o $tempNetcdf $input 2>/dev/null
|
||||||
|
stat=$?
|
||||||
|
set -e
|
||||||
|
if [ $stat -eq 0 ]; then
|
||||||
|
have_netcdf4=1
|
||||||
|
res=`${tools_dir}/grib_get -TA -p identifier,versionNumberOfSuperblock,endOfFileAddress $tempNetcdf`
|
||||||
|
[ "$res" = "HDF5 0 11973" ]
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
grib_files="\
|
grib_files="\
|
||||||
regular_latlon_surface.grib2 \
|
regular_latlon_surface.grib2 \
|
||||||
|
@ -78,8 +94,10 @@ echo "Test creating different kinds; netcdf3 classic and large ..."
|
||||||
input=${data_dir}/regular_latlon_surface.grib2
|
input=${data_dir}/regular_latlon_surface.grib2
|
||||||
${tools_dir}/grib_to_netcdf -k 1 -o $tempNetcdf $input >/dev/null
|
${tools_dir}/grib_to_netcdf -k 1 -o $tempNetcdf $input >/dev/null
|
||||||
${tools_dir}/grib_to_netcdf -k 2 -o $tempNetcdf $input >/dev/null
|
${tools_dir}/grib_to_netcdf -k 2 -o $tempNetcdf $input >/dev/null
|
||||||
#${tools_dir}/grib_to_netcdf -k 3 -o $tempNetcdf $input >/dev/null
|
if [ $have_netcdf4 -eq 1 ]; then
|
||||||
#${tools_dir}/grib_to_netcdf -k 4 -o $tempNetcdf $input >/dev/null
|
${tools_dir}/grib_to_netcdf -k 3 -o $tempNetcdf $input >/dev/null
|
||||||
|
${tools_dir}/grib_to_netcdf -k 4 -o $tempNetcdf $input >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Test ECC-1060 ..."
|
echo "Test ECC-1060 ..."
|
||||||
# ----------------------
|
# ----------------------
|
||||||
|
|
Loading…
Reference in New Issue