MISR Toolkit  1.5.1
MtkLatLonToSomXYAry.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkLatLonToSomXYAry =
4 = =
5 =============================================================================
6 
7  Jet Propulsion Laboratory
8  MISR
9  MISR Toolkit
10 
11  Copyright 2005, California Institute of Technology.
12  ALL RIGHTS RESERVED.
13  U.S. Government Sponsorship acknowledged.
14 
15 ============================================================================*/
16 
17 #include "MisrCoordQuery.h"
18 #include "MisrUnitConv.h"
19 #include "MisrError.h"
20 #include "proj.h"
21 #include "gctp_prototypes.h"
22 #include <stddef.h>
23 
43  int path,
44  int nelement,
45  const double *lat_dd,
46  const double *lon_dd,
47  double *som_x,
48  double *som_y )
49 {
50  MTKt_status status_code; /* Return status of this function */
51  MTKt_status status; /* Return status */
52  MTKt_MisrProjParam pp; /* Projection parameters */
53  int iflg; /* GCTP status flag */
54  double lat_r; /* Latitude in radians */
55  double lon_r; /* Longitude in radians */
56  int i; /* Loop index */
57  int (*for_trans[MAXPROJ+1])(double, double, double *, double *); /* Array of function ptrs (Not used) */
58 
59  if (lat_dd == NULL || lon_dd == NULL || som_x == NULL || som_y == NULL)
61 
62  if (nelement < 0)
64 
65  status = MtkPathToProjParam(path, 0, &pp);
66  MTK_ERR_COND_JUMP(status);
67 
69  NULL, NULL, &iflg, for_trans);
70  if (iflg)
72 
73  for (i = 0; i < nelement; i++) {
74  status = MtkDdToRad(lat_dd[i], &lat_r);
75  MTK_ERR_COND_JUMP(status);
76 
77  status = MtkDdToRad(lon_dd[i], &lon_r);
78  MTK_ERR_COND_JUMP(status);
79 
80  iflg = somfor(lon_r, lat_r, &som_x[i], &som_y[i]);
81  if (iflg)
83  }
84 
85  return MTK_SUCCESS;
86 
87 ERROR_HANDLE:
88  return status_code;
89 }
#define MAXPROJ
Definition: proj.h:84
MISR Projection Parameters.
double projparam[15]
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
MTKt_status MtkPathToProjParam(int path, int resolution_meters, MTKt_MisrProjParam *pp)
Get projection parameters.
MTKt_status MtkDdToRad(double dd, double *rad)
Convert decimal degrees to radians.
Definition: MtkDdToRad.c:38
int for_init(int outsys, int outzone, const double *outparm, int outdatum, char *fn27, char *fn83, int *iflg, int(*for_trans[])(double, double, double *, double *))
MTKt_status MtkLatLonToSomXYAry(int path, int nelement, const double *lat_dd, const double *lon_dd, double *som_x, double *som_y)
Convert array of decimal degrees latitude and longitude to array of SOM X, SOM Y. ...
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
int somfor(double lon, double lat, double *y, double *x)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51