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.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2014-03-31 12:57:06 +00:00
|
|
|
REGUL_GRID_FILE=${proj_dir}/samples/regular_ll_sfc_grib2.tmpl
|
|
|
|
GAUSS_GRID_FILE=${proj_dir}/samples/reduced_gg_pl_640_grib2.tmpl
|
2013-09-23 14:57:42 +00:00
|
|
|
OUTPUT=temp.sections.grib
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2014-06-18 16:14:01 +00:00
|
|
|
##################
|
|
|
|
# Copy the GRID section from REGUL_GRID_FILE
|
2015-03-18 14:35:13 +00:00
|
|
|
${examples_dir}c_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE g $OUTPUT >/dev/null
|
2014-06-18 16:14:01 +00:00
|
|
|
|
|
|
|
# Now the output should have a regular grid
|
2013-09-23 14:57:42 +00:00
|
|
|
# but its date should be the same as the Gaussian grid sample
|
2014-06-18 16:14:01 +00:00
|
|
|
grid_tmpl=`${tools_dir}grib_get -p gridType,date $OUTPUT`
|
|
|
|
[ "$grid_tmpl" = "regular_ll 20100912" ]
|
|
|
|
|
|
|
|
|
|
|
|
##################
|
|
|
|
# Copy the GRID section from GAUSS_GRID_FILE
|
2015-03-18 14:35:13 +00:00
|
|
|
${examples_dir}c_sections_copy $GAUSS_GRID_FILE $REGUL_GRID_FILE g $OUTPUT >/dev/null
|
2014-06-18 16:14:01 +00:00
|
|
|
|
|
|
|
# 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
|
2015-03-18 14:35:13 +00:00
|
|
|
${examples_dir}c_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE gp $OUTPUT >/dev/null
|
2014-06-18 16:14:01 +00:00
|
|
|
|
|
|
|
# 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" ]
|
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2014-06-18 16:14:01 +00:00
|
|
|
##################
|
|
|
|
# Copy all sections from REGUL_GRID_FILE (use commas)
|
2015-03-18 14:35:13 +00:00
|
|
|
${examples_dir}c_sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE p,l,g,d,b $OUTPUT >/dev/null
|
2013-09-23 14:57:42 +00:00
|
|
|
|
2014-06-18 16:14:01 +00:00
|
|
|
# Now the output should be identical to the regular grib
|
|
|
|
${tools_dir}grib_compare $REGUL_GRID_FILE $OUTPUT
|
2013-09-23 14:57:42 +00:00
|
|
|
|
|
|
|
rm -f $OUTPUT
|