Sub hourly: Extra tests for native type of step keys

This commit is contained in:
Shahram Najm 2024-01-18 17:14:22 +00:00
parent 305f636ece
commit afc918b3f0
4 changed files with 27 additions and 8 deletions

View File

@ -77,6 +77,7 @@ if( HAVE_BUILD_TOOLS )
grib_clone
grib_copy_message
grib_ensemble_index
grib_index
grib_set_pv
grib_set_bitmap
grib_list

View File

@ -19,7 +19,7 @@
static void usage(const char* prog)
{
printf("usage: %s infile\n", prog);
printf("usage: %s gribfile indexfile\n", prog);
exit(1);
}
@ -27,7 +27,8 @@ int main(int argc, char* argv[])
{
codes_index* index = NULL;
codes_handle* h = NULL;
char* infile = NULL;
char* inputfile = NULL;
char* indexfile = NULL;
long *steps, *levels, *numbers; /* arrays */
char** shortName = NULL;
int i, j, k, l;
@ -37,8 +38,9 @@ int main(int argc, char* argv[])
size_t lenshortName = sizeof(oshortName);
int ret = 0, count = 0;
if (argc != 2) usage(argv[0]);
infile = argv[1];
if (argc != 3) usage(argv[0]);
inputfile = argv[1];
indexfile = argv[2];
printf("indexing...\n");
@ -50,7 +52,7 @@ int main(int argc, char* argv[])
}
/* indexes a file */
ret = codes_index_add_file(index, infile);
ret = codes_index_add_file(index, inputfile);
if (ret) {
fprintf(stderr, "Error: %s\n", codes_get_error_message(ret));
exit(ret);
@ -152,7 +154,7 @@ int main(int argc, char* argv[])
}
printf(" %d messages selected\n", count);
codes_index_write(index, "out.gribidx");
codes_index_write(index, indexfile);
codes_index_delete(index);
return 0;

View File

@ -11,8 +11,13 @@
label="grib_index_c"
tempIndex=temp.$label.idx
tempText=temp.$label.txt
input=$data_dir/tigge_cf_ecmwf.grib2
${examples_dir}/c_grib_index $input $tempIndex
${examples_dir}/c_grib_index $input $tempIndex > $tempText
rm -f $tempIndex
grep -q "43 messages selected" $tempText
${tools_dir}/grib_dump $tempIndex
rm -f $tempIndex $tempText

View File

@ -445,6 +445,17 @@ status=$?
set -e
[ $status -ne 0 ]
# Setting step
# -------------
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
echo 'set step = 12; write;' | ${tools_dir}/grib_filter -o $tempGrib - $input
${tools_dir}/grib_compare -b forecastTime $input $tempGrib
grib_check_key_equals $tempGrib step 12
grib_check_key_equals $tempGrib forecastTime 12
echo 'set endStep = 12; write;' | ${tools_dir}/grib_filter -o $tempGrib - $input
grib_check_key_equals $tempGrib step 12
grib_check_key_equals $tempGrib forecastTime 12
# Bad filter
# ----------------