Testing: experimental feature grib_fieldset_apply_where

This commit is contained in:
Shahram Najm 2021-08-20 16:10:55 +01:00
parent 32b23dc9fd
commit 686bd82b46
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,8 @@
#include "eccodes.h" #include "eccodes.h"
int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string); /*experimental*/
static void usage(const char* prog) static void usage(const char* prog)
{ {
printf("Usage: %s [-n] grib_file grib_file ...\n", prog); printf("Usage: %s [-n] grib_file grib_file ...\n", prog);
@ -72,6 +74,10 @@ int main(int argc, char** argv)
set = codes_fieldset_new_from_files(0, filenames, nfiles, 0, 0, 0, order_by, &err); set = codes_fieldset_new_from_files(0, filenames, nfiles, 0, 0, 0, order_by, &err);
CODES_CHECK(err, 0); CODES_CHECK(err, 0);
/* grib_fieldset_apply_where not fully implemented*/
err=grib_fieldset_apply_where(set, "(centre=='ecmf') && number==1 || step==6");
CODES_CHECK(err, 0);
printf("ordering by %s\n", order_by); printf("ordering by %s\n", order_by);
printf("%d fields in the fieldset\n", codes_fieldset_count(set)); printf("%d fields in the fieldset\n", codes_fieldset_count(set));
printf("n,step,param\n"); printf("n,step,param\n");

View File

@ -19,6 +19,7 @@ input_grb=${data_dir}/reduced_gaussian_pressure_level.grib1
# -------------------------------------- # --------------------------------------
$EXEC ${test_dir}/grib_nearest_test $input_grb > $temp $EXEC ${test_dir}/grib_nearest_test $input_grb > $temp
cat > $tempRef <<EOF cat > $tempRef <<EOF
((((centre)==(ecmf))&&((number)==(1)))||((step)==(6)))
ordering by param,step ordering by param,step
1 fields in the fieldset 1 fields in the fieldset
n,step,param n,step,param
@ -36,6 +37,7 @@ diff $tempRef $temp
# ---------------------------------------- # ----------------------------------------
$EXEC ${test_dir}/grib_nearest_test -n $input_grb > $temp $EXEC ${test_dir}/grib_nearest_test -n $input_grb > $temp
cat > $tempRef <<EOF cat > $tempRef <<EOF
((((centre)==(ecmf))&&((number)==(1)))||((step)==(6)))
ordering by param,step ordering by param,step
1 fields in the fieldset 1 fields in the fieldset
n,step,param n,step,param