Geoiterator: Fail if oblate spheroid

This commit is contained in:
Shahram Najm 2020-01-15 16:07:14 +00:00
parent 5907ffde84
commit e6e9501d25
1 changed files with 6 additions and 0 deletions

View File

@ -116,6 +116,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
int i, j, err=0; int i, j, err=0;
double *lats, *lons; /* the lat/lon arrays to be populated */ double *lats, *lons; /* the lat/lon arrays to be populated */
long nx,ny,iScansNegatively,jScansPositively,jPointsAreConsecutive,alternativeRowScanning; long nx,ny,iScansNegatively,jScansPositively,jPointsAreConsecutive,alternativeRowScanning;
long oblate=0;
double LoVInDegrees,LaDInDegrees,Latin1InDegrees,Latin2InDegrees,latFirstInDegrees, double LoVInDegrees,LaDInDegrees,Latin1InDegrees,Latin2InDegrees,latFirstInDegrees,
lonFirstInDegrees, Dx, Dy, radius=0; lonFirstInDegrees, Dx, Dy, radius=0;
double latFirstInRadians, lonFirstInRadians, LoVInRadians, Latin1InRadians, Latin2InRadians, double latFirstInRadians, lonFirstInRadians, LoVInRadians, Latin1InRadians, Latin2InRadians,
@ -146,6 +147,11 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
if((err = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS) if((err = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS)
return err; return err;
if(grib_get_long(h, "earthIsOblate", &oblate) == GRIB_SUCCESS && oblate == 1) {
grib_context_log(h->context,GRIB_LOG_ERROR,"Lambert Conformal only supported for spherical earth.");
return GRIB_GEOCALCULUS_PROBLEM;
}
if (iter->nv!=nx*ny) { if (iter->nv!=nx*ny) {
grib_context_log(h->context,GRIB_LOG_ERROR,"Wrong number of points (%ld!=%ldx%ld)",iter->nv,nx,ny); grib_context_log(h->context,GRIB_LOG_ERROR,"Wrong number of points (%ld!=%ldx%ld)",iter->nv,nx,ny);
return GRIB_WRONG_GRID; return GRIB_WRONG_GRID;