OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
sinfor.c
Go to the documentation of this file.
1 /*******************************************************************************
2 NAME SINUSOIDAL
3 
4 PURPOSE: Transforms input longitude and latitude to Easting and
5  Northing for the Sinusoidal projection. The
6  longitude and latitude must be in radians. The Easting
7  and Northing values will be returned in meters.
8 
9 This function was adapted from the Sinusoidal projection code (FORTRAN) in the
10 General Cartographic Transformation Package software which is available from
11 the U.S. Geological Survey National Mapping Division.
12 
13 ALGORITHM REFERENCES
14 
15 1. 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 2. "Software Documentation for GCTP General Cartographic Transformation
20  Package", U.S. Geological Survey National Mapping Division, May 1982.
21 *******************************************************************************/
22 #include "oli_cproj.h"
23 #include "oli_local.h"
24 
25 /* Variables common to all subroutines in this code file
26  -----------------------------------------------------*/
27 static double lon_center; /* Center longitude (projection center) */
28 static double R; /* Radius of the earth (sphere) */
29 static double false_easting; /* x offset in meters */
30 static double false_northing; /* y offset in meters */
31 
32 /* Initialize the Sinusoidal projection
33  ------------------------------------*/
34 long sinforint
35 (
36  double r, /* (I) Radius of the earth (sphere) */
37  double center_long, /* (I) Center longitude */
38  double false_east, /* x offset in meters */
39  double false_north /* y offset in meters */
40 )
41 {
42 /* Place parameters in static storage for common use
43  -------------------------------------------------*/
44 R = r;
45 lon_center = center_long;
46 false_easting = false_east;
47 false_northing = false_north;
48 
49 /* Report parameters to the user
50  -----------------------------*/
51 gctp_print_title("SINUSOIDAL");
53 gctp_print_cenlon(center_long);
55 return(OK);
56 }
57 
58 /* Sinusoidal forward equations--mapping lat,long to x,y
59  -----------------------------------------------------*/
60 long sinfor
61 (
62  double lon, /* (I) Longitude */
63  double lat, /* (I) Latitude */
64  double *x, /* (O) X projection coordinate */
65  double *y /* (O) Y projection coordinate */
66 )
67 {
68 double delta_lon; /* Delta longitude (Given longitude - center */
69 
70 /* Forward equations
71  -----------------*/
72 delta_lon = adjust_lon(lon - lon_center);
73 *x = R * delta_lon * cos(lat) + false_easting;
74 *y = R * lat + false_northing;
75 return(OK);
76 }
int r
Definition: decode_rs.h:73
void gctp_print_title(const char *proj_name)
Definition: gctp_report.c:14
double false_northing
Definition: polyconic.c:53
long sinfor(double lon, double lat, double *x, double *y)
Definition: sinfor.c:61
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: polyconic.c:54
void gctp_print_offsetp(double A, double B)
Definition: gctp_report.c:91
#define OK
Definition: ancil.h:30
long sinforint(double r, double center_long, double false_east, double false_north)
Definition: sinfor.c:35
float * lon
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
#define R
Definition: make_L3_v1.1.c:96