MISR Toolkit  1.5.1
MtkL2ASCloudMaskReproject.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkL1B2Reproject =
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 "MisrToolkit.h"
18 #include "MisrError.h"
19 #include <stdio.h> /* for printf */
20 #include <getopt.h> /* for getopt_long */
21 #include <strings.h> /* for strncasecmp */
22 #include <HdfEosDef.h> /* Definition of GDopen */
23 
24 #define MAX_FILENAME 5000
25 #define MAX_FIELDNAME 1000
26 #define MAX_LENGTH 1000
27 #define NUMBER_BAND 4
28 #define NUMBER_CAMERA 9
29 #define OUTPUT_GRIDNAME "L2ASCloudMask"
30 
31 /* -------------------------------------------------------------------------*/
32 /* Structure to contain command-line arguments. */
33 /* -------------------------------------------------------------------------*/
34 
35 typedef struct {
36  char *proj_map_file; /* Projection/map info file */
37  char *aerosol_file; /* AS_AEROSOL file*/
38  char *output_basename; /* Output basename*/
39  int band; /* Band to process. -1 = all */
40 } argr_type; /* Argument parse result */
41 
42 #define ARGR_TYPE_INIT {NULL, NULL, NULL, -1}
43 
44 /* -------------------------------------------------------------------------*/
45 /* Local function prototypes */
46 /* -------------------------------------------------------------------------*/
47 
48 int process_args(int argc, char *argv[], argr_type *argr);
49 
50 /* -------------------------------------------------------------------------*/
51 /* Main program. */
52 /* -------------------------------------------------------------------------*/
53 
54 int main( int argc, char *argv[] ) {
55  MTKt_status status; /* Return status */
56  MTKt_status status_code = MTK_FAILURE; /* Return code of this function */
57  argr_type argr = ARGR_TYPE_INIT; /* Command-line arguments */
59  /* Target map information. */
60  MTKt_GCTPProjInfo target_proj_info = MTKT_GCTPPROJINFO_INIT;
61  /* Target projection information. */
62  MTKt_Region region = MTKT_REGION_INIT; /* SOM region containing target map. */
64  /* Map information for RetrAppMask. */
65  MTKt_DataBuffer retr_app_mask = MTKT_DATABUFFER_INIT;
66  /* Top-of-atmosphere radiance data quality indicator */
68  /* Valid mask for TOA BRF. */
70  /* Temporary latitude array for reprojection. */
72  /* Temporary longitude array for reprojection. */
74  /* Temporary line coord array for reprojection. */
75  MTKt_DataBuffer sample_coords = MTKT_DATABUFFER_INIT;
76  /* Temporary sample coord array for reprojection. */
77  MTKt_DataBuffer resampled_cloud_mask = MTKT_DATABUFFER_INIT;
78  /* Valid mask for final result. */
79  int path; /* Orbit path number. */
80  int iband; /* Loop iterator. */
81  int icamera; /* Loop iterator. */
82  int iline; /* Loop iterator. */
83  int isample; /* Loop iterator. */
84  char outputfile[MAX_FILENAME];
85  int32 fid = FAIL; /* HDF-EOS file identifier. */
86  int32 gid = FAIL; /* HDF-EOS grid identifier. */
87  int32 hstatus; /* HDF-EOS status code */
88  float64 upleft[2]; /* min X, max Y corner of target map. */
89  float64 lowright[2]; /* max X, min Y corner of target map. */
90  char *dimlist_ul_lr = "YDim,XDim";
91  /* HDF-EOS dimension list for origin UL or
92  origin LR maps.*/
93  char *dimlist_ur_ll = "XDim,YDim";
94  /* HDF-EOS dimension list for origin UR or
95  origin LL maps.*/
96  char *dimlist; /* HDF-EOS dimension list. */
97  int32 edge[2]; /* Size of HDF-EOS data to write. */
98  char fieldname[MAX_FIELDNAME]; /* Fieldname to read/write. */
99  char gridname[MAX_FIELDNAME]; /* Gridname to read. */
100  int size_x; /* Size of map along X axis. */
101  int size_y; /* Size of map along Y axis. */
102  int32 tile_rank = 2; /* HDF tile rank */
103  int32 tile_dims[2] = {64,64}; /* Tile dimensions. */
104  int32 comp_code = HDFE_COMP_DEFLATE; /* GZIP compression code. */
105  intn comp_parm[1] = {5}; /* GZIP compression level. */
106  int32 fill_int32 = 0; /* Fill value for int32 fields. */
107 
108  /* ------------------------------------------------------------------ */
109  /* Parse command-line arguments. */
110  /* ------------------------------------------------------------------ */
111 
112  if (process_args(argc, argv, &argr))
114 
115  /* ------------------------------------------------------------------ */
116  /* Read projection / map information for target area. */
117  /* ------------------------------------------------------------------ */
118 
119  status = MtkGCTPProjInfoRead(argr.proj_map_file, &target_proj_info);
120  if (status != MTK_SUCCESS) {
121  printf("\n\nCheck that projection/map info filename is correct: %s\n",argr.proj_map_file);
122  MTK_ERR_MSG_JUMP("Trouble with MtkGCTPProjInfoRead\n");
123  }
124 
125  status = MtkGenericMapInfoRead(argr.proj_map_file, &target_map_info);
126  if (status != MTK_SUCCESS) {
127  MTK_ERR_MSG_JUMP("Trouble with MtkGenericMapInfoRead\n");
128  }
129 
130  /* ------------------------------------------------------------------ */
131  /* Get orbit path number of input file. */
132  /* ------------------------------------------------------------------ */
133 
134  status = MtkFileToPath(argr.aerosol_file, &path);
135  if (status != MTK_SUCCESS) {
136  printf("\n\nCheck that input filename is correct: %s\n",argr.aerosol_file);
137  MTK_ERR_MSG_JUMP("Trouble with MtkFileToPath(input)\n");
138  }
139 
140  /* ------------------------------------------------------------------ */
141  /* Setup SOM region containing the target map. */
142  /* ------------------------------------------------------------------ */
143 
144  status = MtkSetRegionByGenericMapInfo(&target_map_info,
145  &target_proj_info,
146  path,
147  &region);
148  if (status != MTK_SUCCESS) {
149  MTK_ERR_MSG_JUMP("Trouble with MtkSetRegionByGenericMapInfo\n");
150  }
151 
152  /* ------------------------------------------------------------------ */
153  /* Create HDF-EOS file for result. */
154  /* ------------------------------------------------------------------ */
155 
156  if (target_map_info.origin_code == MTKe_ORIGIN_UL ||
157  target_map_info.origin_code == MTKe_ORIGIN_LR) {
158  dimlist = dimlist_ul_lr;
159  } else {
160  dimlist = dimlist_ur_ll;
161  }
162 
163  edge[0] = target_map_info.size_line;
164  edge[1] = target_map_info.size_sample;
165 
166  upleft[0] = target_map_info.min_x;
167  upleft[1] = target_map_info.max_y;
168  lowright[0] = target_map_info.max_x;
169  lowright[1] = target_map_info.min_y;
170 
171  size_x = (int)floor((target_map_info.max_x - target_map_info.min_x) /
172  target_map_info.resolution_x + 0.5);
173  size_y = (int)floor((target_map_info.max_y - target_map_info.min_y) /
174  target_map_info.resolution_y + 0.5);
175 
176  snprintf(outputfile,MAX_FILENAME,"%s.hdf",argr.output_basename);
177 
178  fid = GDopen(outputfile,DFACC_CREATE);
179  if (fid == FAIL) {
180  MTK_ERR_MSG_JUMP("Trouble with GDopen\n");
181  }
182 
183  hstatus = GDcreate(fid,OUTPUT_GRIDNAME,size_x, size_y,
184  upleft, lowright);
185 
186  gid = GDattach(fid, OUTPUT_GRIDNAME);
187  if (gid == FAIL) {
188  MTK_ERR_MSG_JUMP("Trouble with GDattach\n");
189  }
190 
191  hstatus = GDdeforigin(gid,target_map_info.origin_code);
192  if (hstatus == FAIL) {
193  MTK_ERR_MSG_JUMP("Trouble with GDdeforigin\n");
194  }
195 
196  hstatus = GDdefpixreg(gid,target_map_info.pix_reg_code);
197  if (hstatus == FAIL) {
198  MTK_ERR_MSG_JUMP("Trouble with GDdefpixreg\n");
199  }
200 
201  hstatus = GDdefproj(gid,target_proj_info.proj_code,
202  target_proj_info.zone_code, target_proj_info.sphere_code,
203  target_proj_info.proj_param);
204  if (hstatus == FAIL) {
205  MTK_ERR_MSG_JUMP("Trouble with GDdefproj\n");
206  }
207 
208  /* ------------------------------------------------------------------ */
209  /* Calculate pixel lat/lon locations for target map. */
210  /* ------------------------------------------------------------------ */
211 
212  status = MtkGCTPCreateLatLon(&target_map_info,
213  &target_proj_info,
214  &latitude,
215  &longitude);
216  if (status != MTK_SUCCESS) {
217  MTK_ERR_MSG_JUMP("Trouble with MtkGCTPCreateLatLon\n");
218  }
219 
220  /* ------------------------------------------------------------------ */
221  /* Generate map information for RetrAppMask. */
222  /* ------------------------------------------------------------------ */
223 
224  status = MtkSnapToGrid(path,1100,region,&map_info);
225  if (status != MTK_SUCCESS) {
226  MTK_ERR_MSG_JUMP("Trouble with MtkSnapToGrid\n");
227  }
228 
229  /* ------------------------------------------------------------------ */
230  /* Allocate space for cloud mask. */
231  /* ------------------------------------------------------------------ */
232 
233  status = MtkDataBufferAllocate(map_info.nline, map_info.nsample,
234  MTKe_int32,&cloud_mask);
235  if (status != MTK_SUCCESS) {
236  MTK_ERR_MSG_JUMP("Trouble with MtkDataBufferAllocate(cloud_mask)\n");
237  }
238 
239  /* ------------------------------------------------------------------ */
240  /* For each channel...(begin loop) */
241  /* ------------------------------------------------------------------ */
242 
243  for (icamera = 0 ; icamera < NUMBER_CAMERA ; icamera++) {
244  for (iband = 0 ; iband < NUMBER_BAND ; iband++) {
245  MTKt_MapInfo retr_app_mask_map_info = MTKT_MAPINFO_INIT;
246 
247  /* ------------------------------------------------------------------ */
248  /* Read RetrAppMask for the target area. */
249  /* ------------------------------------------------------------------ */
250 
251  printf("Reading RetrAppMask, camera %d, band %d...\n",icamera,iband);
252  snprintf(gridname,MAX_FIELDNAME,"SubregParamsAer");
253  snprintf(fieldname,MAX_FIELDNAME,"RetrAppMask[%d][%d]",iband,icamera);
254 
255  status = MtkReadData(argr.aerosol_file, gridname, fieldname,
256  region, &retr_app_mask, &retr_app_mask_map_info);
257  if (status != MTK_SUCCESS) {
258  MTK_ERR_MSG_JUMP("Trouble with MtkReadData(RetrAppMask)\n");
259  }
260 
261  /* ------------------------------------------------------------------ */
262  /* Set cloud mask to 1 where any channel of retr_app_mask is 7 (cloud) */
263  /* ------------------------------------------------------------------ */
264 
265  for (iline = 0; iline < retr_app_mask.nline; iline++) {
266  for (isample = 0; isample < retr_app_mask.nsample; isample++) {
267  if (retr_app_mask.data.u8[iline][isample] == 7) {
268  cloud_mask.data.i32[iline][isample] = 1;
269  } else {
270  cloud_mask.data.i32[iline][isample] = 0;
271  }
272  }
273  }
274 
275  /* ------------------------------------------------------------------ */
276  /* Free memory. */
277  /* ------------------------------------------------------------------ */
278 
279  MtkDataBufferFree(&retr_app_mask);
280 
281  /* ------------------------------------------------------------------ */
282  /* End loop for each channel. */
283  /* ------------------------------------------------------------------ */
284 
285  }
286  }
287 
288  /* ------------------------------------------------------------------ */
289  /* Reproject cloud mask to target map. */
290  /* ------------------------------------------------------------------ */
291 
292  status = MtkTransformCoordinates(map_info,
293  latitude,
294  longitude,
295  &line_coords,
296  &sample_coords);
297  if (status != MTK_SUCCESS) {
298  MTK_ERR_MSG_JUMP("Trouble with MtkTransformCoordinates\n");
299  }
300 
301  status = MtkResampleNearestNeighbor(cloud_mask,
302  line_coords,
303  sample_coords,
304  &resampled_cloud_mask);
305  if (status != MTK_SUCCESS) {
306  MTK_ERR_MSG_JUMP("Trouble with MtkResampleNearestNeighbor\n");
307  }
308 
309  /* ------------------------------------------------------------------ */
310  /* Free memory */
311  /* ------------------------------------------------------------------ */
312 
313  MtkDataBufferFree(&cloud_mask);
314 
315  /* ------------------------------------------------------------------ */
316  /* Free memory */
317  /* ------------------------------------------------------------------ */
318 
319  MtkDataBufferFree(&line_coords);
320  MtkDataBufferFree(&sample_coords);
321 
322  /* ------------------------------------------------------------------ */
323  /* Write cloud mask to HDF-EOS file. */
324  /* ------------------------------------------------------------------ */
325 
326  snprintf(fieldname,MAX_FIELDNAME,"cloud_mask");
327  status = GDdeffield(gid, fieldname, dimlist, DFNT_INT32, 0);
328  if (hstatus == FAIL) {
329  MTK_ERR_MSG_JUMP("Trouble with GDdeffield\n");
330  }
331 
332  hstatus = GDsetfillvalue(gid, fieldname, &fill_int32);
333  if (hstatus == FAIL) {
334  MTK_ERR_MSG_JUMP("Trouble with GDsetfillvalue()\n");
335  }
336 
337  hstatus = GDsettilecomp(gid, fieldname, tile_rank,
338  tile_dims, comp_code, comp_parm);
339  if (hstatus == FAIL) {
340  MTK_ERR_MSG_JUMP("Trouble with GDsettilecomp()\n");
341  }
342 
343  hstatus = GDwritefield(gid, fieldname, NULL, NULL, edge,
344  resampled_cloud_mask.dataptr);
345  if (hstatus == FAIL) {
346  MTK_ERR_MSG_JUMP("Trouble with GDwritefield\n");
347  }
348 
349  /* ------------------------------------------------------------------ */
350  /* Free memory. */
351  /* ------------------------------------------------------------------ */
352 
353  MtkDataBufferFree(&resampled_cloud_mask);
354 
355  /* ------------------------------------------------------------------ */
356  /* Free memory. */
357  /* ------------------------------------------------------------------ */
358 
359  MtkDataBufferFree(&latitude);
360  MtkDataBufferFree(&longitude);
361 
362  /* ------------------------------------------------------------------ */
363  /* Close HDF-EOS file. */
364  /* ------------------------------------------------------------------ */
365 
366  hstatus = GDdetach(gid);
367  if (hstatus == FAIL) {
368  MTK_ERR_MSG_JUMP("Trouble with GDdetach\n");
369  }
370  gid = FAIL;
371 
372  hstatus = GDclose(fid);
373  if (hstatus == FAIL) {
374  MTK_ERR_MSG_JUMP("Trouble with GDclose\n");
375  }
376  fid = FAIL;
377 
378  printf("Wrote output to %s\n",outputfile);
379  printf("Completed normally.\n");
380  return 0;
381 
382 ERROR_HANDLE:
383  if (gid != FAIL) {
384  hstatus = GDdetach(gid);
385  }
386  if (fid != FAIL) {
387  hstatus = GDclose(fid);
388  }
389 
390  MtkDataBufferFree(&resampled_cloud_mask);
391  MtkDataBufferFree(&latitude);
392  MtkDataBufferFree(&longitude);
393  MtkDataBufferFree(&cloud_mask);
394  MtkDataBufferFree(&retr_app_mask);
395  MtkDataBufferFree(&line_coords);
396  MtkDataBufferFree(&sample_coords);
397 
398  printf("Failed: status code = %d\n",status_code);
399 
400  return status_code;
401 }
402 
403 void usage(char *func) {
404  fprintf(stderr,
405 "\nUsage: %s [--help] [--band=<band number>] \n"
406 " <projection/map info file> <GRP_TERRAIN file>\n"
407 " <output basename>\n",
408  func);
409 
410  fprintf(stderr,
411 "\n"
412 "Perform reproject L1B2 terrain data to given map projection.\n"
413 "\n"
414 "Result is written to an HDF-EOS file in the following fields:\n"
415 " cloud_mask\n"
416 "\n"
417 "All output fields have identical map projection and size.\n"
418 "\n"
419  );
420 
421  fprintf(stderr,
422 "COMMAND-LINE OPTIONS\n"
423 "\n"
424 "--help\n"
425 " Returns this usage info.\n"
426 "\n"
427 "--band=<band number>\n"
428 " Specifies the band to process. Bands are identified by integer values as\n"
429 " follows: 0 = blue 1 = green 2 = red 3 = nir\n"
430 "\n"
431  );
432 
433  fprintf(stderr,
434 "COMMAND-LINE ARGUMENTS\n"
435 "\n"
436 "<projection/map info file>\n"
437 " Text file specifying map projection for the output. Parameters are\n"
438 " specified as name = value pairs. Parameter names are as follows:\n"
439 "\n"
440 " proj_code is the GCTP projection code.\n"
441 " utm_zone is the UTM zone number for UTM projections only.\n"
442 " sphere_code is GCTP spheroid code.\n"
443 " proj_param(n) is the nth GCTP projection parameter. (1 <= n <= 15)\n"
444 " min_corner_x is the minimum X coordinate at the edge of the map.\n"
445 " min_corner_y is the minimum Y coordinate at the edge of the map.\n"
446 " resolution_x is the size of a pixel along the X-axis.\n"
447 " resolution_y is the size of a pixel along the Y-axis.\n"
448 " number_pixel_x is the size of the map in pixels, along the X-axis.\n"
449 " number_pixel_y is the size of the map in pixels, along the Y-axis.\n"
450 " origin_code defines the corner of the map at which pixel 0,0 is located.\n"
451 " pix_reg_code defines whether a pixel value is related to the corner or\n"
452 " center of the corresponding area of that pixel on the map. If the\n"
453 " corner is used, then it is always the corner corresponding to the\n"
454 " corner of the origin.\n"
455 "\n"
456 " Possible values for origin_code are:\n"
457 " UL - Upper Left (min X, max Y); Line=Y, Sample=X\n"
458 " UR - Upper Right (max X, max Y); Line=X, Sample=Y\n"
459 " LL - Lower Left (min X, min Y); Line=X, Sample=Y\n"
460 " LR - Lower Right (max X, min Y); Line=Y, Sample=X\n"
461 "\n"
462 " Possible values for pix_reg_code are:\n"
463 " CENTER - Center\n"
464 " CORNER - Corner\n"
465 "\n"
466 " Unrecognized parameter names are ignored.\n"
467 " Lines starting with a '#' character are ignored.\n"
468 " Anything after the name = value pair on a line is ignored.\n"
469 "\n"
470 " Example projection/map info file:\n"
471 " # Albers equal-area conic projection parameters\n"
472 " proj_code = 3 # Albers equal-area conic\n"
473 " sphere_code = 8 # GRS80\n"
474 " proj_param(3) = 29030000.0 # Latitude of the first standard parallel\n"
475 " proj_param(4) = 45030000.0 # Latitude of the second standard parallel\n"
476 " proj_param(5) = -96000000.0 # Longitude of the central meridian\n"
477 " proj_param(6) = 23000000.0 # Latitude of the projection origin\n"
478 " # Map information\n"
479 " min_corner_x = 1930612.449614\n"
480 " min_corner_y = 2493633.488881\n"
481 " resolution_x = 250.0\n"
482 " resolution_y = 250.0\n"
483 " number_pixel_x = 1311\n"
484 " number_pixel_y = 2078\n"
485 " origin_code = UL\n"
486 " pix_reg_code = CENTER\n"
487 "\n"
488 "\n"
489 "<GRP_TERRAIN>\n"
490 " MISR Terrain-projected Radiance Product (GRP_TERRAIN).\n"
491 "\n"
492 "<output basename>\n"
493 " Basename for output file.\n"
494 "\n"
495 "Examples:\n"
496 "\n"
497 " MtkL1B2Reproject proj_map_info.txt \\\n"
498 " MISR_AM1_AS_AEROSOL_P143_O031948_F12_0022.hdf \\\n"
499 " cloud_mask_o31948\n"
500 "\n"
501  );
502 }
503 
504 int process_args(int argc, char *argv[], argr_type *argr) {
505 
506  MTKt_status status_code = MTK_FAILURE;
507  extern char *optarg;
508  extern int optind;
509  int ch;
510  argr->band = -1;
511 
512  /* options descriptor */
513  static struct option longopts[] = {
514  { "band", required_argument, 0, 'b' },
515  { "help", no_argument, 0, 'h' },
516  { 0, 0, 0, 0 }
517  };
518 
519  while ((ch = getopt_long(argc, argv, "b:h", longopts, NULL)) != -1) {
520 
521  switch(ch) {
522  case 'h':
524  break;
525  case 'b' :
526  argr->band = (int)atol(optarg);
527  break;
528  default:
529  MTK_ERR_MSG_JUMP("Invalid arguments");
530  }
531  }
532 
533  if (argc-optind != 3) MTK_ERR_CODE_JUMP(MTK_OUTBOUNDS);
534 
535  argr->proj_map_file = argv[optind++];
536  argr->aerosol_file = argv[optind++];
537  argr->output_basename = argv[optind++];
538 
539  return MTK_SUCCESS;
540  ERROR_HANDLE:
541  usage(argv[0]);
542  return status_code;
543 }
544 
intn GDdefpixreg(int32, int32)
MTKt_status MtkGCTPProjInfoRead(const char *Filename, MTKt_GCTPProjInfo *Proj_info)
Initialize a MTKt_GCTPProjInfo structure using data from an external file.
MTKt_PixRegCode pix_reg_code
Definition: MisrMapQuery.h:116
MTKt_status MtkDataBufferAllocate(int nline, int nsample, MTKt_DataType datatype, MTKt_DataBuffer *databuf)
Allocate Data Buffer.
#define MAX_FILENAME
#define OUTPUT_GRIDNAME
int32 GDattach(int32, char *)
MTKt_status MtkSetRegionByGenericMapInfo(const MTKt_GenericMapInfo *Map_info, const MTKt_GCTPProjInfo *Proj_info, int Path, MTKt_Region *Region)
Create an MtkRegion structure that contains the given map.
MTKt_OriginCode origin_code
Definition: MisrMapQuery.h:115
Generic map information.
Definition: MisrMapQuery.h:98
MTKt_DataBufferType data
Definition: MisrUtil.h:104
intn GDclose(int32)
#define MTKT_MAPINFO_INIT
Definition: MisrMapQuery.h:79
int process_args(int argc, char *argv[], argr_type *argr)
void usage(char *func)
GCTP projection information.
Definition: MisrMapQuery.h:123
MTKt_status MtkTransformCoordinates(MTKt_MapInfo mapinfo, MTKt_DataBuffer latbuf, MTKt_DataBuffer lonbuf, MTKt_DataBuffer *linebuf, MTKt_DataBuffer *samplebuf)
Transforms latitude/longitude coordinates into line/sample coordinates for a given mapinfo...
#define MTKT_REGION_INIT
Definition: MisrSetRegion.h:46
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
Map Information.
Definition: MisrMapQuery.h:65
intn GDdetach(int32)
intn GDdeforigin(int32, int32)
JCOPY_OPTION option
Definition: transupp.h:131
2-dimensional Data Buffer
Definition: MisrUtil.h:98
#define MAX_FIELDNAME
#define MTKT_DATABUFFER_INIT
Definition: MisrUtil.h:109
int32 GDcreate(int32, char *, int32, int32, float64 [], float64 [])
void * dataptr
Definition: MisrUtil.h:106
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
MTKt_status MtkGCTPCreateLatLon(const MTKt_GenericMapInfo *Map_info, const MTKt_GCTPProjInfo *Proj_info, MTKt_DataBuffer *Latitude, MTKt_DataBuffer *Longitude)
Create an array of latitude and longitude values corresponding to each pixel in the given map...
MTKt_uint8 ** u8
Definition: MisrUtil.h:86
intn GDdefproj(int32, int32, int32, int32, float64 [])
char * proj_map_file
MTKt_status MtkReadData(const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Reads any grid/field from any MISR product file and performs unpacking or unscaling. It also reads any MISR conventional product file.
Definition: MtkReadData.c:62
double proj_param[15]
Definition: MisrMapQuery.h:127
char * output_basename
#define DFNT_INT32
Definition: hntdefs.h:47
intn GDsettilecomp(int32, char *, int32, int32 *, int32, intn *)
#define MTK_ERR_MSG_JUMP(msg)
Definition: MisrError.h:169
intn GDsetfillvalue(int32, char *, VOIDP)
MTKt_status MtkGenericMapInfoRead(const char *Filename, MTKt_GenericMapInfo *Map_info)
Initialize a MTKt_GenericMapInfo structure using data from an external file.
intn GDdeffield(int32, char *, char *, int32, int32)
intn GDwritefield(int32, char *, int32 [], int32 [], int32 [], VOIDP)
int main(int argc, char *argv[])
#define HDFE_COMP_DEFLATE
Definition: HdfEosDef.h:78
#define NUMBER_BAND
MTKt_int32 ** i32
Definition: MisrUtil.h:89
MTKt_status MtkSnapToGrid(int path, int resolution, MTKt_Region region, MTKt_MapInfo *mapinfo)
Snap a region to a MISR grid based on path number and resolution.
Definition: MtkSnapToGrid.c:40
MTKt_status MtkResampleNearestNeighbor(MTKt_DataBuffer srcbuf, MTKt_DataBuffer linebuf, MTKt_DataBuffer samplebuf, MTKt_DataBuffer *resampbuf)
Perform nearest neighbor resampling.
#define NUMBER_CAMERA
MTKt_status
Definition: MisrError.h:11
#define MTKT_GENERICMAPINFO_INIT
Definition: MisrMapQuery.h:120
Region of interest.
Definition: MisrSetRegion.h:41
int32 GDopen(char *, intn)
#define DFACC_CREATE
Definition: hdf.h:46
#define ARGR_TYPE_INIT
#define MTKT_GCTPPROJINFO_INIT
Definition: MisrMapQuery.h:130
MTKt_status MtkFileToPath(const char *filename, int *path)
Read path number from file.
Definition: MtkFileToPath.c:35
#define FAIL
Definition: hdf.h:94

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