OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
read_l3b_meta.c
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  File: getl3b.c
3 
4  Contents:
5  get_l3b_open - initializes and retrieves product-level metadata
6  and information that is required by getl3b_record
7  get_l3b_record - reads Level-3 binned data from nrec bins at a time
8  get_l3b_close - closes the product files; performs clean-up
9 
10  Notes:
11  o These routines must be called in order as listed above.
12  o get_l3b_record() may be called multiple times.
13  o I/O specifications document used - v3.2 (17 June 1994)
14 
15  Other relevant files:
16  seabin.h - various #defined constants for level 3 binned data
17  also #includes hdf.h
18  seaproto.h - prototypes for public level 3 output functions
19  seaprotoi.h - prototypes for low-layer level 3 output functions
20  l3b_misc.c - a lower layer of level 3 output functions
21 
22  Modification history:
23  Programmer Organization Date Description of change
24  -------------- ------------ -------- ---------------------
25  Lakshmi Kumar Hughes STX 11/22/93 Original development
26  Lakshmi Kumar Hughes STX 14/02/94 Added arguments bin_syear
27  bin_sday, bin_eyear,
28  bin_eday to get_l3b_open.
29  Lakshmi Kumar Hughes STX 04/12/94 Made some changes to
30  agree with specs sec 7.3.1
31  Lakshmi Kumar Hughes STX 07/01/94 Modified to reflect specs
32  v3.0 changes
33  Lakshmi Kumar Hughes STX 11/17/94 Added meta_l3b struct &
34  removed station (I/O Specs
35  v4.0)
36  Lakshmi Kumar Hughes STX 02/09/95 Added flag_use & eng_q_use
37  flds to get_l3b_open call
38  (Ref to I/O specs v4.2)
39  Lakshmi Kumar Hughes STX 05/18/95 Changed datatype of global
40  attribute "flag_use"
41  (Ref. V4.3 I/O Specs)
42  Added required code to
43  read start_num fld and
44  flags_set fld
45  Lakshmi Kumar HITC 05/25/95 Added code to read global
46  attribute "flag_names"
47  Lakshmi Kumar HSTX 09/25/95 Added "orbit" output argu-
48  ment to get_l3b_open call
49  (V4.4 I/O & V2.8 product
50  specs)
51  Lakshmi Kumar HSTX 10/27/95 Read "Start Orbit" and
52  "End Orbit" global attrs.
53  Lakshmi Kumar HSTX 03/18/96 Added "start_orbit" and
54  "infiles" output argumetns
55  Lakshmi Kumar HSTX 03/29/96 Added "meta_l3b" argument
56  to 'get_l3b_close' call
57  Lakshmi Kumar HSTX 04/30/96 Removed "meta_l3b" arg
58  from get_l3b_close and
59  changed all meta_l3b char
60  pointers to char arrays.
61  This change was done in
62  order to avoid Miami code
63  change, as Miami's code
64  does not use meta_l3b
65  struct.
66  Lakshmi Kumar Hughes STX 06/18/96 Changed defn. of MAX to
67  MAXVAL inorder to remove
68  compile time warning
69  Lakshmi Kumar HSTX 07/26/96 Changed meta_l3b arrays
70  sizes to handle larger
71  strings.
72  Lakshmi Kumar Hughes STX 10/11/96 Removed arg "orbit" &
73  added "end_orb" to
74  get_l3b_open call.
75  (Ref. V5.0 I/O specs)
76 
77  Joel Gales Futuretech 11/24/99 Modify to handle variable
78  products.
79 ------------------------------------------------------------------------------*/
80 
81 #include <math.h>
82 #include "netcdf.h"
83 #include "meta_l3b.h"
84 #include <sensorInfo.h>
85 #include <timeutils.h>
86 #include <genutils.h>
87 
88 #include <hdf.h>
89 #include <mfhdf.h>
90 
91 /*-----------------------------------------------------------------------------
92  Function: read_attrs
93 
94  Returns: int32_t (status)
95  The return code is a negative value if any error occurs, otherwise,
96  returns 0.
97 
98  Description:
99  The function read_attrs reads all the global attributes from the given
100  Bin file
101 
102  Parameters: (in calling order)
103  Type Name I/O Description
104  ---- ---- --- -----------
105  int32_t sdfid I ID req to access HDF SDS interface
106  meta_l3bType *meta_l3m O Product meta data passed to the calling
107  function
108  Modification history:
109  Programmer Organization Date Description of change
110  -------------- ------------ -------- ---------------------
111  Lakshmi Kumar Hughes STX 11/23/94 Original development
112 
113  Lakshmi Kumar Hughes STX 02/09/95 Added code to read global attrs -
114  flag_use and eng_q_use
115  (Ref to I/O specs v4.2)
116  Lakshmi Kumar Hughes STX 05/09/95 Changed datatype of global attr.
117  "flag_use" (ref. V4.3 I/O Specs)
118  Lakshmi Kumar Hughes STX 07/26/96 Added code to truncate the strings,
119  if the strings read are larger than
120  the space allocated in meta_l3b
121  structure
122  Joel Gales Futuretech 03/14/00 Read "Units" metadata attribute
123  Joel Gales Futuretech 06/27/11 Remove "Data Center", "Station",
124  "Station Lon/Lat"
125 ----------------------------------------------------------------------------*/
126 int32_t read_l3b_meta_hdf4(int32_t sdfid, meta_l3bType *meta_l3b) {
127  // first zero out the metadata
128  bzero(meta_l3b, sizeof (meta_l3bType));
129 
130  int32_t nt, count;
131  char *attr_buf;
132  if ((attr_buf = (char *) calloc(LG_ATTRSZ + 1, sizeof (char))) == NULL) {
133  printf("%s -Error: Cannot allocate memory for attribute buffer\n",
134  __FILE__);
135  exit(EXIT_FAILURE);
136  }
137 
138  char attr_name[128];
139  int32_t status;
140 
141  // fill in missing param values
142  strcpy(meta_l3b->data_center, "Unknown");
143  strcpy(meta_l3b->mission_char, "Unknown");
144  strcpy(meta_l3b->sensor_char, "Unknown");
145  strcpy(meta_l3b->station, "Unknown");
146  meta_l3b->station_lat = 0.0;
147  meta_l3b->station_lon = 0.0;
148  strcpy(meta_l3b->replace, "Unknown");
149  meta_l3b->orbit = -1;
150  meta_l3b->resolution = BAD_FLT;
151  strcpy(meta_l3b->binning_scheme, "Integerized Sinusoidal Grid");
152 
153  /**** read global attribute "product_name" */
154 
155  status = getattrsz(sdfid, "Product Name", &nt, &count);
156  if (status < 0) {
157  status = getattrsz(sdfid, "product_name", &nt, &count);
158  if (status < 0)
159  return FAIL;
160  else
161  strcpy(attr_name, "product_name");
162  } else {
163  strcpy(attr_name, "Product Name");
164  }
165 
166  if (count > SM_ATTRSZ) {
167  printf("\n****read_attrs: Attribute '%s'", attr_name);
168  printf(" size is greater than it is defined in meta_l3b ");
169  printf("\nstructure. Attr size read = %d\n", count);
170  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
171  return FAIL;
172  memcpy(meta_l3b->product_name, attr_buf, SM_ATTRSZ - 1);
173  meta_l3b->product_name[SM_ATTRSZ - 1] = 0;
174  } else {
175  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->product_name)) < 0)
176  return FAIL;
177  meta_l3b->product_name[count] = 0;
178  }
179 
180  /**** read global attribute "title" */
181  status = getattrsz(sdfid, "Title", &nt, &count);
182  if (status < 0) {
183  status = getattrsz(sdfid, "title", &nt, &count);
184  if (status < 0)
185  return FAIL;
186  else
187  strcpy(attr_name, "title");
188  } else {
189  strcpy(attr_name, "Title");
190  }
191 
192  if (count > SM_ATTRSZ) {
193  printf("\n****read_attrs: Attribute '%s'", attr_name);
194  printf(" size is greater than it is defined in meta_l3b ");
195  printf("\nstructure. Attr size read = %d\n", count);
196  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
197  return FAIL;
198  memcpy(meta_l3b->title, attr_buf, SM_ATTRSZ - 1);
199  meta_l3b->title[SM_ATTRSZ - 1] = 0;
200  } else {
201  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->title)) < 0)
202  return FAIL;
203  meta_l3b->title[count] = 0;
204  }
205 
206  /**** read global attribute "instrument" */
207  status = getattrsz(sdfid, "Sensor Name", &nt, &count);
208  if (status < 0) {
209  status = getattrsz(sdfid, "instrument", &nt, &count);
210  if (status < 0)
211  return FAIL;
212  else
213  strcpy(attr_name, "instrument");
214  } else {
215  strcpy(attr_name, "Sensor Name");
216  }
217 
218  if (count > SM_ATTRSZ) {
219  printf("\n****read_attrs: Attribute '%s'", attr_name);
220  printf(" size is greater than it is defined in meta_l3b ");
221  printf("\nstructure. Attr size read = %d\n", count);
222  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
223  return FAIL;
224  memcpy(meta_l3b->sensor_name, attr_buf, SM_ATTRSZ - 1);
225  meta_l3b->sensor_name[SM_ATTRSZ - 1] = 0;
226  } else {
227  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->sensor_name)) < 0)
228  return FAIL;
229  meta_l3b->sensor_name[count] = 0;
230  }
231 
232  // need to fill in the sensorID and sensor
233  meta_l3b->sensorID = sensorName2SensorId(meta_l3b->sensor_name);
234  if (meta_l3b->sensorID != -1)
235  strcpy(meta_l3b->sensor, sensorId2InstrumentName(meta_l3b->sensorID));
236  else
237  strcpy(meta_l3b->sensor, "Unknown");
238 
239  /**** read global attribute "units" */
240  status = getattrsz(sdfid, "Units", &nt, &count);
241  if (status < 0) {
242  status = getattrsz(sdfid, "units", &nt, &count);
243  if (status < 0)
244  return FAIL;
245  else
246  strcpy(attr_name, "units");
247  } else {
248  strcpy(attr_name, "Units");
249  }
250 
251  if (count > MD_ATTRSZ) {
252  printf("\n****read_attrs: Attribute '%s'", attr_name);
253  printf(" size is greater than it is defined in meta_l3b ");
254  printf("\nstructure. Attr size read = %d\n", count);
255  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
256  return FAIL;
257  memcpy(meta_l3b->units, attr_buf, MD_ATTRSZ - 1);
258  meta_l3b->units[MD_ATTRSZ - 1] = 0;
259  } else {
260  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->units)) < 0)
261  return FAIL;
262  meta_l3b->units[count] = 0;
263  }
264 
265  /**** read global attribute "platform" */
266  status = getattrsz(sdfid, "Mission", &nt, &count);
267  if (status < 0) {
268  status = getattrsz(sdfid, "platform", &nt, &count);
269  if (status < 0) {
270  count = -1;
271  } else {
272  strcpy(attr_name, "platform");
273  }
274  } else {
275  strcpy(attr_name, "Mission");
276  }
277 
278  if (count > SM_ATTRSZ) {
279  printf("\n****read_attrs: Attribute '%s'", attr_name);
280  printf(" size is greater than it is defined in meta_l3b ");
281  printf("\nstructure. Attr size read = %d\n", count);
282  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
283  return FAIL;
284  memcpy(meta_l3b->mission, attr_buf, SM_ATTRSZ - 1);
285  meta_l3b->mission[SM_ATTRSZ - 1] = 0;
286  } else {
287  if (count == -1) {
288  strcpy(meta_l3b->mission, "Unknown");
289  } else {
290  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->mission)) < 0)
291  return FAIL;
292  meta_l3b->mission[count] = 0;
293  }
294  }
295 
296  /**** read global attribute "temporal_range" */
297  status = getattrsz(sdfid, "Product Type", &nt, &count);
298  if (status < 0) {
299  status = getattrsz(sdfid, "temporal_range", &nt, &count);
300  if (status < 0)
301  return FAIL;
302  else
303  strcpy(attr_name, "temporal_range");
304  } else {
305  strcpy(attr_name, "Product Type");
306  }
307 
308  if (count > SM_ATTRSZ) {
309  printf("\n****read_attrs: Attribute '%s'", attr_name);
310  printf(" size is greater than it is defined in meta_l3b ");
311  printf("\nstructure. Attr size read = %d\n", count);
312  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
313  return FAIL;
314  memcpy(meta_l3b->prod_type, attr_buf, SM_ATTRSZ - 1);
315  meta_l3b->prod_type[SM_ATTRSZ - 1] = 0;
316  } else {
317  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->prod_type)) < 0)
318  return FAIL;
319  meta_l3b->prod_type[count] = 0;
320  }
321 
322  /**** read global attribute "processing_version" */
323  status = getattrsz(sdfid, "Processing Version", &nt, &count);
324  if (status < 0) {
325  status = getattrsz(sdfid, "processing_version", &nt, &count);
326  if (status < 0) {
327  count = -1;
328  } else {
329  strcpy(attr_name, "processing_version");
330  }
331 
332  } else {
333  strcpy(attr_name, "Processing Version");
334  }
335 
336  if (count > SM_ATTRSZ) {
337  printf("\n****read_attrs: Attribute '%s'", attr_name);
338  printf(" size is greater than it is defined in meta_l3b ");
339  printf("\nstructure. Attr size read = %d\n", count);
340  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
341  return FAIL;
342  memcpy(meta_l3b->pversion, attr_buf, SM_ATTRSZ - 1);
343  meta_l3b->pversion[SM_ATTRSZ - 1] = 0;
344  } else {
345  if (count == -1) {
346  strcpy(meta_l3b->pversion, "Unknown");
347  } else {
348  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->pversion)) < 0)
349  return FAIL;
350  meta_l3b->pversion[count] = 0;
351  }
352  }
353 
354  /**** read global attribute "date_created" */
355  status = getattrsz(sdfid, "Processing Time", &nt, &count);
356  if (status < 0) {
357  status = getattrsz(sdfid, "date_created", &nt, &count);
358  if (status < 0)
359  return FAIL;
360  else
361  strcpy(attr_name, "date_created");
362  } else {
363  strcpy(attr_name, "Processing Time");
364  }
365 
366  if (count > SM_ATTRSZ) {
367  printf("\n****read_attrs: Attribute '%s'", attr_name);
368  printf(" size is greater than it is defined in meta_l3b ");
369  printf("\nstructure. Attr size read = %d\n", count);
370  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
371  return FAIL;
372  memcpy(meta_l3b->ptime, attr_buf, SM_ATTRSZ - 1);
373  meta_l3b->ptime[SM_ATTRSZ - 1] = 0;
374  } else {
375  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->ptime)) < 0)
376  return FAIL;
377  meta_l3b->ptime[count] = 0;
378  }
379 
380  /**** read global attribute "history" */
381  status = getattrsz(sdfid, "Processing Control", &nt, &count);
382  if (status < 0) {
383  status = getattrsz(sdfid, "history", &nt, &count);
384  if (status < 0)
385  return FAIL;
386  else
387  strcpy(attr_name, "history");
388  } else {
389  strcpy(attr_name, "Processing Control");
390  }
391 
392  if (count > MD_ATTRSZ) {
393  printf("\n****read_attrs: Attribute '%s'", attr_name);
394  printf(" size is greater than it is defined in meta_l3b ");
395  printf("\nstructure. Attr size read = %d\n", count);
396  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
397  return FAIL;
398  memcpy(meta_l3b->proc_con, attr_buf, MD_ATTRSZ - 1);
399  meta_l3b->proc_con[MD_ATTRSZ - 1] = 0;
400  } else {
401  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->proc_con)) < 0)
402  return FAIL;
403  meta_l3b->proc_con[count] = 0;
404  }
405 
406  /**** read global attribute "l2_flag_names" */
407  status = getattrsz(sdfid, "L2 Flag Names", &nt, &count);
408  if (status >= 0) {
409  strcpy(attr_name, "L2 Flag Names");
410 
411  if (count > SM_ATTRSZ) {
412  printf("\n****read_attrs: Attribute '%s'", attr_name);
413  printf(" size is greater than it is defined in meta_l3b ");
414  printf("\nstructure. Attr size read = %d\n", count);
415  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
416  return FAIL;
417  memcpy(meta_l3b->flag_names, attr_buf, SM_ATTRSZ - 1);
418  meta_l3b->flag_names[SM_ATTRSZ - 1] = 0;
419  } else {
420  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->flag_names)) < 0)
421  return FAIL;
422  meta_l3b->flag_names[count] = 0;
423  }
424  }
425 
426  /**** read global attribute "time_coverage_start" */
427  status = getattrsz(sdfid, "Start Time", &nt, &count);
428  if (status < 0) {
429  status = getattrsz(sdfid, "time_coverage_start", &nt, &count);
430  if (status < 0)
431  return FAIL;
432  else
433  strcpy(attr_name, "time_coverage_start");
434  } else {
435  strcpy(attr_name, "Start Time");
436  }
437 
438  if (count > SM_ATTRSZ) {
439  printf("\n****read_attrs: Attribute '%s'", attr_name);
440  printf(" size is greater than it is defined in meta_l3b structure.");
441  return FAIL;
442  } else {
443  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
444  return FAIL;
445  if (strstr(attr_buf, "T") != NULL) {
446  meta_l3b->startTime = isodate2unix(attr_buf);
447  } else {
448  meta_l3b->startTime = zulu2unix(attr_buf);
449  }
450  }
451 
452  /**** read global attribute "time_coverage_end" */
453  status = getattrsz(sdfid, "End Time", &nt, &count);
454  if (status < 0) {
455  status = getattrsz(sdfid, "time_coverage_end", &nt, &count);
456  if (status < 0)
457  return FAIL;
458  else
459  strcpy(attr_name, "time_coverage_end");
460  } else {
461  strcpy(attr_name, "End Time");
462  }
463 
464  if (count > SM_ATTRSZ) {
465  printf("\n****read_attrs: Attribute '%s'", attr_name);
466  printf(" size is greater than it is defined in meta_l3b structure.");
467  return FAIL;
468  } else {
469  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
470  return FAIL;
471  if (strstr(attr_buf, "T") != NULL) {
472  meta_l3b->endTime = isodate2unix(attr_buf);
473  } else {
474  meta_l3b->endTime = zulu2unix(attr_buf);
475  }
476  }
477 
478  /**** read global attribute "start_orbit_number" */
479  if ((rdattr(sdfid, "Start Orbit", (VOIDP *) & meta_l3b->start_orb)) < 0)
480  if ((rdattr(sdfid, "start_orbit_number", (VOIDP *) & meta_l3b->start_orb))
481  < 0)
482  return FAIL;
483 
484  /**** read global attribute "end_orbit_number" */
485  if ((rdattr(sdfid, "End Orbit", (VOIDP *) & meta_l3b->end_orb)) < 0)
486  if ((rdattr(sdfid, "end_orbit_number", (VOIDP *) & meta_l3b->end_orb))
487  < 0)
488  return FAIL;
489 
490  /**** read global attribute "geospatial_lat_units" */
491  status = getattrsz(sdfid, "Latitude Units", &nt, &count);
492  if (status < 0) {
493  status = getattrsz(sdfid, "geospatial_lat_units", &nt, &count);
494  if (status < 0)
495  return FAIL;
496  else
497  strcpy(attr_name, "geospatial_lat_units");
498  } else {
499  strcpy(attr_name, "Latitude Units");
500  }
501 
502  if (count > SM_ATTRSZ) {
503  printf("\n****read_attrs: Attribute '%s'", attr_name);
504  printf(" size is greater than it is defined in meta_l3b ");
505  printf("\nstructure. Attr size read = %d\n", count);
506  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
507  return FAIL;
508  memcpy(meta_l3b->lat_units, attr_buf, SM_ATTRSZ - 1);
509  meta_l3b->lat_units[SM_ATTRSZ - 1] = 0;
510  } else {
511  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->lat_units)) < 0)
512  return FAIL;
513  meta_l3b->lat_units[count] = 0;
514  }
515 
516  /**** read global attribute "geospatial_lon_units" */
517  status = getattrsz(sdfid, "Longitude Units", &nt, &count);
518  if (status < 0) {
519  status = getattrsz(sdfid, "geospatial_lon_units", &nt, &count);
520  if (status < 0)
521  return FAIL;
522  else
523  strcpy(attr_name, "geospatial_lon_units");
524  } else {
525  strcpy(attr_name, "Longitude Units");
526  }
527 
528  if (count > SM_ATTRSZ) {
529  printf("\n****read_attrs: Attribute '%s'", attr_name);
530  printf(" size is greater than it is defined in meta_l3b ");
531  printf("\nstructure. Attr size read = %d\n", count);
532  if ((rdattr(sdfid, attr_name, (VOIDP *) attr_buf)) < 0)
533  return FAIL;
534  memcpy(meta_l3b->lon_units, attr_buf, SM_ATTRSZ - 1);
535  meta_l3b->lon_units[SM_ATTRSZ - 1] = 0;
536  } else {
537  if ((rdattr(sdfid, attr_name, (VOIDP *) meta_l3b->lon_units)) < 0)
538  return FAIL;
539  meta_l3b->lon_units[count] = 0;
540  }
541 
542  /**** read global attribute "data_bins" */
543  int32 tmpInt;
544  if ((rdattr(sdfid, "Data Bins", (VOIDP *) &tmpInt)) < 0)
545  if ((rdattr(sdfid, "data_bins", (VOIDP *) &tmpInt)) < 0)
546  return FAIL;
547  meta_l3b->data_bins = tmpInt;
548 
549  /**** read global attribute "percent_data_bins" */
550  if ((rdattr(sdfid, "Percent Data Bins", (VOIDP *) & meta_l3b->pct_databins))
551  < 0)
552  if ((rdattr(sdfid, "percent_data_bins",
553  (VOIDP *) & meta_l3b->pct_databins)) < 0)
554  return FAIL;
555 
556  /**** read global attribute "software_name" */
557  if ((getattrsz(sdfid, "Software Name", &nt, &count)) >= 0) {
558  if (count > SM_ATTRSZ) {
559  printf("\n****read_attrs: Attribute '%s'", "Software Name");
560  printf(" size is greater than it is defined in meta_l3b ");
561  printf("\nstructure. Attr size read = %d\n", count);
562  if ((rdattr(sdfid, "Software Name", (VOIDP *) attr_buf)) < 0)
563  return FAIL;
564  memcpy(meta_l3b->soft_name, attr_buf, SM_ATTRSZ - 1);
565  meta_l3b->soft_name[SM_ATTRSZ - 1] = 0;
566  } else {
567  if ((rdattr(sdfid, "Software Name", (VOIDP *) meta_l3b->soft_name))
568  < 0)
569  return FAIL;
570  meta_l3b->soft_name[count] = 0;
571  }
572  }
573 
574  /**** read global attribute "software_version" */
575  if ((getattrsz(sdfid, "Software Version", &nt, &count)) >= 0) {
576  if (count > SM_ATTRSZ) {
577  printf("\n****read_attrs: Attribute '%s'", "Software Version");
578  printf(" size is greater than it is defined in meta_l3b ");
579  printf("\nstructure. Attr size read = %d\n", count);
580  if ((rdattr(sdfid, "Software Version", (VOIDP *) attr_buf)) < 0)
581  return FAIL;
582  memcpy(meta_l3b->soft_ver, attr_buf, SM_ATTRSZ - 1);
583  meta_l3b->soft_ver[SM_ATTRSZ - 1] = 0;
584  } else {
585  if ((rdattr(sdfid, "Software Version", (VOIDP *) meta_l3b->soft_ver))
586  < 0)
587  return FAIL;
588  meta_l3b->soft_ver[count] = 0;
589  }
590  }
591 
592  /**** read global attribute "Input Files" */
593  if ((getattrsz(sdfid, "Input Files", &nt, &count)) >= 0) {
594  if (count > LG_ATTRSZ) {
595  printf("\n****read_attrs: Attribute '%s'", "Input Files");
596  printf(" size is greater than it is defined in meta_l3b ");
597  printf("\nstructure. Attr size read = %d\n", count);
598  if ((rdattr(sdfid, "Input Files", (VOIDP *) attr_buf)) < 0)
599  return FAIL;
600  memcpy(meta_l3b->infiles, attr_buf, LG_ATTRSZ - 1);
601  meta_l3b->infiles[LG_ATTRSZ - 1] = 0;
602  } else {
603  if ((rdattr(sdfid, "Input Files", (VOIDP *) meta_l3b->infiles)) < 0)
604  return FAIL;
605  meta_l3b->infiles[count] = 0;
606  }
607  }
608 
609  /**** read global attribute "input_parameters" */
610  if ((getattrsz(sdfid, "Input Parameters", &nt, &count)) >= 0) {
611  if (count > LG_ATTRSZ) {
612  printf("\n****read_attrs: Attribute '%s'", "Input Parameters");
613  printf(" size is greater than it is defined in meta_l3b ");
614  printf("\nstructure. Attr size read = %d\n", count);
615  if ((rdattr(sdfid, "Input Parameters", (VOIDP *) attr_buf)) < 0)
616  return FAIL;
617  memcpy(meta_l3b->input_parms, attr_buf, LG_ATTRSZ - 1);
618  meta_l3b->input_parms[LG_ATTRSZ - 1] = 0;
619  } else {
620  if ((rdattr(sdfid, "Input Parameters",
621  (VOIDP *) meta_l3b->input_parms)) < 0)
622  return FAIL;
623  meta_l3b->input_parms[count] = 0;
624  }
625  }
626 
627  /**** read global attribute "Northernmost Latitude" */
628  if ((getattrsz(sdfid, "Northernmost Latitude", &nt, &count) == 0)) {
629  if ((rdattr(sdfid, "Northernmost Latitude", (VOIDP *) & meta_l3b->north)) < 0)
630  return FAIL;
631  }
632  /**** read global attribute "Southernmost Latitud" */
633  if ((getattrsz(sdfid, "Southernmost Latitude", &nt, &count) == 0)) {
634  if ((rdattr(sdfid, "Southernmost Latitude", (VOIDP *) & meta_l3b->south)) < 0)
635  return FAIL;
636  }
637  /**** read global attribute "Easternmost Longitude" */
638  if ((getattrsz(sdfid, "Easternmost Longitude", &nt, &count) == 0)) {
639  if ((rdattr(sdfid, "Easternmost Longitude", (VOIDP *) & meta_l3b->east)) < 0)
640  return FAIL;
641  }
642  /**** read global attribute "Westernmost Longitude" */
643  if ((getattrsz(sdfid, "Westernmost Longitude", &nt, &count) == 0)) {
644  if ((rdattr(sdfid, "Westernmost Longitude", (VOIDP *) & meta_l3b->west)) < 0)
645  return FAIL;
646  }
647 
648  /**** read global attribute "Bin Resolution" */
649  if ((getattrsz(sdfid, "Bin Resolution", &nt, &count)) >= 0) {
650  if ((rdattr(sdfid, "Bin Resolution",
651  (VOIDP *) attr_buf)) < 0)
652  return FAIL;
653  meta_l3b->resolution = str2resolution(attr_buf);
654  }
655 
656  /**** read global attribute "Bin Scheme" */
657  if ((getattrsz(sdfid, "Binning Scheme", &nt, &count)) >= 0) {
658  if (count > SM_ATTRSZ) {
659  printf("\n****read_attrs: Attribute '%s'", "Binning Scheme");
660  printf(" size is greater than it is defined in meta_l3b ");
661  printf("\nstructure. Attr size read = %d\n", count);
662  if ((rdattr(sdfid, "Binning Scheme", (VOIDP *) attr_buf)) < 0)
663  return FAIL;
664  memcpy(meta_l3b->binning_scheme, attr_buf, SM_ATTRSZ - 1);
665  meta_l3b->binning_scheme[SM_ATTRSZ - 1] = 0;
666  } else {
667  if ((rdattr(sdfid, "Binning Scheme",
668  (VOIDP *) meta_l3b->binning_scheme)) < 0)
669  return FAIL;
670  meta_l3b->binning_scheme[count] = 0;
671  }
672  }
673 
674  free(attr_buf);
675  return SUCCEED;
676 }
677 
678 /*-----------------------------------------------------------------------------
679  Function: rdattr
680 
681  Returns: int32_t (status)
682  The return code is a negative value if any error occurs, otherwise,
683  returns 0.
684 
685  Description:
686  The function rdattr reads the requested global attribute
687 
688  Parameters: (in calling order)
689  Type Name I/O Description
690  ---- ---- --- -----------
691  int32_t sdfid I ID req to access HDF SDS interface
692  char * attr_name I attribute name
693  void * buf I/O pointer to data buffer
694 
695  Modification history:
696  Programmer Organization Date Description of change
697  -------------- ------------ -------- ---------------------
698  Lakshmi Kumar Hughes STX 11/07/94 Original development
699  Joel Gales Futuretech 06/24/13 Add support for NETCDF4
700 
701 ----------------------------------------------------------------------------*/
702 
703 int32_t rdattr(int32_t sdfid, char *attr_name, void *buf) {
704  int32_t attrnum;
705  int status;
706 
707  if (sdfid > 0) {
708  attrnum = SDfindattr(sdfid, attr_name);
709  if ((SDreadattr(sdfid, attrnum, buf)) < 0)
710  return FAIL;
711  } else {
712  status = nc_get_att(-sdfid, NC_GLOBAL, attr_name, buf);
713  if (status != NC_NOERR)
714  return FAIL;
715  }
716 
717  return SUCCEED;
718 }
719 
720 /*-----------------------------------------------------------------------------
721  Function: getattrsz
722 
723  Returns: int32_t (status)
724  The return code is a negative value if any error occurs, otherwise,
725  returns 0.
726 
727  Description:
728  The function getattrsz passes the requested global attribute's
729  number type (data type) and the number of values
730 
731  Parameters: (in calling order)
732  Type Name I/O Description
733  ---- ---- --- -----------
734  int32_t sdfid I ID req to access HDF SDS interface
735  char * attr_name I attribute name
736  int32_t * nt O HDF data type
737  int32_t * count O number of values in the specified attribute
738 
739  Modification history:
740  Programmer Organization Date Description of change
741  -------------- ------------ -------- ---------------------
742  Lakshmi Kumar Hughes STX 11/07/94 Original development
743  Joel Gales Futuretech 06/24/13 Add support for NETCDF4
744 
745 ----------------------------------------------------------------------------*/
746 
747 int32_t getattrsz(int32_t id, char *attr_name, int32_t *nt, int32_t *count) {
748  int32_t attrnum;
749  char name[SM_ATTRSZ];
750  int status;
751  size_t cnt;
752 
753  if (id > 0) {
754  attrnum = SDfindattr(id, attr_name);
755  if ((SDattrinfo(id, attrnum, name, nt, count)) < 0)
756  return FAIL;
757  } else {
758 
759  status = nc_inq_attlen(-id, NC_GLOBAL, attr_name, &cnt);
760  *count = cnt;
761  if (status != NC_NOERR)
762  return FAIL;
763  }
764  return SUCCEED;
765 }
766 
767 int32_t read_l3b_meta_hdf5(hid_t grp0, meta_l3bType *meta_l3b) {
768  // first zero out the metadata
769  bzero(meta_l3b, sizeof (meta_l3bType));
770 
771  hid_t attr;
772  hid_t atype = H5Tcopy(H5T_C_S1);
773  char *attr_buf;
774  if ((attr_buf = (char *) calloc(MAX_ORDER + 1, sizeof (char))) == NULL) {
775  printf("%s -Error: Cannot allocate memory for attribute buffer\n",
776  __FILE__);
777  exit(EXIT_FAILURE);
778  }
779 
780  // fill in missing values
781  strcpy(meta_l3b->data_center, "Unknown");
782  strcpy(meta_l3b->sensor_char, "Unknown");
783  strcpy(meta_l3b->station, "Unknown");
784  meta_l3b->station_lat = 0.0;
785  meta_l3b->station_lon = 0.0;
786  strcpy(meta_l3b->units, "Unknown");
787  strcpy(meta_l3b->prod_type, "Unknown");
788  strcpy(meta_l3b->replace, "Unknown");
789  strcpy(meta_l3b->input_parms, "Unknown");
790  strcpy(meta_l3b->flag_names, "Unknown");
791  strcpy(meta_l3b->infiles, "Unknown");
792  meta_l3b->orbit = -1;
793  meta_l3b->start_orb = -1;
794  meta_l3b->end_orb = -1;
795  strcpy(meta_l3b->binning_scheme, "Unknown");
796  meta_l3b->resolution = BAD_FLT;
797 
798  attr = H5Aopen_name(grp0, "Product Name");
799  H5Tset_size(atype, SM_ATTRSZ);
800  H5Aread(attr, atype, &meta_l3b->product_name);
801  H5Aclose(attr);
802 
803  attr = H5Aopen_name(grp0, "Title");
804  H5Tset_size(atype, SM_ATTRSZ);
805  H5Aread(attr, atype, &meta_l3b->title);
806  H5Aclose(attr);
807 
808  attr = H5Aopen_name(grp0, "Sensor");
809  H5Tset_size(atype, SM_ATTRSZ);
810  H5Aread(attr, atype, &meta_l3b->sensor_name);
811  H5Aclose(attr);
812 
813  attr = H5Aopen_name(grp0, "Sensor Characteristics");
814  H5Tset_size(atype, SM_ATTRSZ);
815  H5Aread(attr, atype, &meta_l3b->sensor_char);
816  H5Aclose(attr);
817 
818  // need to fill in the sensorID and sensor
819  meta_l3b->sensorID = sensorName2SensorId(meta_l3b->sensor_name);
820  if (meta_l3b->sensorID != -1)
821  strcpy(meta_l3b->sensor, sensorId2InstrumentName(meta_l3b->sensorID));
822  else
823  strcpy(meta_l3b->sensor, "Unknown");
824 
825  attr = H5Aopen_name(grp0, "Mission");
826  if (attr == -1)
827  attr = H5Aopen_name(grp0, "mission");
828  H5Tset_size(atype, SM_ATTRSZ);
829  H5Aread(attr, atype, &meta_l3b->mission);
830  H5Aclose(attr);
831 
832  attr = H5Aopen_name(grp0, "Mission Characteristics");
833  H5Tset_size(atype, SM_ATTRSZ);
834  H5Aread(attr, atype, &meta_l3b->mission_char);
835  H5Aclose(attr);
836 
837  meta_l3b->sensorID = sensorName2SensorId(meta_l3b->sensor);
838 
839  attr = H5Aopen_name(grp0, "Processing Version");
840  H5Tset_size(atype, SM_ATTRSZ);
841  H5Aread(attr, atype, &meta_l3b->pversion);
842  H5Aclose(attr);
843 
844  attr = H5Aopen_name(grp0, "Software Name");
845  H5Tset_size(atype, SM_ATTRSZ);
846  H5Aread(attr, atype, &meta_l3b->soft_name);
847  H5Aclose(attr);
848 
849  attr = H5Aopen_name(grp0, "Software ID");
850  H5Tset_size(atype, SM_ATTRSZ);
851  H5Aread(attr, atype, &meta_l3b->soft_ver);
852  H5Aclose(attr);
853 
854  attr = H5Aopen_name(grp0, "Processing Time");
855  H5Tset_size(atype, SM_ATTRSZ);
856  H5Aread(attr, atype, &meta_l3b->ptime);
857  H5Aclose(attr);
858 
859  attr = H5Aopen_name(grp0, "Processing Control");
860  H5Tset_size(atype, MD_ATTRSZ);
861  H5Aread(attr, atype, &meta_l3b->proc_con);
862  H5Aclose(attr);
863 
864  attr = H5Aopen_name(grp0, "L2 Flag Names");
865  H5Tset_size(atype, MD_ATTRSZ);
866  H5Aread(attr, atype, &meta_l3b->flag_names);
867  H5Aclose(attr);
868 
869  attr = H5Aopen_name(grp0, "Start Orbit");
870  H5Aread(attr, H5T_STD_U32LE, &meta_l3b->start_orb);
871  H5Aclose(attr);
872 
873  attr = H5Aopen_name(grp0, "End Orbit");
874  H5Aread(attr, H5T_STD_U32LE, &meta_l3b->end_orb);
875  H5Aclose(attr);
876 
877  attr = H5Aopen_name(grp0, "Start Time");
878  H5Tset_size(atype, SM_ATTRSZ);
879  H5Aread(attr, atype, attr_buf);
880  H5Aclose(attr);
881  meta_l3b->startTime = zulu2unix(attr_buf);
882 
883  attr = H5Aopen_name(grp0, "End Time");
884  H5Tset_size(atype, SM_ATTRSZ);
885  H5Aread(attr, atype, attr_buf);
886  H5Aclose(attr);
887  meta_l3b->endTime = zulu2unix(attr_buf);
888 
889  attr = H5Aopen_name(grp0, "Latitude Units");
890  H5Tset_size(atype, SM_ATTRSZ);
891  H5Aread(attr, atype, &meta_l3b->lat_units);
892  H5Aclose(attr);
893 
894  attr = H5Aopen_name(grp0, "Longitude Units");
895  H5Tset_size(atype, SM_ATTRSZ);
896  H5Aread(attr, atype, &meta_l3b->lon_units);
897  H5Aclose(attr);
898 
899  attr = H5Aopen_name(grp0, "Data Bins");
900  int32 tmpInt;
901  H5Aread(attr, H5T_STD_U32LE, &tmpInt);
902  H5Aclose(attr);
903  meta_l3b->data_bins = tmpInt;
904 
905  attr = H5Aopen_name(grp0, "Percent Data Bins");
906  H5Aread(attr, H5T_NATIVE_FLOAT, &meta_l3b->pct_databins);
907  H5Aclose(attr);
908 
909  attr = H5Aopen_name(grp0, "Northernmost Latitude");
910  H5Aread(attr, H5T_NATIVE_FLOAT, &meta_l3b->north);
911  H5Aclose(attr);
912 
913  attr = H5Aopen_name(grp0, "Southernmost Latitude");
914  H5Aread(attr, H5T_NATIVE_FLOAT, &meta_l3b->south);
915  H5Aclose(attr);
916 
917  attr = H5Aopen_name(grp0, "Easternmost Longitude");
918  H5Aread(attr, H5T_NATIVE_FLOAT, &meta_l3b->east);
919  H5Aclose(attr);
920 
921  attr = H5Aopen_name(grp0, "Westernmost Longitude");
922  H5Aread(attr, H5T_NATIVE_FLOAT, &meta_l3b->west);
923  H5Aclose(attr);
924 
925  H5Tclose(atype);
926  free(attr_buf);
927  return SUCCEED;
928 }
929 
930 int32_t read_l3b_meta_netcdf4(int ncid, meta_l3bType *meta_l3b) {
931  // first zero out the metadata
932  bzero(meta_l3b, sizeof (meta_l3bType));
933 
934  char *attr_buf;
935  if ((attr_buf = (char *) calloc(MAX_ORDER + 1, sizeof (char))) == NULL) {
936  printf("%s -Error: Cannot allocate memory for attribute buffer\n",
937  __FILE__);
938  exit(EXIT_FAILURE);
939  }
940 
941  // fill in missing values
942  strcpy(meta_l3b->data_center, "Unknown");
943  strcpy(meta_l3b->mission_char, "Unknown");
944  strcpy(meta_l3b->sensor_char, "Unknown");
945  strcpy(meta_l3b->station, "Unknown");
946  meta_l3b->station_lat = 0.0;
947  meta_l3b->station_lon = 0.0;
948  strcpy(meta_l3b->replace, "Unknown");
949  meta_l3b->orbit = -1;
950  meta_l3b->resolution = BAD_FLT;
951 
952  nc_get_att(ncid, NC_GLOBAL, "product_name", &meta_l3b->product_name);
953  nc_get_att(ncid, NC_GLOBAL, "title", &meta_l3b->title);
954  nc_get_att(ncid, NC_GLOBAL, "instrument", &meta_l3b->sensor);
955  nc_get_att(ncid, NC_GLOBAL, "platform", &meta_l3b->mission);
956 
957  // create sensor_name
958  meta_l3b->sensorID = instrumentPlatform2SensorId(meta_l3b->sensor,
959  meta_l3b->mission);
960  if (meta_l3b->sensorID == -1)
961  meta_l3b->sensorID = OCRVC;
962  strcpy(meta_l3b->sensor_name, sensorId2SensorName(meta_l3b->sensorID));
963 
964  nc_get_att(ncid, NC_GLOBAL, "units", &meta_l3b->units);
965  nc_get_att(ncid, NC_GLOBAL, "temporal_range", &meta_l3b->prod_type);
966  nc_get_att(ncid, NC_GLOBAL, "processing_version", &meta_l3b->pversion);
967  nc_get_att(ncid, NC_GLOBAL, "date_created", &meta_l3b->ptime);
968  nc_get_att(ncid, NC_GLOBAL, "history", &meta_l3b->proc_con);
969  nc_get_att(ncid, NC_GLOBAL, "time_coverage_start", attr_buf);
970  meta_l3b->startTime = isodate2unix(attr_buf);
971  nc_get_att(ncid, NC_GLOBAL, "time_coverage_end", attr_buf);
972  meta_l3b->endTime = isodate2unix(attr_buf);
973 
974  nc_get_att(ncid, NC_GLOBAL, "start_orbit_number", &meta_l3b->start_orb);
975  nc_get_att(ncid, NC_GLOBAL, "end_orbit_number", &meta_l3b->end_orb);
976 
977  nc_get_att(ncid, NC_GLOBAL, "northernmost_latitude", &meta_l3b->north);
978  nc_get_att(ncid, NC_GLOBAL, "southernmost_latitude", &meta_l3b->south);
979  nc_get_att(ncid, NC_GLOBAL, "easternmost_longitude", &meta_l3b->east);
980  nc_get_att(ncid, NC_GLOBAL, "westernmost_longitude", &meta_l3b->west);
981  nc_get_att_long(ncid, NC_GLOBAL, "data_bins", (long*)&meta_l3b->data_bins);
982  nc_get_att(ncid, NC_GLOBAL, "percent_data_bins", &meta_l3b->pct_databins);
983  nc_get_att(ncid, NC_GLOBAL, "binning_scheme", &meta_l3b->binning_scheme);
984 
985  nc_type attType;
986  nc_inq_atttype(ncid, NC_GLOBAL, "geospatial_lon_resolution", &attType);
987  if(attType==NC_DOUBLE) {
988  double val;
989  nc_get_att(ncid, NC_GLOBAL, "geospatial_lon_resolution", &val);
990  meta_l3b->resolution = degrees2resolution(val);
991  } else {
992  nc_get_att(ncid, NC_GLOBAL, "geospatial_lon_resolution", attr_buf);
993  meta_l3b->resolution = str2resolution(attr_buf);
994  }
995 
996  nc_get_att(ncid, NC_GLOBAL, "geospatial_lat_units", &meta_l3b->lat_units);
997  nc_get_att(ncid, NC_GLOBAL, "geospatial_lon_units", &meta_l3b->lon_units);
998 
999  nc_get_att(ncid, NC_GLOBAL, "identifier_product_doi", &meta_l3b->doi);
1000  nc_get_att(ncid, NC_GLOBAL, "keywords", &meta_l3b->keywords);
1001 
1002  int grp_id;
1003  nc_inq_grp_ncid(ncid, "processing_control", &grp_id);
1004  nc_get_att(grp_id, NC_GLOBAL, "software_name", &meta_l3b->soft_name);
1005  nc_get_att(grp_id, NC_GLOBAL, "software_version", &meta_l3b->soft_ver);
1006  nc_get_att(grp_id, NC_GLOBAL, "source", &meta_l3b->infiles);
1007  nc_get_att(grp_id, NC_GLOBAL, "l2_flag_names", meta_l3b->flag_names);
1008 
1009  // get input parameters
1010  int grp_id2;
1011  int i;
1012  int numParams = 0;
1013  char attName[1024];
1014  meta_l3b->input_parms[0] = 0;
1015  i = nc_inq_grp_ncid(grp_id, "input_parameters", &grp_id2);
1016  nc_inq_natts(grp_id2, &numParams);
1017  for (i = 0; i < numParams; i++) {
1018  nc_inq_attname(grp_id2, NC_GLOBAL, i, attName);
1019  nc_get_att(grp_id2, NC_GLOBAL, attName, attr_buf);
1020  strcat(meta_l3b->input_parms, attName);
1021  strcat(meta_l3b->input_parms, " = ");
1022  strcat(meta_l3b->input_parms, attr_buf);
1023  strcat(meta_l3b->input_parms, "\n");
1024  }
1025 
1026  free(attr_buf);
1027  return SUCCEED;
1028 }
char product_name[SM_ATTRSZ]
Definition: meta_l3b.h:16
char replace[SM_ATTRSZ]
Definition: meta_l3b.h:31
char units[MD_ATTRSZ]
Definition: meta_l3b.h:28
char binning_scheme[SM_ATTRSZ]
Definition: meta_l3b.h:48
int status
Definition: l1_czcs_hdf.c:32
int instrumentPlatform2SensorId(const char *instrument, const char *platform)
Definition: sensorInfo.c:302
int32_t read_l3b_meta_netcdf4(int ncid, meta_l3bType *meta_l3b)
char station[SM_ATTRSZ]
Definition: meta_l3b.h:25
char infiles[LG_ATTRSZ]
Definition: meta_l3b.h:38
#define FAIL
Definition: ObpgReadGrid.h:18
#define NULL
Definition: decode_rs.h:63
char mission[SM_ATTRSZ]
Definition: meta_l3b.h:21
char keywords[SM_ATTRSZ]
Definition: meta_l3b.h:55
char sensor_char[SM_ATTRSZ]
Definition: meta_l3b.h:24
int32_t start_orb
Definition: meta_l3b.h:42
char input_parms[LG_ATTRSZ]
Definition: meta_l3b.h:36
int sensorName2SensorId(const char *name)
Definition: sensorInfo.c:268
char flag_names[SM_ATTRSZ]
Definition: meta_l3b.h:37
void bzero()
float station_lon
Definition: meta_l3b.h:27
char sensor[SM_ATTRSZ]
Definition: meta_l3b.h:23
char lon_units[SM_ATTRSZ]
Definition: meta_l3b.h:45
double zulu2unix(char *zulu)
Definition: zulu2unix.c:3
double endTime
Definition: meta_l3b.h:40
char prod_type[SM_ATTRSZ]
Definition: meta_l3b.h:29
int32_t getattrsz(int32_t id, char *attr_name, int32_t *nt, int32_t *count)
double degrees2resolution(double degrees)
Pixel resolution degrees to meters.
char data_center[SM_ATTRSZ]
Definition: meta_l3b.h:20
double resolution
Definition: meta_l3b.h:53
float north
Definition: meta_l3b.h:49
int32_t read_l3b_meta_hdf4(int32_t sdfid, meta_l3bType *meta_l3b)
char title[SM_ATTRSZ]
Definition: meta_l3b.h:17
float west
Definition: meta_l3b.h:52
int sensorID
Definition: meta_l3b.h:18
char doi[SM_ATTRSZ]
Definition: meta_l3b.h:54
int32_t orbit
Definition: meta_l3b.h:41
char lat_units[SM_ATTRSZ]
Definition: meta_l3b.h:44
#define BAD_FLT
Definition: jplaeriallib.h:19
float south
Definition: meta_l3b.h:50
char proc_con[MD_ATTRSZ]
Definition: meta_l3b.h:35
const char * sensorId2SensorName(int sensorId)
Definition: sensorInfo.c:198
#define MD_ATTRSZ
Definition: meta_l3b.h:8
double startTime
Definition: meta_l3b.h:39
char soft_ver[SM_ATTRSZ]
Definition: meta_l3b.h:33
const char * sensorId2InstrumentName(int sensorId)
Definition: sensorInfo.c:212
char mission_char[SM_ATTRSZ]
Definition: meta_l3b.h:22
float pct_databins
Definition: meta_l3b.h:47
int32_t read_l3b_meta_hdf5(hid_t grp0, meta_l3bType *meta_l3b)
char ptime[SM_ATTRSZ]
Definition: meta_l3b.h:34
char pversion[SM_ATTRSZ]
Definition: meta_l3b.h:30
float east
Definition: meta_l3b.h:51
#define OCRVC
Definition: sensorDefs.h:24
int64_t data_bins
Definition: meta_l3b.h:46
char sensor_name[SM_ATTRSZ]
Definition: meta_l3b.h:19
int i
Definition: decode_rs.h:71
msiBandIdx val
Definition: l1c_msi.cpp:34
#define SM_ATTRSZ
Definition: meta_l3b.h:7
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define LG_ATTRSZ
Definition: meta_l3b.h:9
int32_t end_orb
Definition: meta_l3b.h:43
char soft_name[SM_ATTRSZ]
Definition: meta_l3b.h:32
double str2resolution(char const *resolutionStr)
Pixel resolution string to meters.
float station_lat
Definition: meta_l3b.h:26
int32_t rdattr(int32_t sdfid, char *attr_name, void *buf)
double isodate2unix(const char *isodate)
Definition: unix2isodate.c:61
int count
Definition: decode_rs.h:79