Refactoring and DebugAssert

This commit is contained in:
Shahram Najm 2020-06-23 20:49:04 +01:00
parent a38d54ccd2
commit df3e8430ed
2 changed files with 9 additions and 5 deletions

View File

@ -360,9 +360,11 @@ static int init_oblate(grib_handle* h,
latRad = -M_PI_2;
}
lonRad = adjust_lon_radians(theta / ns + LoVInRadians);
if (i == 0 && j == 0) {
DebugAssert(fabs(latFirstInRadians - latRad) <= EPSILON);
}
latDeg = latRad * RAD2DEG; /* Convert to degrees */
lonDeg = lonRad * RAD2DEG;
lonDeg = normalise_longitude_in_degrees(lonDeg);
lonDeg = normalise_longitude_in_degrees(lonRad * RAD2DEG);
self->lons[index] = lonDeg;
self->lats[index] = latDeg;
}

View File

@ -215,10 +215,12 @@ static int init_mercator(grib_handle* h,
grib_context_free(h->context, self->lons);
return err;
}
lonRad = adjust_lon_radians(orientationInRadians + _x / (earthMajorAxisInMetres * m1));
lonRad = adjust_lon_radians(orientationInRadians + _x / (earthMajorAxisInMetres * m1));
if (i == 0 && j == 0) {
DebugAssert(fabs(latFirstInRadians - latRad) <= EPSILON);
}
latDeg = latRad * RAD2DEG; /* Convert to degrees */
lonDeg = lonRad * RAD2DEG;
lonDeg = normalise_longitude_in_degrees(lonDeg);
lonDeg = normalise_longitude_in_degrees(lonRad * RAD2DEG);
self->lons[index] = lonDeg;
self->lats[index] = latDeg;
}