OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
oli_local.h
Go to the documentation of this file.
1 #ifndef LOCAL_H
2 #define LOCAL_H
3 
4 #include "gctp.h"
5 
6 /* FIXME - temporary defines to rename routines until they are all updated */
7 #define gctp_get_spheroid sphdz
8 
9 /* Define the maximum projection code number */
10 #define GCTP_MAX_PROJ_CODE 31
11 
12 /* Forward reference to the TRANSFORMATION so it can be used to define the
13  print info routine type. */
14 typedef struct transformation TRANSFORMATION;
15 
16 /* Define the type for a function pointer to a routine that prints information
17  about a projection. */
18 typedef void (*PRINT_PROJ_INFO)(const TRANSFORMATION *);
19 
20 /* Define the type for a function pointer to a routine that cleans up the
21  transformation. */
22 typedef void (*DESTROY_TRANSFORM)(TRANSFORMATION *);
23 
24 /* Function typedef for a transform function. The same definition works for
25  both forward and inverse transforms. For a forward transform, the inputs
26  are lon/lat and the outputs are x/y. For an inverse transform, the inputs
27  are x/y and the outputs are lat/lon. */
28 typedef int (*TRANSFORM_FUNC)(const TRANSFORMATION *trans,
29  double in_x, double in_y, double *out_x, double *out_y);
30 
31 /* Define a structure for tracking the information for a transformation. The
32  same structure works for both forward and inverse transformations. */
34 {
35  GCTP_PROJECTION proj; /* projection information */
36  TRANSFORM_FUNC transform; /* function pointer for the transform function */
37  DESTROY_TRANSFORM destroy; /* Function pointer to clean up the
38  transformation. Note that most projections
39  can leave this at the default NULL. */
40  PRINT_PROJ_INFO print_info; /* function to print projection information */
41  double unit_conversion_factor; /* unit conversion factor to convert the
42  coordinates to/from the internally used
43  degrees or meters */
44 
45  /* Pointer to a cache of data that is initialized by the projection's
46  init function. It is a void pointer to allow each projection to define
47  its own set of data that it needs to track. */
48  void *cache;
49 
50 };
51 
52 /* Define a structure to hold information about a projection transformation.
53  There is a forward reference to this structure in gctp.h that defines the
54  GCTP_TRANSFORMATION type. */
56 {
57  TRANSFORMATION forward; /* Forward transformation information */
58  TRANSFORMATION inverse; /* Inverse transformation information */
59  int use_gctp; /* Flag to use the original gctp routine
60  since one or both of the projections has not
61  been converted to the new interface yet */
62 };
63 
64 #define PRINT_FORMAT_ATTRIBUTE __attribute__ ((format(printf,4,5)))
66 (
67  GCTP_MESSAGE_TYPE_ENUM message_type, /* I: message type */
68  const char *filename, /* I: source code file name for input */
69  int line_number, /* I: source code line number for input */
70  const char *format, ... /* I: format string for message */
72 
73 /* Define a macro for printing info messages to allow it to be changed
74  easily. */
75 #define GCTP_PRINT_INFO(format,...) \
76  gctp_print_message(GCTP_INFO_MESSAGE,__FILE__, __LINE__, format, \
77  ##__VA_ARGS__)
78 
79 /* Define a macro for printing error messages to allow it to be changed
80  easily. */
81 #define GCTP_PRINT_ERROR(format,...) \
82  gctp_print_message(GCTP_ERROR_MESSAGE,__FILE__, __LINE__, format, \
83  ##__VA_ARGS__)
84 
85 /*********** Internal routines for initializing projections ***************/
86 int gctp_geo_init(TRANSFORMATION *trans);
87 
88 int gctp_lamcc_inverse_init(TRANSFORMATION *trans);
89 
90 int gctp_lamcc_forward_init(TRANSFORMATION *trans);
91 
92 int gctp_om_inverse_init(TRANSFORMATION *trans);
93 
94 int gctp_om_forward_init(TRANSFORMATION *trans);
95 
96 int gctp_poly_inverse_init(TRANSFORMATION *trans);
97 
98 int gctp_poly_forward_init(TRANSFORMATION *trans);
99 
100 int gctp_ps_inverse_init(TRANSFORMATION *trans);
101 
102 int gctp_ps_forward_init(TRANSFORMATION *trans);
103 
104 int gctp_state_plane_inverse_init(TRANSFORMATION *trans);
105 
106 int gctp_state_plane_forward_init(TRANSFORMATION *trans);
107 
108 int gctp_som_inverse_init(TRANSFORMATION *trans);
109 
110 int gctp_som_forward_init(TRANSFORMATION *trans);
111 
112 int gctp_tm_inverse_init(TRANSFORMATION *trans);
113 
114 int gctp_tm_forward_init(TRANSFORMATION *trans);
115 
116 int gctp_utm_inverse_init(TRANSFORMATION *trans);
117 
118 int gctp_utm_forward_init(TRANSFORMATION *trans);
119 
120 
121 /************ Internal routines for printing out projection info *********/
122 void gctp_print_title
123 (
124  const char *proj_name
125 );
127 (
128  double radius
129 );
131 (
132  double radius1,
133  double radius2
134 );
136 (
137  double A
138 );
140 (
141  double A
142 );
144 (
145  double A
146 );
148 (
149  double A
150 );
152 (
153  double A,
154  double B
155 );
157 (
158  double A
159 );
161 (
162  double A,
163  double B
164 );
166 (
167  double A
168 );
170 (
171  double A
172 );
174 (
175  double A,
176  const char *S
177 );
179 (
180  long A,
181  const char *S
182 );
183 
184 int gctp_get_sign
185 (
186  double x
187 );
188 
189 double gctp_calc_e0
190 (
191  double x
192 );
193 
194 double gctp_calc_e1
195 (
196  double x
197 );
198 
199 double gctp_calc_e2
200 (
201  double x
202 );
203 
204 double gctp_calc_e3
205 (
206  double x
207 );
208 
209 double gctp_calc_e4
210 (
211  double x
212 );
213 
215 (
216  double e0,
217  double e1,
218  double e2,
219  double e3,
220  double phi
221 );
222 
223 int gctp_calc_phi2
224 (
225  double eccent, /* I: Spheroid eccentricity */
226  double ts, /* I: Constant value t */
227  double *phi2 /* O: calculated value of phi2 */
228 );
229 
231 (
232  double ang, /* I: angle in DMS */
233  double *degrees /* O: angle in degrees */
234 );
235 
237 (
238  double eccent,
239  double sinphi,
240  double cosphi
241 );
242 
243 double gctp_calc_small_t
244 (
245  double eccent, /* Eccentricity of the spheroid */
246  double phi, /* Latitude phi */
247  double sinphi /* Sine of the latitude */
248 );
249 
250 #endif
void(* DESTROY_TRANSFORM)(TRANSFORMATION *)
Definition: oli_local.h:22
void gctp_print_stparl1(double A)
Definition: gctp_report.c:83
void gctp_print_genrpt_long(long A, const char *S)
Definition: gctp_report.c:126
void gctp_print_genrpt(double A, const char *S)
Definition: gctp_report.c:117
double gctp_calc_dist_from_equator(double e0, double e1, double e2, double e3, double phi)
Definition: gctp_utility.c:187
int gctp_lamcc_forward_init(TRANSFORMATION *trans)
double unit_conversion_factor
Definition: oli_local.h:41
PRINT_PROJ_INFO print_info
Definition: oli_local.h:40
void gctp_print_stanparl(double A, double B)
Definition: gctp_report.c:73
double gctp_calc_e2(double x)
Definition: gctp_utility.c:139
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
DESTROY_TRANSFORM destroy
Definition: oli_local.h:37
int(* TRANSFORM_FUNC)(const TRANSFORMATION *trans, double in_x, double in_y, double *out_x, double *out_y)
Definition: oli_local.h:28
#define PRINT_FORMAT_ATTRIBUTE
Definition: oli_local.h:64
TRANSFORMATION inverse
Definition: oli_local.h:58
void gctp_print_cenlonmer(double A)
Definition: gctp_report.c:48
int gctp_ps_inverse_init(TRANSFORMATION *trans)
void gctp_print_origin(double A)
Definition: gctp_report.c:65
void gctp_print_message(GCTP_MESSAGE_TYPE_ENUM message_type, const char *filename, int line_number, const char *format,...) PRINT_FORMAT_ATTRIBUTE
int gctp_utm_inverse_init(TRANSFORMATION *trans)
Definition: tm.c:487
void gctp_print_radius2(double radius1, double radius2)
Definition: gctp_report.c:30
void gctp_print_justify_cols(double A)
Definition: gctp_report.c:109
void gctp_print_offsetp(double A, double B)
Definition: gctp_report.c:91
double gctp_calc_small_t(double eccent, double phi, double sinphi)
Definition: gctp_utility.c:277
int gctp_lamcc_inverse_init(TRANSFORMATION *trans)
int gctp_state_plane_forward_init(TRANSFORMATION *trans)
Definition: state_plane.c:429
int gctp_om_inverse_init(TRANSFORMATION *trans)
TRANSFORMATION forward
Definition: oli_local.h:57
void radius2(double A, double B)
Definition: proj_report.c:143
int gctp_tm_inverse_init(TRANSFORMATION *trans)
Definition: tm.c:539
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
void gctp_print_title(const char *proj_name)
Definition: gctp_report.c:14
GCTP_PROJECTION proj
Definition: oli_local.h:35
void gctp_print_lat_zone(double A)
Definition: gctp_report.c:101
int gctp_geo_init(TRANSFORMATION *trans)
Definition: geographic.c:38
TRANSFORM_FUNC transform
Definition: oli_local.h:36
void(* PRINT_PROJ_INFO)(const TRANSFORMATION *)
Definition: oli_local.h:18
void gctp_print_cenlon(double A)
Definition: gctp_report.c:40
int gctp_calc_phi2(double eccent, double ts, double *phi2)
Definition: gctp_utility.c:209
int gctp_dms2degrees(double ang, double *degrees)
int gctp_tm_forward_init(TRANSFORMATION *trans)
Definition: tm.c:565
int gctp_get_sign(double x)
Definition: gctp_utility.c:103
int gctp_om_forward_init(TRANSFORMATION *trans)
int gctp_poly_inverse_init(TRANSFORMATION *trans)
Definition: polyconic.c:307
double gctp_calc_e0(double x)
Definition: gctp_utility.c:125
double gctp_calc_e3(double x)
Definition: gctp_utility.c:146
int gctp_som_inverse_init(TRANSFORMATION *trans)
Definition: som.c:573
double gctp_calc_e1(double x)
Definition: gctp_utility.c:132
int gctp_som_forward_init(TRANSFORMATION *trans)
Definition: som.c:599
int gctp_ps_forward_init(TRANSFORMATION *trans)
int gctp_poly_forward_init(TRANSFORMATION *trans)
Definition: polyconic.c:334
int gctp_state_plane_inverse_init(TRANSFORMATION *trans)
Definition: state_plane.c:388
void radius(double A)
Definition: proj_report.c:132
void * cache
Definition: oli_local.h:48
void gctp_print_cenlat(double A)
Definition: gctp_report.c:57
#define degrees(radians)
Definition: niwa_iop.c:30
double gctp_calc_small_radius(double eccent, double sinphi, double cosphi)
Definition: gctp_utility.c:253
double gctp_calc_e4(double x)
Definition: gctp_utility.c:165
int gctp_utm_forward_init(TRANSFORMATION *trans)
Definition: tm.c:513