mirror of https://github.com/ecmwf/eccodes.git
Unit test for grib_util_sections_copy
This commit is contained in:
parent
1cdbdeacd3
commit
5d96b407af
|
@ -2,7 +2,7 @@
|
|||
AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@
|
||||
|
||||
TESTS = iterator.sh get.sh print_data.sh set.sh keys_iterator.sh multi.sh multi_write.sh \
|
||||
precision.sh list.sh large_grib1.sh get_data.sh
|
||||
precision.sh list.sh large_grib1.sh get_data.sh sections_copy.sh
|
||||
|
||||
noinst_PROGRAMS = nearest set_bitmap iterator get print_data set set_missing keys_iterator \
|
||||
set_data mars_param values_check box multi multi2 multi_write precision \
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
void usage(char* prog) {
|
||||
printf("usage: %s in1.grib in2.grib out.grib\n",prog);
|
||||
printf("in1.grib\t The grib in whose sections we are interested, i.e. the source of the sections (read-only)\n");
|
||||
printf("in2.grib\t The input grib (read-only)\n");
|
||||
printf("out.grib\t The output file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -47,7 +50,8 @@ int main ( int argc, char* argv[]) {
|
|||
GRIB_CHECK(err,0);
|
||||
fclose(in);
|
||||
|
||||
what=GRIB_SECTION_PRODUCT | GRIB_SECTION_LOCAL;
|
||||
/*what=GRIB_SECTION_PRODUCT | GRIB_SECTION_LOCAL;*/
|
||||
what=GRIB_SECTION_GRID;
|
||||
h=grib_util_sections_copy(hfrom,hto,what,&err);
|
||||
GRIB_CHECK(err,0);
|
||||
|
||||
|
|
|
@ -9,6 +9,21 @@
|
|||
|
||||
. ./include.sh
|
||||
|
||||
${examples_dir}sections_copy ../../data/in_copy.grib ../../data/out_copy.grib
|
||||
REGUL_GRID_FILE=../../samples/regular_ll_sfc_grib2.tmpl
|
||||
GAUSS_GRID_FILE=../../samples/reduced_gg_pl_640_grib2.tmpl
|
||||
OUTPUT=temp.sections.grib
|
||||
|
||||
${examples_dir}sections_copy $REGUL_GRID_FILE $GAUSS_GRID_FILE $OUTPUT
|
||||
# Now the output should have a regular grid i.e. gridDefinitionTemplateNumber==0
|
||||
# but its date should be the same as the Gaussian grid sample
|
||||
grid_tmpl=`${tools_dir}grib_get -p gridDefinitionTemplateNumber,date $OUTPUT`
|
||||
[ "$grid_tmpl" = "0 20100912" ]
|
||||
|
||||
|
||||
${examples_dir}sections_copy $GAUSS_GRID_FILE $REGUL_GRID_FILE $OUTPUT
|
||||
# Now the output should have a reduced gaussian grid i.e. gridDefinitionTemplateNumber==40
|
||||
# but its date should be the same as the Regular grid sample
|
||||
grid_tmpl=`${tools_dir}grib_get -p gridDefinitionTemplateNumber,date $OUTPUT`
|
||||
[ "$grid_tmpl" = "40 20070323" ]
|
||||
|
||||
rm -f $OUTPUT
|
||||
|
|
Loading…
Reference in New Issue