File: grib_secondary_bitmap.sh

package info (click to toggle)
eccodes 2.45.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,456 kB
  • sloc: cpp: 162,953; ansic: 26,308; sh: 21,742; f90: 6,854; perl: 6,361; python: 5,172; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 278; xml: 183; awk: 66
file content (49 lines) | stat: -rwxr-xr-x 1,614 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# 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.ctest.sh

label="grib_secondary_bitmap_test"
tempGribA=temp.$label.A.grib
tempGribB=temp.$label.B.grib
tempFilt=temp.$label.filt
tempLog=temp.$label.log
tempRef=temp.$label.ref

# Use a GRIB2 input with a bitmap
# ----------------------------------
input=$data_dir/reduced_latlon_surface.grib2
grib_check_key_equals $input bitmapPresent 1
${tools_dir}/grib_set -s packingType=grid_simple_matrix,NC=1,NR=1 $input $tempGribA
${tools_dir}/grib_set -s matrixBitmapsPresent=1 $tempGribA $tempGribB
${tools_dir}/grib_dump -O $tempGribB
${tools_dir}/grib_dump -Dat $tempGribB

# Call pack_double and unpack_double
# ----------------------------------
cat >$tempFilt<<EOF
  set values = {0, 1, 9999};
  print "[bitmap]";
EOF
${tools_dir}/grib_filter $tempFilt $tempGribB

# data_g1secondary_bitmap
# ----------------------------------
cat >$tempFilt<<EOF
  transient expandBy = 1;
  meta _s data_g1secondary_bitmap(bitmap,secondaryBitmaps,missingValue,expandBy,octetAtWichPackedDataBegins);
  print "[_s]";
  set _s = {0, 9};
EOF
# The above filter is for testing only. Add -f as we know it will fail
${tools_dir}/grib_filter -f $tempFilt $tempGribB

# Clean up
rm -f $tempGribA $tempGribB $tempFilt $tempLog $tempRef