/usr/bin/grib1to2 is in libgrib-api-tools 1.9.9-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/bin/sh
set -e
if [ $# < 2 ]
then
echo "usage: [-f] $0 in.grib1 out.grib2"
echo "-f convert to grib2 only typeOfLevel='hybrid' and copy other level types as grib1"
exit 1
fi
grib_filter=/usr/bin/grib_filter
rules_filter=rules.filter$$
force=0
out=$2
in=$1
while getopts fd:D:t:b:w:e:r:s:n:p: options
do
case $options in
f) force=1
out=$3
in=$2
;;
esac
done
if [ $force = 1 ]
then
cat >> $rules_filter <<EOF
if ( typeOfLevel is 'hybrid' ) {
set edition=2;
}
write;
EOF
else
cat >> $rules_filter <<EOF
if ( ! typeOfLevel is 'hybrid' ) {
print "Error: typeOfLevel='[typeOfLevel]' unable to convert. Only typeOfLevel='hybrid' can be converted.";
assert( typeOfLevel is 'hybrid' );
}
set edition=2;
write;
EOF
fi
set +e
$grib_filter -o $out $rules_filter $in
error=$?
rm -f $rules_filter
exit $error
|