MISR Toolkit  1.5.1
MtkLatLonToPathList.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkLatLonToPathList =
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 "MisrOrbitPath.h"
18 #include "MisrCoordQuery.h"
19 #include "MisrError.h"
20 #include "MisrProjParam.h"
21 #include <stdlib.h>
22 
39  double lat_dd,
40  double lon_dd,
41  int *pathcnt,
42  int **pathlist )
43 {
44  MTKt_status status_code; /* Return status of this function */
45  MTKt_status status; /* Return status */
46  int block; /* Block */
47  float line; /* Line */
48  float sample; /* Sample */
49  int path; /* Loop index */
50  int pathlist_tmp[NPATH]; /* Temp pathlist */
51  int *list = NULL; /* Temp list */
52  int cnt = 0; /* Path count */
53 
54  if (pathcnt == NULL || pathlist == NULL)
56 
57  for (path = 1; path <= NPATH; path++) {
58  status = MtkLatLonToBls(path, MAXRESOLUTION, lat_dd, lon_dd,
59  &block, &line, &sample);
60 
61  if (status == MTK_SUCCESS)
62  pathlist_tmp[cnt++] = path;
63  }
64 
65  if (cnt == 0)
67 
68  list = (int *)malloc(cnt * sizeof(int));
69  if (list == NULL)
71 
72  for (path = 0; path < cnt; path++) {
73  list[path] = pathlist_tmp[path];
74  }
75  *pathcnt = cnt;
76  *pathlist = list;
77 
78  return MTK_SUCCESS;
79 
80 ERROR_HANDLE:
81  return status_code;
82 }
MTKt_status MtkLatLonToBls(int path, int resolution_meters, double lat_dd, double lon_dd, int *block, float *line, float *sample)
Convert decimal degrees latitude and longitude to block, line, sample.
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
#define MAXRESOLUTION
Definition: MisrProjParam.h:22
#define NPATH
Definition: MisrProjParam.h:31
MTKt_status MtkLatLonToPathList(double lat_dd, double lon_dd, int *pathcnt, int **pathlist)
Get list of paths that cover a particular latitude and longitude.
MTKt_status
Definition: MisrError.h:11

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