Skip to content

Commit

Permalink
Sub hourly: Dynamic native type for step, startStep and endStep for b…
Browse files Browse the repository at this point in the history
…ackward compatibility
  • Loading branch information
shahramn committed Jan 18, 2024
1 parent 12c31bb commit 305f636
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/grib_accessor_class_g2end_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 3 additions & 3 deletions src/grib_accessor_class_step_in_units.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 305f636

Please sign in to comment.