MISR Toolkit  1.5.1
MtkReadL2Land.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkReadL2Land =
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 /* For strcasestr prototype in string.h on Linux64 */
18 #define _GNU_SOURCE
19 
20 #include "MisrReadData.h"
21 #include "MisrFileQuery.h"
22 #include "MisrUtil.h"
23 #include "MisrError.h"
24 #include <string.h>
25 #include <stdlib.h>
26 #include <math.h>
27 #include <hdf.h>
28 #include <HdfEosDef.h>
29 
40  const char *filename,
41  const char *gridname,
42  const char *fieldname,
43  MTKt_Region region,
44  MTKt_DataBuffer *databuf,
45  MTKt_MapInfo *mapinfo )
46 {
47  MTKt_status status; /* Return status */
48 
49  status = MtkReadL2LandNC(filename, gridname, fieldname, region, databuf, mapinfo); // try netCDF
50  if (status != MTK_NETCDF_OPEN_FAILED) return status;
51 
52  return MtkReadL2LandHDF(filename, gridname, fieldname, region, databuf, mapinfo); // try HDF
53 }
54 
56  const char *filename,
57  const char *gridname,
58  const char *fieldname,
59  MTKt_Region region,
60  MTKt_DataBuffer *databuf,
61  MTKt_MapInfo *mapinfo )
62 {
63  MTKt_status status;
64  MTKt_status status_code;
65  int ncid = 0;
66 
67  if (filename == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
68 
69  /* Open file */
70  {
71  int nc_status = nc_open(filename, NC_NOWRITE, &ncid);
73  }
74 
75  /* Read data. */
76  status = MtkReadL2LandNcid(ncid, gridname, fieldname, region, databuf, mapinfo);
77  MTK_ERR_COND_JUMP(status);
78 
79  /* Close file */
80  {
81  int nc_status = nc_close(ncid);
83  }
84  ncid = 0;
85 
86  return MTK_SUCCESS;
87 
88  ERROR_HANDLE:
89  if (ncid != 0) nc_close(ncid);
90  return status_code;
91 }
92 
94  const char *filename,
95  const char *gridname,
96  const char *fieldname,
97  MTKt_Region region,
98  MTKt_DataBuffer *databuf,
99  MTKt_MapInfo *mapinfo )
100 {
101  MTKt_status status; /* Return status */
102  MTKt_status status_code; /* Return status code for error macros */
103  int32 fid = FAIL; /* HDF-EOS File id */
104  intn hdfstatus; /* HDF return status */
105 
106  if (filename == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
107 
108  /* Open file. */
109  fid = GDopen((char*)filename, DFACC_READ);
111 
112  /* Read data. */
113  status = MtkReadL2LandFid(fid, gridname, fieldname, region, databuf, mapinfo);
114  MTK_ERR_COND_JUMP(status);
115 
116  /* Close file. */
117  hdfstatus = GDclose(fid);
119  fid = FAIL;
120 
121  return MTK_SUCCESS;
122  ERROR_HANDLE:
123  if (fid != FAIL) GDclose(fid);
124  return status_code;
125 }
126 
133  int32 fid,
134  const char *gridname,
135  const char *fieldname,
136  MTKt_Region region,
137  MTKt_DataBuffer *databuf,
138  MTKt_MapInfo *mapinfo )
139 {
140  MTKt_status status; /* Return status */
141  MTKt_status status_code; /* Return status code for error macros */
143  /* Map info structure */
145  /* Data buffer structure */
147  /* Raw data buffer structure */
149  /* Minimum for unscaling */
151  /* Maximum for unscaling */
153  /* Offset for unscaling */
155  /* Scale for unscaling */
157  /* Fill flag value */
159  /* Overflow flag value */
161  /* Underflow flag value */
162  char *field; /* Pointer to field to read */
163  char fieldstr[MAXSTR]; /* Field string */
164  char *fieldarr[2]; /* Field array */
165  char *sp; /* Pointer to string */
166  char attr[MAXSTR]; /* Attribute name */
167  int attrcnt = 0; /* Attribute count */
168  MTKt_boolean flag; /* Flag field requested */
169  MTKt_boolean raw; /* Raw field requested */
170  int l; /* Line index */
171  int s; /* Sample index */
172  char *basefield = NULL; /* Base fieldname */
173  int nextradims; /* Number of extra dimensions */
174  int *extradims = NULL; /* Extra dimension list */
175 
176  if (gridname == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
177  if (fieldname == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
178 
179  /* ---------------------------------------------------------- */
180  /* Parse fieldname to determine unpacking or unscaling method */
181  /* ---------------------------------------------------------- */
182 
183  /* Make a working copy of fieldname */
184  strncpy(fieldstr, fieldname, MAXSTR);
185  fieldarr[0] = fieldstr;
186 
187  /* Separate raw/flag from base field */
188  if ((sp = strchr(fieldstr, ' ')) != NULL) {
189  *sp = '\0';
190  fieldarr[1] = ++sp;
191  } else if ((sp = strchr(fieldstr, '\0')) != NULL) {
192  fieldarr[1] = sp;
193  } else {
195  }
196 
197  /* ------------------------------------------------ */
198  /* Determine if raw/native or flags is in fieldname */
199  /* ------------------------------------------------ */
200 
201  if ((sp = strcasestr(fieldname, "raw")) != NULL ||
202  (sp = strcasestr(fieldname, "native")) != NULL) {
203  flag = MTK_FALSE;
204  raw = MTK_TRUE;
205  field = fieldarr[1];
206  } else if ((sp = strcasestr(fieldname, "flag")) != NULL) {
207  flag = MTK_TRUE;
208  raw = MTK_FALSE;
209  field = fieldarr[1];
210  } else {
211  flag = MTK_FALSE;
212  raw = MTK_FALSE;
213  field = fieldarr[0];
214  }
215 
216  /* -------------------------------------------------------------------- */
217  /* Read scale, offset, fill, underflow and overflow value, if available */
218  /* -------------------------------------------------------------------- */
219 
220  status = MtkParseFieldname(field, &basefield, &nextradims, &extradims);
221  MTK_ERR_COND_JUMP(status);
222 
223  if (raw == MTK_FALSE) {
224  strncpy(attr, "Min ", MAXSTR);
225  strncat(attr, basefield, strlen(basefield));
226  status = MtkGridAttrGetFid(fid, gridname, attr, &min);
227  if (status == MTK_SUCCESS) attrcnt++;
228 
229  strncpy(attr, "Max ", MAXSTR);
230  strncat(attr, basefield, strlen(basefield));
231  status = MtkGridAttrGetFid(fid, gridname, attr, &max);
232  if (status == MTK_SUCCESS) attrcnt++;
233 
234  strncpy(attr, "Scale ", MAXSTR);
235  strncat(attr, basefield, strlen(basefield));
236  status = MtkGridAttrGetFid(fid, gridname, attr, &scale);
237  if (status == MTK_SUCCESS) attrcnt++;
238 
239  strncpy(attr, "Offset ", MAXSTR);
240  strncat(attr, basefield, strlen(basefield));
241  status = MtkGridAttrGetFid(fid, gridname, attr, &offset);
242  if (status == MTK_SUCCESS) attrcnt++;
243 
244  strncpy(attr, "Fill ", MAXSTR);
245  strncat(attr, basefield, strlen(basefield));
246  status = MtkGridAttrGetFid(fid, gridname, attr, &fill);
247  if (status == MTK_SUCCESS) attrcnt++;
248 
249  strncpy(attr, "Underflow ", MAXSTR);
250  strncat(attr, basefield, strlen(basefield));
251  status = MtkGridAttrGetFid(fid, gridname, attr, &underflow);
252  if (status == MTK_SUCCESS) attrcnt++;
253 
254  strncpy(attr, "Overflow ", MAXSTR);
255  strncat(attr, basefield, strlen(basefield));
256  status = MtkGridAttrGetFid(fid, gridname, attr, &overflow);
257  if (status == MTK_SUCCESS) attrcnt++;
258  }
259 
260  /* --------------------------------------------------------------- */
261  /* Determine which unpacking or unscaling method to do, then do it */
262  /* --------------------------------------------------------------- */
263 
264  /* -------------------------------------------------------------- */
265  /* Read, unpack and unscale LandHDRF and LandBRF fields, only if */
266  /* raw or flag is not set. These two fields are a special case */
267  /* unpacking and unscaling alogrithm. The raw field is shifted */
268  /* left two bits. */
269  /* -------------------------------------------------------------- */
270 
271  if (attrcnt == 7 && flag == MTK_FALSE && raw == MTK_FALSE &&
272  ((strncmp(basefield, "LandHDRF", MAXSTR) == 0 &&
273  strncmp(basefield, "LandHDRFUnc", MAXSTR) != 0) ||
274  strncmp(basefield, "LandBRF", MAXSTR) == 0)) {
275 
276  status = MtkReadRawFid(fid, gridname, field, region, &rawbuf, &map);
277  MTK_ERR_COND_JUMP(status);
278 
279  status = MtkDataBufferAllocate(rawbuf.nline, rawbuf.nsample, MTKe_float,
280  &buf);
281  MTK_ERR_COND_JUMP(status);
282 
283  for (l = 0; l < buf.nline; l++) {
284  for (s = 0; s < buf.nsample; s++) {
285  if (rawbuf.data.u16[l][s] == fill.data.u16[0][0]) {
286  buf.data.f[l][s] = (MTKt_float)fill.data.u16[0][0];
287  } else if (rawbuf.data.u16[l][s] == underflow.data.u16[0][0]) {
288  buf.data.f[l][s] = (MTKt_float)underflow.data.u16[0][0];
289  } else if (rawbuf.data.u16[l][s] == overflow.data.u16[0][0]) {
290  buf.data.f[l][s] = (MTKt_float)overflow.data.u16[0][0];
291  } else {
292  buf.data.f[l][s] = (MTKt_float)((rawbuf.data.u16[l][s] >> 1) *
293  scale.data.f[0][0]) +
294  offset.data.f[0][0];
295  }
296  }
297  }
298 
299  /* -------------------------------------------------------------- */
300  /* Read, unpack and unscale all fields that have scale and offset */
301  /* offset values, only if raw or flag is not set. */
302  /* -------------------------------------------------------------- */
303 
304  } else if (attrcnt == 7 && flag == MTK_FALSE && raw == MTK_FALSE) {
305 
306  status = MtkReadRawFid(fid, gridname, field, region, &rawbuf, &map);
307  MTK_ERR_COND_JUMP(status);
308 
309  status = MtkDataBufferAllocate(rawbuf.nline, rawbuf.nsample, MTKe_float,
310  &buf);
311  MTK_ERR_COND_JUMP(status);
312 
313  switch(rawbuf.datatype) {
314  case MTKe_uint8:
315  for (l = 0; l < buf.nline; l++) {
316  for (s = 0; s < buf.nsample; s++) {
317  if (rawbuf.data.u8[l][s] == fill.data.u8[0][0]) {
318  buf.data.f[l][s] = (MTKt_float)fill.data.u8[0][0];
319  } else if (rawbuf.data.u8[l][s] == underflow.data.u8[0][0]) {
320  buf.data.f[l][s] = (MTKt_float)underflow.data.u8[0][0];
321  } else if (rawbuf.data.u8[l][s] == overflow.data.u8[0][0]) {
322  buf.data.f[l][s] = (MTKt_float)overflow.data.u8[0][0];
323  } else {
324  buf.data.f[l][s] = (MTKt_float)(rawbuf.data.u8[l][s] *
325  scale.data.f[0][0]) + offset.data.f[0][0];
326  }
327  }
328  }
329  break;
330  case MTKe_uint16:
331  for (l = 0; l < buf.nline; l++) {
332  for (s = 0; s < buf.nsample; s++) {
333  if (rawbuf.data.u16[l][s] == fill.data.u16[0][0]) {
334  buf.data.f[l][s] = (MTKt_float)fill.data.u16[0][0];
335  } else if (rawbuf.data.u16[l][s] == underflow.data.u16[0][0]) {
336  buf.data.f[l][s] = (MTKt_float)underflow.data.u16[0][0];
337  } else if (rawbuf.data.u16[l][s] == overflow.data.u16[0][0]) {
338  buf.data.f[l][s] = (MTKt_float)overflow.data.u16[0][0];
339  } else {
340  buf.data.f[l][s] = (MTKt_float)(rawbuf.data.u16[l][s] *
341  scale.data.f[0][0]) + offset.data.f[0][0];
342  }
343  }
344  }
345  break;
346  default:
348  break;
349  }
350 
351  /* -------------------------------------------------------------- */
352  /* Read and only unpack LAIDelta1 and LAIDelta2, only if raw or */
353  /* flag is not set. The negative sign (flag) needs to be stripped */
354  /* to produce the actual real value. */
355  /* -------------------------------------------------------------- */
356 
357  } else if (attrcnt == 0 && flag == MTK_FALSE && raw == MTK_FALSE &&
358  (strncmp(basefield, "LAIDelta1", MAXSTR) == 0 ||
359  strncmp(basefield, "LAIDelta2", MAXSTR) == 0)) {
360 
361  status = MtkReadRawFid(fid, gridname, field, region, &buf, &map);
362  MTK_ERR_COND_JUMP(status);
363 
364  status = MtkFillValueGetFid(fid, gridname, field, &fill);
365  MTK_ERR_COND_JUMP(status)
366 
367  for (l = 0; l < buf.nline; l++) {
368  for (s = 0; s < buf.nsample; s++) {
369  if (buf.data.f[l][s] != fill.data.f[0][0]) {
370  buf.data.f[l][s] = fabsf(buf.data.f[l][s]);
371  } else {
372  buf.data.f[l][s] = buf.data.f[l][s];
373  }
374  }
375  }
376 
377  /* -------------------------------------------------------------- */
378  /* Read flag value for LandHDRF and LandBRF fields, only if flag */
379  /* is set to true. */
380  /* -------------------------------------------------------------- */
381 
382  } else if (attrcnt == 7 && flag == MTK_TRUE && raw == MTK_FALSE &&
383  ((strncmp(basefield, "LandHDRF", MAXSTR) == 0 &&
384  strncmp(basefield, "LandHDRFUnc", MAXSTR) != 0) ||
385  strncmp(basefield, "LandBRF", MAXSTR) == 0)) {
386 
387  status = MtkReadRawFid(fid, gridname, field, region, &rawbuf, &map);
388  MTK_ERR_COND_JUMP(status);
389 
390  status = MtkDataBufferAllocate(rawbuf.nline, rawbuf.nsample, MTKe_uint16,
391  &buf);
392  MTK_ERR_COND_JUMP(status);
393 
394  for (l = 0; l < buf.nline; l++) {
395  for (s = 0; s < buf.nsample; s++) {
396  if (rawbuf.data.u16[l][s] != fill.data.u16[0][0] &&
397  rawbuf.data.u16[l][s] != underflow.data.u16[0][0] &&
398  rawbuf.data.u16[l][s] != overflow.data.u16[0][0]) {
399  buf.data.u16[l][s] = rawbuf.data.u16[l][s] & 0x0001;
400  } else {
401  buf.data.u16[l][s] = rawbuf.data.u16[l][s];
402  }
403  }
404  }
405 
406  /* -------------------------------------------------------------- */
407  /* Read flag value for LAIDelta1 and LAIDelta2 fields, only if */
408  /* flag is set to true. */
409  /* -------------------------------------------------------------- */
410 
411  } else if (attrcnt == 0 && flag == MTK_TRUE && raw == MTK_FALSE &&
412  (strncmp(basefield, "LAIDelta1", MAXSTR) == 0 ||
413  strncmp(basefield, "LAIDelta2", MAXSTR) == 0)) {
414 
415  status = MtkReadRawFid(fid, gridname, field, region, &buf, &map);
416  MTK_ERR_COND_JUMP(status);
417 
418  status = MtkFillValueGetFid(fid, gridname, field, &fill);
419  MTK_ERR_COND_JUMP(status)
420 
421  for (l = 0; l < buf.nline; l++) {
422  for (s = 0; s < buf.nsample; s++) {
423  if (buf.data.f[l][s] != fill.data.f[0][0]) {
424  buf.data.f[l][s] = buf.data.f[l][s] < 0.0f ? -1.0f : 1.0f;
425  } else {
426  buf.data.f[l][s] = buf.data.f[l][s];
427  }
428  }
429  }
430 
431  /* -------------------------------------------------------------- */
432  /* Read all other fields that don't require unpacking/ unscaling. */
433  /* -------------------------------------------------------------- */
434 
435  } else if (flag == MTK_FALSE) {
436 
437  status = MtkReadRawFid(fid, gridname, field, region, &buf, &map);
438  MTK_ERR_COND_JUMP(status);
439 
440  } else {
442  }
443 
444  free(basefield);
445  free(extradims);
446  MtkDataBufferFree(&rawbuf);
447  MtkDataBufferFree(&min);
448  MtkDataBufferFree(&max);
449  MtkDataBufferFree(&offset);
450  MtkDataBufferFree(&scale);
451  MtkDataBufferFree(&fill);
452  MtkDataBufferFree(&overflow);
453  MtkDataBufferFree(&underflow);
454 
455  *databuf = buf;
456  *mapinfo = map;
457 
458  return MTK_SUCCESS;
459  ERROR_HANDLE:
460  if (basefield != NULL) free(basefield);
461  if (extradims != NULL) free(extradims);
462  MtkDataBufferFree(&buf);
463  MtkDataBufferFree(&rawbuf);
464  MtkDataBufferFree(&min);
465  MtkDataBufferFree(&max);
466  MtkDataBufferFree(&offset);
467  MtkDataBufferFree(&scale);
468  MtkDataBufferFree(&fill);
469  MtkDataBufferFree(&overflow);
470  MtkDataBufferFree(&underflow);
471  return status_code;
472 }
473 
475  int ncid,
476  const char *gridname,
477  const char *fieldname,
478  MTKt_Region region,
479  MTKt_DataBuffer *databuf,
480  MTKt_MapInfo *mapinfo )
481 {
482  MTKt_status status; /* Return status */
483  MTKt_status status_code; /* Return status code for error macros */
484  MTKt_MapInfo map = MTKT_MAPINFO_INIT; /* Map info structure */
485  MTKt_DataBuffer buf = MTKT_DATABUFFER_INIT; /* Data buffer structure */
486  MTKt_DataBuffer rawbuf = MTKT_DATABUFFER_INIT; /* Raw data buffer structure */
487  char *basefield = NULL; /* Base fieldname */
488  int nextradims; /* Number of extra dimensions */
489  int *extradims = NULL; /* Extra dimension list */
490 
491  if (gridname == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
492  if (fieldname == NULL) MTK_ERR_CODE_JUMP(MTK_NULLPTR);
493 
494  /* -------------------------------------------------------------------- */
495  /* Determine field type */
496  /* -------------------------------------------------------------------- */
497 
498  status = MtkParseFieldname(fieldname, &basefield, &nextradims, &extradims);
499  MTK_ERR_COND_JUMP(status);
500 
501  MTKt_ncvarid var;
502  int scaled = 0;
503  nc_type nc_datatype;
504 
505  {
506  int nc_status;
507  int group_id;
508  nc_status = nc_inq_grp_ncid(ncid, gridname, &group_id);
510 
511  status = MtkNCVarId(group_id, basefield, &var);
512  MTK_ERR_COND_JUMP(status);
513 
514  nc_status = nc_inq_att(var.gid, var.varid, "scale_factor", NULL, NULL);
515  if (nc_status == NC_NOERR) scaled = 1;
516  nc_status = nc_inq_vartype(var.gid, var.varid, &nc_datatype);
518  }
519 
520  /* -------------------------------------------------------------- */
521  /* Read and unscale fields of type unsigned short. */
522  /* -------------------------------------------------------------- */
523 
524  if ( scaled == 1 && nc_datatype == NC_USHORT ) {
525  unsigned short valid_range[2];
526  float scale;
527  float offset;
528  int nc_status;
529  nc_status = nc_get_att(var.gid, var.varid, "valid_range", &valid_range);
531  nc_status = nc_get_att(var.gid, var.varid, "scale_factor", &scale);
533  nc_status = nc_get_att(var.gid, var.varid, "add_offset", &offset);
535 
536  status = MtkReadRawNcid(ncid, gridname, fieldname, region, &rawbuf, &map);
537  MTK_ERR_COND_JUMP(status);
538 
539  status = MtkDataBufferAllocate(rawbuf.nline, rawbuf.nsample, MTKe_float, &buf);
540  MTK_ERR_COND_JUMP(status);
541 
542  float float_fill = -9999.0;
543 
544  unsigned short valid_min = valid_range[0];
545  unsigned short valid_max = valid_range[1];
546  for (int i = 0; i < buf.nline; i++) {
547  for (int j = 0; j < buf.nsample; j++) {
548  unsigned short raw = rawbuf.data.u16[i][j];
549  if (raw < valid_min || raw > valid_max) {
550  buf.data.f[i][j] = float_fill;
551  } else {
552  buf.data.f[i][j] = raw * scale + offset;
553  }
554  }
555  }
556 
557  /* -------------------------------------------------------------- */
558  /* Read and unscale fields of type unsigned char */
559  /* -------------------------------------------------------------- */
560 
561  } else if (scaled == 1 && nc_datatype == NC_UBYTE) {
562  unsigned char valid_range[2];
563  float scale;
564  float offset;
565  int nc_status;
566  nc_status = nc_get_att(var.gid, var.varid, "valid_range", &valid_range);
568  nc_status = nc_get_att(var.gid, var.varid, "scale_factor", &scale);
570  nc_status = nc_get_att(var.gid, var.varid, "add_offset", &offset);
572 
573  status = MtkReadRawNcid(ncid, gridname, fieldname, region, &rawbuf, &map);
574  MTK_ERR_COND_JUMP(status);
575 
576  status = MtkDataBufferAllocate(rawbuf.nline, rawbuf.nsample, MTKe_float, &buf);
577  MTK_ERR_COND_JUMP(status);
578 
579  float float_fill = -9999.0;
580 
581  unsigned char valid_min = valid_range[0];
582  unsigned char valid_max = valid_range[1];
583  for (int i = 0; i < buf.nline; i++) {
584  for (int j = 0; j < buf.nsample; j++) {
585  unsigned char raw = rawbuf.data.u8[i][j];
586  if (raw < valid_min || raw > valid_max) {
587  buf.data.f[i][j] = float_fill;
588  } else {
589  buf.data.f[i][j] = raw * scale + offset;
590  }
591  }
592  }
593 
594  /* -------------------------------------------------------------- */
595  /* Read float fields */
596  /* -------------------------------------------------------------- */
597 
598  } else {
599 
600  status = MtkReadRawNcid(ncid, gridname, fieldname, region, &buf, &map);
601  MTK_ERR_COND_JUMP(status);
602 
603  }
604 
605  free(basefield);
606  free(extradims);
607  MtkDataBufferFree(&rawbuf);
608 
609  *databuf = buf;
610  *mapinfo = map;
611 
612  return MTK_SUCCESS;
613  ERROR_HANDLE:
614  if (basefield != NULL) free(basefield);
615  if (extradims != NULL) free(extradims);
616  MtkDataBufferFree(&buf);
617  MtkDataBufferFree(&rawbuf);
618  return status_code;
619 }
nc_type
Definition: netcdf.h:253
MTKt_status MtkDataBufferAllocate(int nline, int nsample, MTKt_DataType datatype, MTKt_DataBuffer *databuf)
Allocate Data Buffer.
#define DFACC_READ
Definition: hdf.h:44
char * filename
Definition: cdjpeg.h:133
MTKt_status MtkReadL2Land(const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Reads, unpacks and unscales any L2 Land grid/field from a MISR L2 AS Land product file...
Definition: MtkReadL2Land.c:39
MTKt_DataBufferType data
Definition: MisrUtil.h:104
intn GDclose(int32)
#define MTKT_MAPINFO_INIT
Definition: MisrMapQuery.h:79
EXTERNL int nc_get_att(int ncid, int varid, const char *name, void *ip)
MTKt_status MtkParseFieldname(const char *fieldname, char **basefieldname, int *ndim, int **dimlist)
Parses extra dimensions from fieldnames.
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
Map Information.
Definition: MisrMapQuery.h:65
MTKt_boolean
Definition: MisrError.h:6
2-dimensional Data Buffer
Definition: MisrUtil.h:98
MTKt_float ** f
Definition: MisrUtil.h:93
MTKt_status MtkReadL2LandNC(const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Definition: MtkReadL2Land.c:55
MTKt_status MtkReadL2LandNcid(int ncid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
#define NC_NOERR
Definition: netcdf.h:313
#define MTKT_DATABUFFER_INIT
Definition: MisrUtil.h:109
MTKt_status MtkReadL2LandHDF(const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Definition: MtkReadL2Land.c:93
EXTERNL int nc_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
MTKt_status MtkFillValueGetFid(int32 fid, const char *gridname, const char *fieldname, MTKt_DataBuffer *fillbuf)
Version of MtkFillValueGet that takes an HDF-EOS file ID rather than a filename.
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
EXTERNL int nc_inq_vartype(int ncid, int varid, nc_type *xtypep)
MTKt_DataType datatype
Definition: MisrUtil.h:102
MTKt_uint8 ** u8
Definition: MisrUtil.h:86
MTKt_status MtkReadL2LandFid(int32 fid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Version of MtkReadL2Land that takes and HDF-EOS file identifier rather than a filename.
HDFFCLIBAPI int32 float32 * max
MTKt_status MtkGridAttrGetFid(int32 fid, const char *gridname, const char *attrname, MTKt_DataBuffer *attrbuf)
Version of MtkFileGridAttrGet that takes an HDF-EOS file ID rather than a filename.
MTKt_uint16 ** u16
Definition: MisrUtil.h:88
#define NC_USHORT
Definition: netcdf.h:43
MTKt_status MtkReadRawNcid(int ncid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Version of MtkReadRaw that takes an HDF-EOS file identifier rather than a filename.
Definition: MtkReadRaw.c:248
#define NC_NOWRITE
Definition: netcdf.h:201
HDFFCLIBAPI intf void * scale
MTKt_status MtkReadRawFid(int32 fid, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Version of MtkReadRaw that takes an HDF-EOS file identifier rather than a filename.
Definition: MtkReadRaw.c:141
float MTKt_float
Definition: MisrUtil.h:76
#define MAXSTR
Definition: MisrUtil.h:28
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
HDFFCLIBAPI intf * offset
Region of interest.
Definition: MisrSetRegion.h:41
int32 GDopen(char *, intn)
EXTERNL int nc_close(int ncid)
MTKt_status MtkNCVarId(int Ncid, const char *Name, MTKt_ncvarid *Var)
Definition: MtkNCVarId.c:21
HDFFCLIBAPI void * min
EXTERNL int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
HDFFCLIBAPI _fcd field
EXTERNL int nc_open(const char *path, int mode, int *ncidp)
#define NC_UBYTE
Definition: netcdf.h:42
HDFFCLIBAPI intf * buf
#define FAIL
Definition: hdf.h:94

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