From fa624e1b8097378f9ce343192648fdaa5e3f5e08 Mon Sep 17 00:00:00 2001 From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de> Date: Mon, 4 Apr 2016 09:09:04 +0000 Subject: [PATCH] gribapiGetGrid: get increment only if number of values > 1 --- src/gribapi_utilities.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gribapi_utilities.c b/src/gribapi_utilities.c index 90a2a9887..a67d43461 100644 --- a/src/gribapi_utilities.c +++ b/src/gribapi_utilities.c @@ -499,8 +499,9 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid) FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfLastGridPointInDegrees", &grid->xlast); FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfFirstGridPointInDegrees", &grid->yfirst); FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfLastGridPointInDegrees", &grid->ylast); - FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->xinc); - if ( gridtype == GRID_LONLAT ) + if ( nlon > 1 ) + FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->xinc); + if ( gridtype == GRID_LONLAT && nlat > 1 ) FAIL_ON_GRIB_ERROR(grib_get_double, gh, "jDirectionIncrementInDegrees", &grid->yinc); if ( grid->xinc < -999 || grid->xinc > 999 ) grid->xinc = 0; @@ -575,9 +576,9 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid) FAIL_ON_GRIB_ERROR(grib_get_double, gh, "longitudeOfLastGridPointInDegrees", &grid->xlast); FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfFirstGridPointInDegrees", &grid->yfirst); FAIL_ON_GRIB_ERROR(grib_get_double, gh, "latitudeOfLastGridPointInDegrees", &grid->ylast); - FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->xinc); - if ( IS_EQUAL(grid->xinc, GRIB_MISSING_DOUBLE) ) grid->xinc = 0; + // FAIL_ON_GRIB_ERROR(grib_get_double, gh, "iDirectionIncrementInDegrees", &grid->xinc); + // if ( IS_EQUAL(grid->xinc, GRIB_MISSING_DOUBLE) ) grid->xinc = 0; /* if ( IS_NOT_EQUAL(grid->xfirst, 0) || IS_NOT_EQUAL(grid->xlast, 0) ) */ { -- GitLab