OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
wviifor.c
Go to the documentation of this file.
1 /*******************************************************************************
2 NAME WAGNER VII
3 
4 PURPOSE: Transforms input longitude and latitude to Easting and
5  Northing for the Wagner VII projection. The
6  longitude and latitude must be in radians. The Easting
7  and Northing values will be returned in meters.
8 
9 ALGORITHM REFERENCES
10 
11 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
12  U.S. Geological Survey Professional Paper 1453 , United State Government
13  Printing Office, Washington D.C., 1989.
14 
15 2. Snyder, John P., Personal correspondence, January 1991.
16 *******************************************************************************/
17 #include "oli_cproj.h"
18 #include "oli_local.h"
19 
20 /* Variables common to all subroutines in this code file
21  -----------------------------------------------------*/
22 static double lon_center; /* Center longitude (projection center) */
23 static double R; /* Radius of the earth (sphere) */
24 static double false_easting; /* x offset */
25 static double false_northing; /* y offset */
26 
27 /* Initialize the Wagner VII projection
28  ------------------------------------*/
29 long wviiforint
30 (
31  double r, /* (I) Radius of the earth (sphere) */
32  double center_long, /* (I) Center longitude */
33  double false_east, /* x offset */
34  double false_north /* y offset */
35 )
36 {
37 /* Place parameters in static storage for common use
38  -------------------------------------------------*/
39 R = r;
40 lon_center = center_long;
41 false_easting = false_east;
42 false_northing = false_north;
43 
44 /* Report parameters to the user
45  -----------------------------*/
46 gctp_print_title("WAGNER VII");
48 gctp_print_cenlon(center_long);
50 return(OK);
51 }
52 
53 /* Wagner VII forward equations--mapping lat,long to x,y
54  -----------------------------------------------------*/
55 long wviifor
56 (
57  double lon, /* (I) Longitude */
58  double lat, /* (I) Latitude */
59  double *x, /* (O) X projection coordinate */
60  double *y /* (O) Y projection coordinate */
61 )
62 {
63 double delta_lon; /* Delta longitude (Given longitude - center */
64 double sin_lon, cos_lon;
65 double s, c0, c1;
66 
67 /* Forward equations
68  -----------------*/
69 delta_lon = adjust_lon(lon - lon_center);
70 sincos((delta_lon/3.0), &sin_lon, &cos_lon);
71 s = 0.90631 * sin(lat);
72 c0 = sqrt(1-s*s);
73 c1 = sqrt(2.0 / (1.0 + c0 * cos_lon));
74 *x = 2.66723 * R * c0 * c1 * sin_lon + false_easting;
75 *y = 1.24104 * R * s * c1 + false_northing;
76 return(OK);
77 }
int r
Definition: decode_rs.h:73
void gctp_print_title(const char *proj_name)
Definition: gctp_report.c:14
void gctp_print_cenlon(double A)
Definition: gctp_report.c:40
float * lat
double adjust_lon(double x)
Definition: proj_cproj.c:349
double false_easting
Definition: tm.c:54
long wviifor(double lon, double lat, double *x, double *y)
Definition: wviifor.c:56
void gctp_print_offsetp(double A, double B)
Definition: gctp_report.c:91
double false_northing
Definition: tm.c:53
#define OK
Definition: ancil.h:30
#define sincos
Definition: proj_define.h:108
double lon_center
Definition: tm.c:51
float * lon
data_t s[NROOTS]
Definition: decode_rs.h:75
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
#define R
Definition: make_L3_v1.1.c:96
long wviiforint(double r, double center_long, double false_east, double false_north)
Definition: wviifor.c:30