MISR Toolkit  1.5.1
MtkSomXYToLatLon.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkSomXYToLatLon =
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 
37  int path,
38  double som_x,
39  double som_y,
40  double *lat_dd,
41  double *lon_dd )
42 {
43  MTKt_status status_code; /* Return status of this function */
44  MTKt_status status; /* Return status */
45  MTKt_MisrProjParam pp; /* Projection parameters */
46  int iflg; /* GCTP status flag */
47  double lat_r; /* Latitude in radians */
48  double lon_r; /* Longitude in radians */
49  int (*inv_trans[MAXPROJ+1])(double, double, double*, double*); /* Array of function ptrs (Not used) */
50 
51  if (lat_dd == NULL || lon_dd == NULL)
53 
54  status = MtkPathToProjParam(path, 0, &pp);
55  MTK_ERR_COND_JUMP(status);
56 
58  NULL, NULL, &iflg, inv_trans);
59  if (iflg)
61 
62  iflg = sominv(som_x, som_y, &lon_r, &lat_r);
63  if (iflg)
65 
66  status = MtkRadToDd(lat_r, lat_dd);
67  MTK_ERR_COND_JUMP(status);
68 
69  status = MtkRadToDd(lon_r, lon_dd);
70  MTK_ERR_COND_JUMP(status);
71 
72  return MTK_SUCCESS;
73 
74 ERROR_HANDLE:
75  return status_code;
76 }
#define MAXPROJ
Definition: proj.h:84
MISR Projection Parameters.
double projparam[15]
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
int sominv(double y, double x, double *lon, double *lat)
MTKt_status MtkPathToProjParam(int path, int resolution_meters, MTKt_MisrProjParam *pp)
Get projection parameters.
MTKt_status MtkSomXYToLatLon(int path, double som_x, double som_y, double *lat_dd, double *lon_dd)
Convert SOM X, SOM Y to decimal degrees latitude and longitude.
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
MTKt_status MtkRadToDd(double rad, double *dd)
Convert radians to decimal degrees.
Definition: MtkRadToDd.c:38
int inv_init(int insys, int inzone, const double *inparm, int indatum, char *fn27, char *fn83, int *iflg, int(*inv_trans[])(double, double, double *, double *))

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