Merge branch 'develop' into feature/localTime

This commit is contained in:
Shahram Najm 2021-03-10 15:29:21 +00:00
commit 9ec28c7271
3 changed files with 23 additions and 8 deletions

View File

@ -51,8 +51,8 @@ use Time::localtime;
$ARGV[0] or die "USAGE: $0 input.tsv\n";
my $WRITE_TO_FILES = 0;
my $WRITE_TO_PARAMDB = 1; # Be careful. Fill in $contactId before proceeding
my $WRITE_TO_FILES = 1;
my $WRITE_TO_PARAMDB = 0; # Be careful. Fill in $contactId before proceeding
my ($paramId, $shortName, $name, $units, $cfVarName);
my ($discipline, $pcategory, $pnumber, $type1, $type2, $scaledValue1, $scaleFactor1, $scaledValue2, $scaleFactor2);

View File

@ -3,7 +3,12 @@
TEST_DIR=`dirname $0`
if [ $# -ne 1 ]; then
echo "Usage: $0 title > $TEST_DIR/title.sh"
echo "Usage: $0 title > $TEST_DIR/title.sh" 1>&2
echo 1>&2
echo "Example:" 1>&2
echo " $0 ECC-6666 > tests/grib_ecc-6666.sh" 1>&2
echo " $0 ECC-9999 > tests/bufr_ecc-9999.sh" 1>&2
echo 1>&2
exit 1
fi
@ -31,7 +36,7 @@ cat <<EOF
. ./include.sh
set -u
REDIRECT=/dev/null
label="$TEST_TITLE"
label="prod_${TEST_TITLE}-test"
temp=temp.\$label
sample_grib1=\$ECCODES_SAMPLES_PATH/GRIB1.tmpl
sample_grib2=\$ECCODES_SAMPLES_PATH/GRIB2.tmpl

View File

@ -975,9 +975,14 @@ static int fix_for_lsdate_needed(grib_handle* h)
{
long lsdate_bug = 0;
int err = grib_get_long(h, "lsdate_bug", &lsdate_bug);
if (!err && lsdate_bug == 1) {
return 1;
}
if (!err && lsdate_bug == 1) return 1;
return 0;
}
static int fix_for_lstime_needed(grib_handle* h)
{
long lstime_bug = 0;
int err = grib_get_long(h, "lstime_bug", &lstime_bug);
if (!err && lstime_bug == 1) return 1;
return 0;
}
@ -1053,6 +1058,7 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
grib_accessor* acc = NULL;
size_t num_vals = 0;
int fix_lsdate = 0;
int fix_lstime = 0;
if (!options->verbose)
return;
@ -1076,7 +1082,8 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
return;
}
fix_lsdate = (fix_for_lsdate_needed(h) && options->name_space && strcmp(options->name_space, "ls") == 0);
fix_lsdate = (options->name_space && strcmp(options->name_space, "ls") == 0 && fix_for_lsdate_needed(h));
fix_lstime = (options->name_space && strcmp(options->name_space, "ls") == 0 && fix_for_lstime_needed(h));
for (i = 0; i < options->print_keys_count; i++) {
size_t len = MAX_STRING_LEN;
@ -1141,6 +1148,9 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
if (fix_lsdate && strcmp(pName, "date") == 0) { /* ECC-707 */
pName = "ls.date";
}
if (fix_lstime && strcmp(pName, "time") == 0) {
pName = "ls.time";
}
ret = grib_get_size(h, pName, &num_vals);
if (ret == GRIB_SUCCESS && num_vals > 1) { /* See ECC-278 */
ret = get_initial_element_of_array(h, pName, num_vals, value);