2013-03-25 12:04:10 +00:00
|
|
|
#!/bin/sh
|
2017-01-03 11:03:48 +00:00
|
|
|
# Copyright 2005-2017 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.
|
2014-08-28 09:03:16 +00:00
|
|
|
#
|
2013-03-25 12:04:10 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
REDIRECT=/dev/null
|
|
|
|
|
|
|
|
grib1=${data_dir}/regular_latlon_surface.grib1
|
|
|
|
grib2=${data_dir}/regular_latlon_surface.grib2
|
|
|
|
infile=${data_dir}/reduced_gaussian_model_level.grib1
|
|
|
|
outfile=${data_dir}/with_bitmap.grib1
|
|
|
|
outfile1=${data_dir}/without_bitmap.grib1
|
|
|
|
|
2016-10-24 13:55:53 +00:00
|
|
|
rm -f $outfile
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
${tools_dir}grib_set -s bitmapPresent=1 $infile $outfile >$REDIRECT
|
|
|
|
|
|
|
|
${tools_dir}grib_dump -O $infile | grep -v FILE > $infile.dump
|
|
|
|
${tools_dir}grib_dump -O $outfile | grep -v FILE > $outfile.dump
|
|
|
|
|
|
|
|
diff $outfile.dump ${data_dir}/bitmap.diff
|
|
|
|
diff $infile.dump ${data_dir}/no_bitmap.diff
|
|
|
|
|
|
|
|
rm -f $infile.dump $outfile.dump || true
|
|
|
|
|
|
|
|
${tools_dir}grib_set -s bitmapPresent=0 $outfile $outfile1 >$REDIRECT
|
|
|
|
|
|
|
|
${tools_dir}grib_dump -O $outfile1 | grep -v FILE > $outfile1.dump
|
|
|
|
${tools_dir}grib_dump -O $outfile | grep -v FILE> $outfile.dump
|
|
|
|
|
|
|
|
diff $outfile1.dump ${data_dir}/no_bitmap.diff
|
|
|
|
|
|
|
|
rm -f $outfile1 $outfile1.dump $outfile $outfile.dump || true
|
|
|
|
|
|
|
|
cat > bitmap.rules<<EOF
|
|
|
|
set bitmapPresent=1;
|
|
|
|
set missingValue=1111;
|
|
|
|
set Ni=6;
|
|
|
|
set Nj=2;
|
|
|
|
set values={1,2,3,4,5,6,7,1111,1111,8,9,10};
|
|
|
|
write ;
|
|
|
|
EOF
|
|
|
|
|
2016-10-24 13:55:53 +00:00
|
|
|
${tools_dir}grib_filter -o out.bmp.grib1 bitmap.rules $grib1
|
|
|
|
${tools_dir}grib_filter -o out.bmp.grib2 bitmap.rules $grib2
|
2013-11-13 17:20:59 +00:00
|
|
|
#exit 0
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-10-24 13:55:53 +00:00
|
|
|
${tools_dir}grib_get_data -m missing out.bmp.grib1 > out.bmp.grib1.data
|
|
|
|
${tools_dir}grib_get_data -m missing out.bmp.grib2 > out.bmp.grib2.data
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-10-24 13:55:53 +00:00
|
|
|
diff out.bmp.grib1.data out.bmp.grib2.data
|
2014-08-28 09:03:16 +00:00
|
|
|
|
2016-10-24 13:55:53 +00:00
|
|
|
rm -f out.bmp.grib1.data out.bmp.grib2.data out.bmp.grib1 out.bmp.grib2 bitmap.rules
|
2014-08-28 09:03:16 +00:00
|
|
|
|