OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
wviiinv.c
Go to the documentation of this file.
1 /*******************************************************************************
2 NAME WAGNER VII
3 
4 PURPOSE: Transforms input Easting and Northing to longitude and
5  latitude for the Wagner VII projection. The
6  Easting and Northing must be in meters. The longitude
7  and latitude values will be returned in radians.
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 wviiinvint
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 inverse equations--mapping x,y to lat,long
54  -----------------------------------------------------*/
55 long wviiinv
56 (
57  double x, /* (I) X projection coordinate */
58  double y, /* (I) Y projection coordinate */
59  double *lon, /* (O) Longitude */
60  double *lat /* (O) Latitude */
61 )
62 {
63 double t1, t2, p, c;
64 
65 /* Inverse equations
66  -----------------*/
67 x -= false_easting;
68 y -= false_northing;
69 t1 = x / 2.66723;
70 t2 = y / 1.24104;
71 t1 *= t1;
72 t2 *= t2;
73 p = sqrt(t1 + t2);
74 c = 2.0 * asinz(p / (2.0 * R));
75 *lat = asinz(y * sin(c) / (1.24104 * 0.90631 * p));
76 *lon = adjust_lon(lon_center + 3.0 * atan2(x * tan(c), 2.66723 * p));
77 return(OK);
78 }
79 
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
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
long wviiinvint(double r, double center_long, double false_east, double false_north)
Definition: wviiinv.c:30
long wviiinv(double x, double y, double *lon, double *lat)
Definition: wviiinv.c:56
double lon_center
Definition: tm.c:51
float * lon
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
#define R
Definition: make_L3_v1.1.c:96
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in per delivery and then split off a new MYD_PR03 pcf file for Aqua Added AssociatedPlatformInstrumentSensor to the inventory metadata in MOD01 mcf and MOD03 mcf Created new versions named MYD01 mcf and MYD03 where AssociatedPlatformShortName is rather than Terra The program itself has been changed to read the Satellite Instrument validate it against the input L1A and LUT and to use it determine the correct files to retrieve the ephemeris and attitude data from Changed to produce a LocalGranuleID starting with MYD03 if run on Aqua data Added the Scan Type file attribute to the Geolocation copied from the L1A and attitude_angels to radians rather than degrees The accumulation of Cumulated gflags was moved from GEO_validate_earth_location c to GEO_locate_one_scan c
Definition: HISTORY.txt:464
double asinz(double con)
Definition: proj_cproj.c:67
float p[MODELMAX]
Definition: atrem_corl1.h:131