From 0f3e710d33ab81153a324783f5e093706a883062 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 17 Jan 2024 13:50:39 +0000 Subject: [PATCH] Sub hourly: Native type of step and endStep for backward compatibility (Experimental idea) --- src/grib_accessor_class_g2end_step.cc | 10 ++++++++++ src/grib_accessor_class_step_in_units.cc | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/grib_accessor_class_g2end_step.cc b/src/grib_accessor_class_g2end_step.cc index e967268ef..a1e89d57c 100644 --- a/src/grib_accessor_class_g2end_step.cc +++ b/src/grib_accessor_class_g2end_step.cc @@ -744,5 +744,15 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) static int get_native_type(grib_accessor* a) { +#if 0 + grib_handle* h = grib_handle_of_accessor(a); + + long step_units = 0; + if (grib_get_long_internal(h, "stepUnits", &step_units) == GRIB_SUCCESS) { + if (step_units == 1) { + return GRIB_TYPE_LONG; + } + } +#endif return GRIB_TYPE_STRING; } diff --git a/src/grib_accessor_class_step_in_units.cc b/src/grib_accessor_class_step_in_units.cc index 01c2e515b..9d22d1864 100644 --- a/src/grib_accessor_class_step_in_units.cc +++ b/src/grib_accessor_class_step_in_units.cc @@ -349,5 +349,16 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) static int get_native_type(grib_accessor* a) { +#if 0 + grib_handle* h = grib_handle_of_accessor(a); + + long step_units = 0; + if (grib_get_long_internal(h, "stepUnits", &step_units) == GRIB_SUCCESS) { + if (step_units == 1) { + return GRIB_TYPE_LONG; + } + } +#endif + return GRIB_TYPE_STRING; }