Angular precision

This commit is contained in:
Shahram Najm 2020-02-23 18:21:40 +00:00
parent 0b0c240027
commit e4fd126f5d
1 changed files with 12 additions and 11 deletions

View File

@ -601,18 +601,19 @@ static int check_handle_against_spec(grib_handle* handle, const long edition,
int err = 0;
int check_latitudes = 1;
int check_longitudes = 1;
double angular_precision = 1.0/1000.0; /* millidegree */
double tolerance = angular_precision/2.0; /* half a millidegree */
if (edition == 2) {
angular_precision = 1.0/1000000.0; /* microdegree */
tolerance = angular_precision/2.0;
}
long angleSubdivisions = 0;
double angular_precision = 1.0/1000.0; /* millidegree by default */
double tolerance = 0;
if (edition == 2) {
return GRIB_SUCCESS; /* For now only do checks on edition 1 */
}
if ((err = grib_get_long(handle, "angleSubdivisions", &angleSubdivisions))==GRIB_SUCCESS) {
angular_precision = 1.0/angleSubdivisions;
}
tolerance = angular_precision/2.0;
if (spec->grid_type == GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC ||
spec->grid_type == GRIB_UTIL_GRID_SPEC_SH)
{