MISR Toolkit  1.5.1
MtkPathBlockRangeToBlockCorners.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkPathBlockRangeToBlockCorners =
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 "MisrError.h"
19 #include "MisrProjParam.h"
20 
37  int path,
38  int start_block,
39  int end_block,
40  MTKt_BlockCorners *block_corners )
41 {
42  MTKt_status status_code; /* Return status of this function */
43  MTKt_status status; /* Return status */
44  int i; /* Block index */
46  /* Block corners */
47 
48  if (block_corners == NULL)
50 
51  /* Check path bounds */
52  if (path < 1 || path > 233)
54 
55  /* Check block bounds */
56  if (start_block > end_block)
58 
59  if (start_block < 1 || end_block > 180)
61 
62  blkcrnrs.path = path;
63  blkcrnrs.start_block = start_block;
64  blkcrnrs.end_block = end_block;
65 
66  for (i = start_block; i <= end_block; i++) {
67  blkcrnrs.block[i].block_number = i;
68 
69  status = MtkBlsToLatLon(path, MAXRESOLUTION, i,
70  0.0, 0.0,
71  &(blkcrnrs.block[i].ulc.lat),
72  &(blkcrnrs.block[i].ulc.lon));
73  MTK_ERR_COND_JUMP(status);
74 
75  status = MtkBlsToLatLon(path, MAXRESOLUTION, i,
76  0.0, MAXNSAMPLE-1,
77  &(blkcrnrs.block[i].urc.lat),
78  &(blkcrnrs.block[i].urc.lon));
79  MTK_ERR_COND_JUMP(status);
80 
81  status = MtkBlsToLatLon(path, MAXRESOLUTION, i,
82  (MAXNLINE-1) / 2.0, (MAXNSAMPLE-1) / 2.0,
83  &(blkcrnrs.block[i].ctr.lat),
84  &(blkcrnrs.block[i].ctr.lon));
85  MTK_ERR_COND_JUMP(status);
86 
87  status = MtkBlsToLatLon(path, MAXRESOLUTION, i,
88  MAXNLINE-1, MAXNSAMPLE-1,
89  &(blkcrnrs.block[i].lrc.lat),
90  &(blkcrnrs.block[i].lrc.lon));
91  MTK_ERR_COND_JUMP(status);
92 
93  status = MtkBlsToLatLon(path, MAXRESOLUTION, i,
94  MAXNLINE-1, 0.0,
95  &(blkcrnrs.block[i].llc.lat),
96  &(blkcrnrs.block[i].llc.lon));
97  MTK_ERR_COND_JUMP(status);
98  }
99 
100  *block_corners = blkcrnrs;
101 
102  return MTK_SUCCESS;
103 
104 ERROR_HANDLE:
105  return status_code;
106 }
MTKt_GeoCoord ctr
MTKt_status MtkBlsToLatLon(int path, int resolution_meters, int block, float line, float sample, double *lat_dd, double *lon_dd)
Convert from Block, Line, Sample, to Latitude and Longitude in decimal degrees.
#define MTKT_BLOCKCORNERS_INIT
MTKt_GeoCoord ulc
#define MAXNSAMPLE
Definition: MisrProjParam.h:25
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
Block Corners.
MTKt_GeoCoord lrc
MTKt_GeoBlock block[NBLOCK+1]
#define MAXRESOLUTION
Definition: MisrProjParam.h:22
MTKt_status MtkPathBlockRangeToBlockCorners(int path, int start_block, int end_block, MTKt_BlockCorners *block_corners)
Compute block corner coordinates in decimal degrees of latitude and longitude for a given path and bl...
MTKt_GeoCoord urc
MTKt_GeoCoord llc
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
#define MAXNLINE
Definition: MisrProjParam.h:24

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