mirror of https://github.com/ecmwf/eccodes.git
Testing: Get native type of all keys
This commit is contained in:
parent
0f3e710d33
commit
eca34ff1a6
|
@ -1,3 +1 @@
|
||||||
label "_local 98.1";
|
label "_x";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,12 @@ int main(int argc, char* argv[])
|
||||||
while (grib_keys_iterator_next(kiter)) {
|
while (grib_keys_iterator_next(kiter)) {
|
||||||
const char* name = grib_keys_iterator_get_name(kiter);
|
const char* name = grib_keys_iterator_get_name(kiter);
|
||||||
Assert(name);
|
Assert(name);
|
||||||
printf("%s\n", name);
|
int type = 0;
|
||||||
|
GRIB_CHECK(grib_get_native_type(h, name, &type), 0);
|
||||||
|
Assert( type > 0 && type < 7 );
|
||||||
|
const char* type_name = grib_get_type_name(type);
|
||||||
|
Assert( !STR_EQUAL(type_name, "unknown") );
|
||||||
|
printf("%s = %s (%d)\n", name, type_name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_keys_iterator_delete(kiter);
|
grib_keys_iterator_delete(kiter);
|
||||||
|
|
|
@ -19,6 +19,11 @@ cd ${data_dir}
|
||||||
f='tigge/tiggelam_cnmc_sfc.grib'
|
f='tigge/tiggelam_cnmc_sfc.grib'
|
||||||
$EXEC ${test_dir}/grib_keys_iter $f > /dev/null
|
$EXEC ${test_dir}/grib_keys_iter $f > /dev/null
|
||||||
|
|
||||||
|
# Samples
|
||||||
|
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/GRIB1.tmpl > /dev/null
|
||||||
|
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/GRIB2.tmpl > /dev/null
|
||||||
|
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl > /dev/null
|
||||||
|
|
||||||
grib_files=`cat ${data_dir}/grib_data_files.txt`
|
grib_files=`cat ${data_dir}/grib_data_files.txt`
|
||||||
for f in ${grib_files}; do
|
for f in ${grib_files}; do
|
||||||
${test_dir}/grib_keys_iter $f > $tempOut
|
${test_dir}/grib_keys_iter $f > $tempOut
|
||||||
|
|
Loading…
Reference in New Issue