Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
imolwinv.c
Go to the documentation of this file.
1 /*******************************************************************************
2 NAME INTERRUPTED MOLLWEIDE
3 
4 PURPOSE: Transforms input Easting and Northing to longitude and
5  latitude for the Interrupted Mollweide 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., "Map Projections--A Working Manual", U.S. Geological
16  Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
17  State Government Printing Office, Washington D.C., 1987.
18 *******************************************************************************/
19 #include "oli_cproj.h"
20 #include "oli_local.h"
21 
22 /* Variables common to all subroutines in this code file
23  -----------------------------------------------------*/
24 static double R; /* Radius of the earth (sphere) */
25 static double lon_center[6]; /* Central meridians, one for each region */
26 static double feast[6]; /* False easting, one for each region */
27 
28 /* Initialize the Interrupted Mollweide projection
29  --------------------------------------------*/
30 long imolwinvint
31 (
32  double r /* (I) Radius of the earth (sphere) */
33 )
34 {
35 /* Place parameters in static storage for common use
36  -------------------------------------------------*/
37 R = r;
38 
39 /* Initialize central meridians for each of the 6 regions
40  ------------------------------------------------------*/
41 lon_center[0] = 1.0471975512; /* 60.0 degrees */
42 lon_center[1] = -2.96705972839; /* -170.0 degrees */
43 lon_center[2] = -0.523598776; /* -30.0 degrees */
44 lon_center[3] = 1.57079632679; /* 90.0 degrees */
45 lon_center[4] = -2.44346095279; /* -140.0 degrees */
46 lon_center[5] = -0.34906585; /* -20.0 degrees */
47 
48 /* Initialize false eastings for each of the 6 regions
49  ---------------------------------------------------*/
50 feast[0] = R * -2.19988776387;
51 feast[1] = R * -0.15713484;
52 feast[2] = R * 2.04275292359;
53 feast[3] = R * -1.72848324304;
54 feast[4] = R * 0.31426968;
55 feast[5] = R * 2.19988776387;
56 
57 /* Report parameters to the user
58  -----------------------------*/
59 gctp_print_title("INTERRUPTED MOLLWEIDE EQUAL-AREA");
61 return(OK);
62 }
63 
64 long imolwinv
65 (
66  double x, /* (I) X projection coordinate */
67  double y, /* (I) Y projection coordinate */
68  double *lon, /* (O) Longitude */
69  double *lat /* (O) Latitude */
70 )
71 {
72 double theta;
73 long region;
74 
75 /* Inverse equations
76  -----------------*/
77 if (y >= 0.0)
78  {
79  if (x <= R * -1.41421356248) region = 0;
80  else if (x <= R * 0.942809042) region = 1;
81  else region = 2;
82  }
83 else
84  {
85  if (x <= R * -0.942809042) region = 3;
86  else if (x <= R * 1.41421356248) region = 4;
87  else region = 5;
88  }
89 x = x - feast[region];
90 
91 theta = asin(y / (1.4142135623731 * R));
92 *lon = adjust_lon(lon_center[region] + (x / (0.900316316158*R * cos(theta))));
93 *lat = asin((2.0 * theta + sin(2.0 * theta)) / PI);
94 
95 /* Are we in a interrupted area? If so, return status code of IN_BREAK.
96  ---------------------------------------------------------------------*/
97 if (region == 0 && (*lon < 0.34906585 || *lon > 1.91986217719))return(IN_BREAK);
98 if (region == 1 && ((*lon < 1.91986217719 && *lon > 0.34906585) ||
99  (*lon > -1.74532925199 && *lon < 0.34906585))) return(IN_BREAK);
100 if (region == 2 && (*lon < -1.745329252 || *lon > 0.34906585)) return(IN_BREAK);
101 if (region == 3 && (*lon < 0.34906585 || *lon > 2.44346095279))return(IN_BREAK);
102 if (region == 4 && ((*lon < 2.44346095279 && *lon > 0.34906585) ||
103  (*lon > -1.2217304764 && *lon < 0.34906585))) return(IN_BREAK);
104 if (region == 5 && (*lon < -1.2217304764 || *lon> 0.34906585))return(IN_BREAK);
105 return(OK);
106 }
107 
int r
Definition: decode_rs.h:73
void gctp_print_title(const char *proj_name)
Definition: gctp_report.c:14
double adjust_lon(double x)
Definition: proj_cproj.c:349
#define PI
Definition: l3_get_org.c:6
long imolwinv(double x, double y, double *lon, double *lat)
Definition: imolwinv.c:65
#define IN_BREAK
Definition: proj_define.h:69
#define OK
Definition: ancil.h:30
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
#define R
Definition: make_L3_v1.1.c:96
long imolwinvint(double r)
Definition: imolwinv.c:31