ECC-1375: Cater for Ni missing (reduced grids)

This commit is contained in:
Shahram Najm 2022-03-30 12:31:02 +01:00
parent 2fe3463f94
commit 02159affd0
2 changed files with 16 additions and 1 deletions

View File

@ -165,11 +165,20 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
if (*val == 0)
return 0;
/* Make sure Ni / Nj are not missing */
if (grib_is_missing(h, self->Ni, &err) && !err) {
grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Ni);
return GRIB_WRONG_GRID;
}
if (grib_is_missing(h, self->Nj, &err) && !err) {
grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Nj);
return GRIB_WRONG_GRID;
}
if ((err = grib_get_long_internal(h, self->Ni, &Ni)) != GRIB_SUCCESS)
return err;
if ((err = grib_get_long_internal(h, self->Nj, &Nj)) != GRIB_SUCCESS)
return err;
if ((err = grib_get_long_internal(h, self->alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
return err;

View File

@ -115,6 +115,12 @@ Latitude Longitude Value
EOF
diff $tempRef $tempText
# It must fail when Ni=missing (reduced grids)
set +e
${tools_dir}/grib_set -s swapScanningAlternativeRows=1 $ECCODES_SAMPLES_PATH/reduced_gg_pl_96_grib2.tmpl $tempGribB 2>/dev/null
status=$?
set -e
[ $status -ne 0 ]
# Clean up
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText