mirror of https://github.com/ecmwf/eccodes.git
Fix broken MSVC build (M_1_PI:undeclared identifier)
This commit is contained in:
parent
f2ceeff029
commit
45eedc9f21
|
@ -83,8 +83,8 @@ static void init_class(grib_iterator_class* c)
|
|||
}
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
static const double degree_to_radian = M_PI/180.0;
|
||||
static const double radian_to_degree = 180.0 * M_1_PI;
|
||||
#define RAD2DEG 57.29577951308232087684 /* 180 over pi */
|
||||
#define DEG2RAD 0.01745329251994329576 /* pi over 180 */
|
||||
|
||||
void unrotate(grib_handle* h,
|
||||
const double inlat, const double inlon,
|
||||
|
@ -95,8 +95,8 @@ void unrotate(grib_handle* h,
|
|||
const double lon_x = inlon;
|
||||
const double lat_y = inlat;
|
||||
/* First convert the data point from spherical lat lon to (x',y',z') */
|
||||
double latr = lat_y * degree_to_radian;
|
||||
double lonr = lon_x * degree_to_radian;
|
||||
double latr = lat_y * DEG2RAD;
|
||||
double lonr = lon_x * DEG2RAD;
|
||||
double xd = cos(lonr)*cos(latr);
|
||||
double yd = sin(lonr)*cos(latr);
|
||||
double zd = sin(latr);
|
||||
|
@ -104,10 +104,10 @@ void unrotate(grib_handle* h,
|
|||
double t = -(90.0 + southPoleLat);
|
||||
double o = -southPoleLon;
|
||||
|
||||
double sin_t = sin(degree_to_radian * t);
|
||||
double cos_t = cos(degree_to_radian * t);
|
||||
double sin_o = sin(degree_to_radian * o);
|
||||
double cos_o = cos(degree_to_radian * o);
|
||||
double sin_t = sin(DEG2RAD * t);
|
||||
double cos_t = cos(DEG2RAD * t);
|
||||
double sin_o = sin(DEG2RAD * o);
|
||||
double cos_o = cos(DEG2RAD * o);
|
||||
|
||||
double x = cos_t*cos_o*xd + sin_o*yd + sin_t*cos_o*zd;
|
||||
double y = -cos_t*sin_o*xd + cos_o*yd - sin_t*sin_o*zd;
|
||||
|
@ -121,8 +121,8 @@ void unrotate(grib_handle* h,
|
|||
if (z > 1.0) z = 1.0;
|
||||
if (z < -1.0) z = -1.0;
|
||||
|
||||
ret_lat = asin(z) * radian_to_degree;
|
||||
ret_lon = atan2(y, x) * radian_to_degree;
|
||||
ret_lat = asin(z) * RAD2DEG;
|
||||
ret_lon = atan2(y, x) * RAD2DEG;
|
||||
|
||||
/* Still get a very small rounding error, round to 6 decimal places */
|
||||
ret_lat = roundf( ret_lat * 1000000.0 )/1000000.0;
|
||||
|
|
Loading…
Reference in New Issue