File: grib_sections_copy.sh

package info (click to toggle)
eccodes 2.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,404 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: 283; xml: 183; awk: 66
file content (60 lines) | stat: -rwxr-xr-x 2,204 bytes parent folder | download | duplicates (2)
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
59
60
#!/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

REGUL_GRID_FILE=${proj_dir}/samples/regular_ll_sfc_grib2.tmpl
GAUSS_GRID_FILE=${proj_dir}/samples/reduced_gg_pl_640_grib2.tmpl
OUTPUT=temp.sections.grib


sample_pv=$ECCODES_SAMPLES_PATH/reduced_gg_ml_grib1.tmpl
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
${examples_dir}/c_grib_sections_copy $sample_pv $sample_g1 l $OUTPUT
${examples_dir}/c_grib_sections_copy $sample_pv $sample_pv g $OUTPUT


##################
# Copy the GRID section from REGUL_GRID_FILE
${examples_dir}/c_grib_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE g $OUTPUT >/dev/null

# Now the output should have a regular grid
# but its date should be the same as the Gaussian grid sample
grid_tmpl=`${tools_dir}/grib_get -p gridType,date $OUTPUT`
[ "$grid_tmpl" = "regular_ll 20100912" ]


##################
# Copy the GRID section from GAUSS_GRID_FILE
${examples_dir}/c_grib_sections_copy $GAUSS_GRID_FILE $REGUL_GRID_FILE g $OUTPUT >/dev/null

# Now the output should have a gaussian grid
# but its date should be the same as the regular grid
grid_tmpl=`${tools_dir}/grib_get -p gridType,date $OUTPUT`
[ "$grid_tmpl" = "reduced_gg 20070323" ]


##################
# Copy both the PRODUCT and GRID sections from REGUL_GRID_FILE
${examples_dir}/c_grib_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE gp $OUTPUT >/dev/null

# Now the output should have a regular grid
# and its date should be the same as the regular latlon
grid_tmpl=`${tools_dir}/grib_get -p gridType,date $OUTPUT`
[ "$grid_tmpl" = "regular_ll 20070323" ]


##################
# Copy all sections from REGUL_GRID_FILE (use commas)
${examples_dir}/c_grib_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE p,l,g,d,b $OUTPUT >/dev/null

# Now the output should be identical to the regular grib
${tools_dir}/grib_compare $REGUL_GRID_FILE $OUTPUT

rm -f $OUTPUT