2013-03-25 12:04:10 +00:00
|
|
|
#!/bin/sh
|
2015-01-05 15:45:46 +00:00
|
|
|
# Copyright 2005-2015 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.
|
2013-03-25 14:23:07 +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
|
2013-10-21 09:44:36 +00:00
|
|
|
BLACKLIST="totalLength,section5Length,section7Length,dataRepresentationTemplateNumber,typeOfPacking"
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
infile=${data_dir}/jpeg.grib2
|
|
|
|
|
|
|
|
rm -f $infile.1 $infile.2 || true
|
|
|
|
|
|
|
|
${tools_dir}grib_set -s packingType=grid_simple $infile $infile.1
|
2013-10-21 09:44:36 +00:00
|
|
|
${tools_dir}grib_compare -P -b $BLACKLIST,typeOfCompressionUsed,targetCompressionRatio $infile $infile.1 > $REDIRECT
|
2013-03-25 12:04:10 +00:00
|
|
|
${tools_dir}grib_set -s packingType=grid_jpeg $infile.1 $infile.2
|
2013-10-21 09:44:36 +00:00
|
|
|
${tools_dir}grib_compare -P -b $BLACKLIST $infile.1 $infile.2 > $REDIRECT
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
templateNumber=`${tools_dir}grib_get -p dataRepresentationTemplateNumber $infile.2`
|
|
|
|
|
|
|
|
if [ $templateNumber -ne 40 ]
|
|
|
|
then
|
|
|
|
echo dataRepresentationTemplateNumber=$templateNumber
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $infile.1 $infile.2 || true
|
|
|
|
|
|
|
|
infile=${data_dir}/reduced_latlon_surface.grib2
|
|
|
|
|
|
|
|
${tools_dir}grib_set -s packingType=grid_jpeg $infile $infile.1
|
2013-10-21 09:44:36 +00:00
|
|
|
${tools_dir}grib_compare -P -b $BLACKLIST $infile $infile.1 > $REDIRECT
|
2013-03-25 12:04:10 +00:00
|
|
|
${tools_dir}grib_set -s packingType=grid_simple $infile.1 $infile.2
|
2013-10-21 09:44:36 +00:00
|
|
|
${tools_dir}grib_compare -P -b $BLACKLIST,typeOfCompressionUsed,targetCompressionRatio $infile.1 $infile.2 > $REDIRECT
|
|
|
|
|
|
|
|
res1=`${tools_dir}grib_get '-F%1.2f' -p min,max,avg $infile`
|
|
|
|
res2=`${tools_dir}grib_get '-F%1.2f' -p min,max,avg $infile.1`
|
|
|
|
res3=`${tools_dir}grib_get '-F%1.2f' -p min,max,avg $infile.2`
|
|
|
|
[ "$res1" = "$res2" ]
|
|
|
|
[ "$res1" = "$res3" ]
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2014-07-25 10:13:00 +00:00
|
|
|
# GRIB-564 nearest 4 neighbours with JPEG packing
|
|
|
|
res=`${tools_dir}grib_get -l 0,50 $infile.1`
|
|
|
|
[ "$res" = "2.47244 2.47244 2.5115 2.51931 " ]
|
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
rm -f $infile.1 $infile.2 || true
|