mirror of https://github.com/ecmwf/eccodes.git
ECC-1375: Cater for Ni missing (reduced grids)
This commit is contained in:
parent
2fe3463f94
commit
02159affd0
|
@ -165,11 +165,20 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
if (*val == 0)
|
if (*val == 0)
|
||||||
return 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)
|
if ((err = grib_get_long_internal(h, self->Ni, &Ni)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
if ((err = grib_get_long_internal(h, self->Nj, &Nj)) != GRIB_SUCCESS)
|
if ((err = grib_get_long_internal(h, self->Nj, &Nj)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if ((err = grib_get_long_internal(h, self->alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
|
if ((err = grib_get_long_internal(h, self->alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,12 @@ Latitude Longitude Value
|
||||||
EOF
|
EOF
|
||||||
diff $tempRef $tempText
|
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
|
# Clean up
|
||||||
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText
|
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText
|
||||||
|
|
Loading…
Reference in New Issue