2013-03-25 12:04:10 +00:00
|
|
|
#!/bin/sh
|
2019-04-15 13:44:45 +00:00
|
|
|
# Copyright 2005-2019 ECMWF.
|
2013-03-25 12:04:10 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
|
|
|
. ./include.sh
|
|
|
|
|
|
|
|
infile=${data_dir}/regular_latlon_surface.grib1
|
|
|
|
shdata=${data_dir}/spherical_model_level.grib1
|
|
|
|
suff=_ieee_test.grib1
|
|
|
|
outsimple=simple$suff
|
|
|
|
out32=32$suff
|
|
|
|
out64=64$suff
|
|
|
|
|
|
|
|
cat > w.filter <<EOF
|
|
|
|
set Nj = 2;
|
|
|
|
set latitudeOfFirstGridPointInDegrees = 60;
|
|
|
|
set latitudeOfLastGridPointInDegrees = 59;
|
|
|
|
set Ni = 3;
|
|
|
|
set longitudeOfFirstGridPointInDegrees = 0;
|
|
|
|
set longitudeOfLastGridPointInDegrees = 2;
|
|
|
|
set DjInDegrees = 1;
|
|
|
|
set DiInDegrees = 1;
|
|
|
|
set values={1.234567e-36,2.34567e-36,1.234567e-36,2.34567e-36,1.234567e-36,2.34567e-36};
|
|
|
|
write;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > r.filter <<EOF
|
2015-10-14 09:22:00 +00:00
|
|
|
print "[values%g]";
|
2013-03-25 12:04:10 +00:00
|
|
|
EOF
|
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_filter -o $outsimple w.filter $infile
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_filter r.filter $outsimple > $outsimple.txt
|
2013-03-25 12:04:10 +00:00
|
|
|
diff $outsimple.txt ${data_dir}/ieee_test.good
|
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -r -s packingType=grid_ieee $outsimple $out32
|
|
|
|
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
2016-02-02 11:29:30 +00:00
|
|
|
diff $out32.txt ${data_dir}/ieee_test.good
|
|
|
|
|
2019-08-16 20:00:48 +00:00
|
|
|
GRIB_IEEE_PACKING=32
|
|
|
|
export GRIB_IEEE_PACKING
|
|
|
|
${tools_dir}/grib_filter -o $out32 w.filter $infile
|
|
|
|
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
|
|
|
diff $out32.txt ${data_dir}/ieee_test.good
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2019-08-16 20:00:48 +00:00
|
|
|
GRIB_IEEE_PACKING=64
|
|
|
|
export GRIB_IEEE_PACKING
|
|
|
|
${tools_dir}/grib_filter -o $out64 w.filter $infile
|
|
|
|
${tools_dir}/grib_filter r.filter $out64 > $out64.txt
|
|
|
|
diff $out64.txt ${data_dir}/ieee_test.good
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
rm -f $outsimple $out32 $out64 $out32.txt $out64.txt
|
|
|
|
rm -f ${data_dir}/$outsimple.txt ${data_dir}/$out32.txt ${data_dir}/$out64.txt
|
2014-04-12 20:15:11 +00:00
|
|
|
rm -f w.filter $outsimple.txt
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_filter r.filter $shdata > $shdata.txt
|
2013-03-25 12:04:10 +00:00
|
|
|
diff $shdata.txt $shdata.good
|
|
|
|
|
2017-02-03 14:21:24 +00:00
|
|
|
${tools_dir}/grib_set -r -s packingType=grid_ieee $shdata ${shdata}_ieee
|
|
|
|
${tools_dir}/grib_filter r.filter ${shdata}_ieee > $shdata.txt
|
2016-02-02 11:29:30 +00:00
|
|
|
diff $shdata.txt $shdata.good
|
2016-02-05 09:48:25 +00:00
|
|
|
rm -f ${shdata}_ieee
|
2016-02-02 11:29:30 +00:00
|
|
|
|
2019-08-16 20:00:48 +00:00
|
|
|
##################################
|
|
|
|
# Disabled for now. Infinite loop
|
2016-02-02 11:29:30 +00:00
|
|
|
#GRIB_IEEE_PACKING=32
|
|
|
|
#export GRIB_IEEE_PACKING
|
2017-02-03 14:21:24 +00:00
|
|
|
#${tools_dir}/grib_copy -r $shdata ${shdata}_32
|
|
|
|
#${tools_dir}/grib_filter r.filter ${shdata}_32 > ${shdata}_32.txt
|
2013-03-25 12:04:10 +00:00
|
|
|
#diff ${shdata}_32.txt ${shdata}_32.good
|
|
|
|
|
2016-02-02 11:29:30 +00:00
|
|
|
#GRIB_IEEE_PACKING=64
|
|
|
|
#export GRIB_IEEE_PACKING
|
2017-02-03 14:21:24 +00:00
|
|
|
#${tools_dir}/grib_copy -r $shdata ${shdata}_64
|
|
|
|
#${tools_dir}/grib_filter r.filter ${shdata}_64 > ${shdata}_64.txt
|
2013-03-25 12:04:10 +00:00
|
|
|
#diff ${shdata}_64.txt ${shdata}.good
|
|
|
|
|
2013-11-13 12:49:54 +00:00
|
|
|
rm -f r.filter ${shdata}_64.txt ${shdata}_32.txt $shdata.txt
|