Sub hourly: Rename environment variable

This commit is contained in:
Shahram Najm 2024-01-23 13:49:13 +00:00
parent 80c9c5ea56
commit ad54ad7725
6 changed files with 13 additions and 13 deletions

View File

@ -540,7 +540,7 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en
long typeOfTimeIncrement;
double dend, dstep;
const int show_units_for_hours = a->context->show_hour_stepunit;
const int show_units_for_hours = a->context->grib_hourly_steps_with_units;
eccodes::Step end_step{end_step_value, end_step_unit};
@ -655,7 +655,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
size_t step_len = 0;
long step_value;
long step_units;
const int show_units_for_hours = a->context->show_hour_stepunit;
const int show_units_for_hours = a->context->grib_hourly_steps_with_units;
if ((ret = unpack_long(a, &step_value, &step_len)) != GRIB_SUCCESS)
return ret;
@ -747,7 +747,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
static int get_native_type(grib_accessor* a)
{
grib_handle* h = grib_handle_of_accessor(a);
const int show_units_for_hours = a->context->show_hour_stepunit;
const int show_units_for_hours = a->context->grib_hourly_steps_with_units;
if (!show_units_for_hours) {
long step_units = 0;

View File

@ -143,7 +143,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
double end_step_value = 0;
long step_units;
int show_hours = a->context->show_hour_stepunit;
int show_hours = a->context->grib_hourly_steps_with_units;
if ((ret = grib_get_double_internal(h, self->start_step, &start_step_value)) != GRIB_SUCCESS)
return ret;

View File

@ -313,7 +313,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
long step_units = 0;
char fp_format[128] = "%g";
size_t fp_format_len = sizeof(fp_format);
int show_hours = a->context->show_hour_stepunit;
int show_hours = a->context->grib_hourly_steps_with_units;
if ((ret = grib_get_long_internal(h, "startStep", &start_step_value)) != GRIB_SUCCESS)
return ret;
@ -350,7 +350,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
static int get_native_type(grib_accessor* a)
{
grib_handle* h = grib_handle_of_accessor(a);
const int show_units_for_hours = a->context->show_hour_stepunit;
const int show_units_for_hours = a->context->grib_hourly_steps_with_units;
if (!show_units_for_hours) {
long step_units = 0;

View File

@ -1004,7 +1004,7 @@ struct grib_context
int no_big_group_split;
int no_spd;
int keep_matrix;
int show_hour_stepunit;
int grib_hourly_steps_with_units;
char* grib_definition_files_path;
char* grib_samples_path;
char* grib_concept_path;

View File

@ -417,7 +417,7 @@ grib_context* grib_context_get_default()
no_big_group_split = codes_getenv("ECCODES_GRIB_NO_BIG_GROUP_SPLIT");
no_spd = codes_getenv("ECCODES_GRIB_NO_SPD");
keep_matrix = codes_getenv("ECCODES_GRIB_KEEP_MATRIX");
show_hour_stepunit = codes_getenv("ECCODES_GRIB_SHOW_HOUR_STEPUNIT");
show_hour_stepunit = codes_getenv("ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS");
file_pool_max_opened_files = getenv("ECCODES_FILE_POOL_MAX_OPENED_FILES");
/* On UNIX, when we read from a file we get exactly what is in the file on disk.
@ -432,7 +432,7 @@ grib_context* grib_context_get_default()
default_grib_context.no_big_group_split = no_big_group_split ? atoi(no_big_group_split) : 0;
default_grib_context.no_spd = no_spd ? atoi(no_spd) : 0;
default_grib_context.keep_matrix = keep_matrix ? atoi(keep_matrix) : 1;
default_grib_context.show_hour_stepunit = show_hour_stepunit ? atoi(show_hour_stepunit) : 0;
default_grib_context.grib_hourly_steps_with_units = show_hour_stepunit ? atoi(show_hour_stepunit) : 0;
default_grib_context.write_on_fail = write_on_fail ? atoi(write_on_fail) : 0;
default_grib_context.no_abort = no_abort ? atoi(no_abort) : 0;
default_grib_context.debug = debug ? atoi(debug) : 0;

View File

@ -44,8 +44,8 @@ grib_check_key_equals()
}
HOUR=""
if (set -u; : ${ECCODES_GRIB_SHOW_HOUR_STEPUNIT?}) 2> /dev/null; then
if [ $ECCODES_GRIB_SHOW_HOUR_STEPUNIT -gt 0 ]; then
if (set -u; : ${ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS?}) 2> /dev/null; then
if [ $ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS -gt 0 ]; then
export HOUR="h"
fi
fi
@ -491,13 +491,13 @@ grib_check_key_equals $temp '-p indicatorOfUnitOfTimeRange' '0'
grib_check_key_equals $temp '-p forecastTime' '16'
export ECCODES_GRIB_SHOW_HOUR_STEPUNIT=1
export ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS=1
cat >$tempFilt<<EOF
assert ( step is "6h" );
EOF
cat $tempFilt
${tools_dir}/grib_filter $tempFilt $data_dir/constant_field.grib2
unset ECCODES_GRIB_SHOW_HOUR_STEPUNIT
unset ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS
# Bad stepUnits
set +e