From 305f636ece014605c749b0576683bc93be963ccf Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 18 Jan 2024 17:13:42 +0000 Subject: [PATCH] Sub hourly: Dynamic native type for step, startStep and endStep for backward compatibility --- src/grib_accessor_class_g2end_step.cc | 7 ++++--- src/grib_accessor_class_step_in_units.cc | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/grib_accessor_class_g2end_step.cc b/src/grib_accessor_class_g2end_step.cc index a1e89d57c..d6e1caa49 100644 --- a/src/grib_accessor_class_g2end_step.cc +++ b/src/grib_accessor_class_g2end_step.cc @@ -744,15 +744,16 @@ 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); + // TODO: Still experimental. + // Change the type to depend on the stepUnits for backward compatibility + 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 9d22d1864..4b516e518 100644 --- a/src/grib_accessor_class_step_in_units.cc +++ b/src/grib_accessor_class_step_in_units.cc @@ -349,16 +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); + // TODO: Still experimental. + // Change the type to depend on the stepUnits for backward compatibility + 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; }