OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
rdsensorinfo.c
Go to the documentation of this file.
1 /* ========================================================== */
2 /* rdsensorinfo() - reads parameters from MSL12 sensor files */
3 /* */
4 /* Inputs: */
5 /* sensorID - sensor ID as defined in l12_parms.h */
6 /* pname - parameter name from sensor table */
7 /* */
8 /* Outputs: */
9 /* pval - pointer to scalar or array containing param */
10 /* */
11 /* Written By: */
12 /* B. Franz, October 2002 */
13 /* */
14 /* Converted to dynamic allocation, February 2013, BAF */
15 /* */
16 /* ========================================================== */
17 
18 #include <stdio.h>
19 #include <string.h>
20 #include <stdlib.h>
21 #include <ctype.h>
22 #include <math.h>
23 #include <sensorInfo.h>
24 #include <genutils.h>
25 
26 #define SENSOR_INFO_FILENAME "msl12_sensor_info.dat"
27 
28 // this is really defined in l2gen/l12_params.h
29 // but I need it here also.
30 #define NEWSENSINFO 32 /* use test sensor info file */
31 
32 void parseline(char *line, char *name, char *value) {
33  char *p;
34  char *p1;
35  char *p2;
36 
37  // Parse parameter name string
38 
39  p = strchr(line, '=');
40 
41  p1 = line;
42  while (isspace(*p1))
43  p1++;
44  p2 = p - 1;
45  while (isspace(*p2))
46  p2--;
47  strncpy(name, p1, p2 - p1 + 1);
48 
49  // Parse parameter value string
50 
51  p1 = p + 1;
52  while (isspace(*p1))
53  p1++;
54  p2 = p1;
55  while (!isspace(*p2))
56  p2++;
57  strncpy(value, p1, p2 - p1);
58 }
59 
69 int32_t rdsensorinfo(int32_t sensorID, int32_t evalmask, const char *pname,
70  void **pval) {
71  FILE *fp;
72  char *filedir;
73  char filename[FILENAME_MAX];
74  char prefix[FILENAME_MAX];
75  const char* subsensorDir;
76  char line[80];
77  char name[80];
78  char value[80];
79  char param[80];
80  char wparam[80];
81  char *p;
82  int i;
83  int status;
84 
85  static int32_t sensorID_s = -999;
86  static int32_t nbands = 0;
87  static int32_t nbandsir = 0;
88  static int32_t nbandsvis = 0;
89 
90  static int32_t *bindx;
91  static int32_t *iwave;
92  static float *fwave;
93  static float *Fo;
94  static float *Tau_r;
95  static float *k_oz;
96  static float *t_co2;
97  static float *k_no2;
98  static float *a_h2o;
99  static float *b_h2o;
100  static float *c_h2o;
101  static float *d_h2o;
102  static float *e_h2o;
103  static float *f_h2o;
104  static float *g_h2o;
105  static float *awhite;
106  static float *aw;
107  static float *bbw;
108  static float *wed;
109  static float *waph;
110 
111  static float *ooblw01;
112  static float *ooblw02;
113  static float *ooblw03;
114 
115  static float *oobwv01;
116  static float *oobwv02;
117  static float *oobwv03;
118  static float *oobwv04;
119  static float *oobwv05;
120  static float *oobwv06;
121  static float *oobwv07;
122  static float *oobwv08;
123  static float *oobwv09;
124  static float *oobwv10;
125  static float *oobwv11;
126  static float *oobwv12;
127 
128  if (sensorID != sensorID_s) {
129 
130  if (want_verbose)
131  printf("\nLoading characteristics for %s\n", sensorId2SensorName(sensorID));
132 
133  /* */
134  /* Locate atmocor datafile using environment variable */
135  /* */
136  if ((filedir = getenv("OCDATAROOT")) == NULL) {
137  printf("-E- %s: OCDATAROOT env variable undefined.\n", __FILE__);
138  return (-1);
139  }
140 
141  strcpy(prefix, filedir);
142  if ((evalmask & NEWSENSINFO) != 0)
143  strcat(prefix, "/eval/");
144  else
145  strcat(prefix, "/");
147  strcat(prefix, "/");
148 
149  fp = NULL;
150 
151  // first try in subsensor directory
153  if(subsensorDir) {
155  strcat(filename, subsensorDir);
156  strcat(filename, "/");
158  fp = fopen(filename, "r");
159  }
160 
161  // if needed look in the sensor directory
162  if(fp == NULL) {
165  if ((fp = fopen(filename, "r")) == NULL) {
166  fprintf(stderr, "-E- %s line %d: unable to open %s for reading\n",
167  __FILE__, __LINE__, filename);
168  return (-1);
169  }
170  }
171 
172  if (want_verbose)
173  printf("Opening sensor information file %s\n", filename);
174 
175  // read file to determine number of bands
176 
177  while (fgets(line, 80, fp)) {
178 
179  memset(name, '\0', sizeof (name));
180  memset(value, '\0', sizeof (value));
181 
182  // skip comment lines, empty lines, and lines without a name = value pair.
183 
184  if (line[0] == '#' || line[0] == '\n')
185  continue;
186  if (!(p = strchr(line, '=')))
187  continue;
188 
189  // parse parameter name and value, looking for Nbands
190 
192 
193  if (strcmp(name, "Nbands") == 0) {
194  nbands = (int32_t) atoi(value);
195  break;
196  }
197  }
198 
199  if (nbands <= 0) {
200  printf("-E- %s: error find Nbands in %s.\n", __FILE__, filename);
201  return (-1);
202  }
203 
204  // allocate space for static data
205 
206  status = 0;
207  if ((bindx = (int32_t*) calloc(nbands, sizeof (int32_t))) == NULL)
208  status = 1;
209  if ((iwave = (int32_t*) calloc(nbands, sizeof (int32_t))) == NULL)
210  status = 1;
211  if ((fwave = (float*) calloc(nbands, sizeof (float))) == NULL)
212  status = 1;
213  if ((Fo = (float*) calloc(nbands, sizeof (float))) == NULL)
214  status = 1;
215  if ((Tau_r = (float*) calloc(nbands, sizeof (float))) == NULL)
216  status = 1;
217  if ((k_oz = (float*) calloc(nbands, sizeof (float))) == NULL)
218  status = 1;
219  if ((awhite = (float*) calloc(nbands, sizeof (float))) == NULL)
220  status = 1;
221  if ((aw = (float*) calloc(nbands, sizeof (float))) == NULL)
222  status = 1;
223  if ((bbw = (float*) calloc(nbands, sizeof (float))) == NULL)
224  status = 1;
225  if ((wed = (float*) calloc(nbands, sizeof (float))) == NULL)
226  status = 1;
227  if ((waph = (float*) calloc(nbands, sizeof (float))) == NULL)
228  status = 1;
229  if ((a_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
230  status = 1;
231  if ((b_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
232  status = 1;
233  if ((c_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
234  status = 1;
235  if ((d_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
236  status = 1;
237  if ((e_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
238  status = 1;
239  if ((f_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
240  status = 1;
241  if ((g_h2o = (float*) calloc(nbands, sizeof (float))) == NULL)
242  status = 1;
243  if ((t_co2 = (float*) calloc(nbands, sizeof (float))) == NULL)
244  status = 1;
245  if ((k_no2 = (float*) calloc(nbands, sizeof (float))) == NULL)
246  status = 1;
247  if ((ooblw01 = (float*) calloc(nbands, sizeof (float))) == NULL)
248  status = 1;
249  if ((ooblw02 = (float*) calloc(nbands, sizeof (float))) == NULL)
250  status = 1;
251  if ((ooblw03 = (float*) calloc(nbands, sizeof (float))) == NULL)
252  status = 1;
253  if ((oobwv01 = (float*) calloc(nbands, sizeof (float))) == NULL)
254  status = 1;
255  if ((oobwv02 = (float*) calloc(nbands, sizeof (float))) == NULL)
256  status = 1;
257  if ((oobwv03 = (float*) calloc(nbands, sizeof (float))) == NULL)
258  status = 1;
259  if ((oobwv04 = (float*) calloc(nbands, sizeof (float))) == NULL)
260  status = 1;
261  if ((oobwv05 = (float*) calloc(nbands, sizeof (float))) == NULL)
262  status = 1;
263  if ((oobwv06 = (float*) calloc(nbands, sizeof (float))) == NULL)
264  status = 1;
265  if ((oobwv07 = (float*) calloc(nbands, sizeof (float))) == NULL)
266  status = 1;
267  if ((oobwv08 = (float*) calloc(nbands, sizeof (float))) == NULL)
268  status = 1;
269  if ((oobwv09 = (float*) calloc(nbands, sizeof (float))) == NULL)
270  status = 1;
271  if ((oobwv10 = (float*) calloc(nbands, sizeof (float))) == NULL)
272  status = 1;
273  if ((oobwv11 = (float*) calloc(nbands, sizeof (float))) == NULL)
274  status = 1;
275  if ((oobwv12 = (float*) calloc(nbands, sizeof (float))) == NULL)
276  status = 1;
277  if (status == 1) {
278  printf(
279  "-E- %s: error allocating space for %d bands in sensor info.\n",
280  __FILE__, nbands);
281  return (-1);
282  }
283 
284  // initialize non-zero output data
285 
286  for (i = 0; i < nbands; i++) {
287  bindx[i] = i; // don't delete yet
288  t_co2[i] = 1.0;
289  k_no2[i] = 1.0;
290  a_h2o[i] = 1.0;
291  // initialize water vap. correction coefficients if not specified in file
292  oobwv01[i] = 1;
293  }
294 
295  // Loop through each line of file looking for identifiers
296 
297  while (fgets(line, 80, fp)) {
298 
299  memset(name, '\0', sizeof (name));
300  memset(value, '\0', sizeof (value));
301 
302  // skip comment lines, empty lines, and lines without a name = value pair.
303 
304  if (line[0] == '#' || line[0] == '\n')
305  continue;
306  if (!(p = strchr(line, '=')))
307  continue;
308 
309  // parse parameter name and value
310 
312 
313  // Copy value to appropriate variable
314 
315  if (strcmp(name, "Nbands") == 0)
316  nbands = (int32_t) atoi(value);
317  else {
318  for (i = 0; i < nbands; i++) {
319  sprintf(param, "Lambda(%d)", i + 1);
320  if (strcmp(name, param) == 0) {
321  fwave[i] = (float) atof(value);
322  iwave[i] = (int32_t) roundf(fwave[i]);
323  break;
324  }
325  }
326  for (i = 0; i < nbands; i++) {
327  sprintf(param, "F0(%d)", i + 1);
328  sprintf(wparam, "F0(%d)", iwave[i]);
329  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
330  Fo[i] = (float) atof(value);
331  break;
332  }
333  sprintf(param, "Tau_r(%d)", i + 1);
334  sprintf(wparam, "Tau_r(%d)", iwave[i]);
335  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
336  Tau_r[i] = (float) atof(value);
337  break;
338  }
339  sprintf(param, "k_oz(%d)", i + 1);
340  sprintf(wparam, "k_oz(%d)", iwave[i]);
341  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
342  k_oz[i] = (float) atof(value);
343  break;
344  }
345  sprintf(param, "t_co2(%d)", i + 1);
346  sprintf(wparam, "t_co2(%d)", iwave[i]);
347  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
348  t_co2[i] = (float) atof(value);
349  break;
350  }
351  sprintf(param, "k_no2(%d)", i + 1);
352  sprintf(wparam, "k_no2(%d)", iwave[i]);
353  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
354  k_no2[i] = (float) atof(value);
355  break;
356  }
357 
358  sprintf(param, "a_h2o(%d)", i + 1);
359  sprintf(wparam, "a_h2o(%d)", iwave[i]);
360  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
361  a_h2o[i] = (float) atof(value);
362  break;
363  }
364  sprintf(param, "b_h2o(%d)", i + 1);
365  sprintf(wparam, "b_h2o(%d)", iwave[i]);
366  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
367  b_h2o[i] = (float) atof(value);
368  break;
369  }
370  sprintf(param, "c_h2o(%d)", i + 1);
371  sprintf(wparam, "c_h2o(%d)", iwave[i]);
372  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
373  c_h2o[i] = (float) atof(value);
374  break;
375  }
376  sprintf(param, "d_h2o(%d)", i + 1);
377  sprintf(wparam, "d_h2o(%d)", iwave[i]);
378  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
379  d_h2o[i] = (float) atof(value);
380  break;
381  }
382  sprintf(param, "e_h2o(%d)", i + 1);
383  sprintf(wparam, "e_h2o(%d)", iwave[i]);
384  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
385  e_h2o[i] = (float) atof(value);
386  break;
387  }
388  sprintf(param, "f_h2o(%d)", i + 1);
389  sprintf(wparam, "f_h2o(%d)", iwave[i]);
390  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
391  f_h2o[i] = (float) atof(value);
392  break;
393  }
394  sprintf(param, "g_h2o(%d)", i + 1);
395  sprintf(wparam, "g_h2o(%d)", iwave[i]);
396  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
397  g_h2o[i] = (float) atof(value);
398  break;
399  }
400  sprintf(param, "awhite(%d)", i + 1);
401  sprintf(wparam, "awhite(%d)", iwave[i]);
402  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
403  awhite[i] = (float) atof(value);
404  break;
405  }
406  sprintf(param, "aw(%d)", i + 1);
407  sprintf(wparam, "aw(%d)", iwave[i]);
408  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
409  aw[i] = (float) atof(value);
410  break;
411  }
412  sprintf(param, "bbw(%d)", i + 1);
413  sprintf(wparam, "bbw(%d)", iwave[i]);
414  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
415  bbw[i] = (float) atof(value);
416  break;
417  }
418  sprintf(param, "wed(%d)", i + 1);
419  sprintf(wparam, "wed(%d)", iwave[i]);
420  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
421  wed[i] = (float) atof(value);
422  break;
423  }
424  sprintf(param, "waph(%d)", i + 1);
425  sprintf(wparam, "waph(%d)", iwave[i]);
426  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
427  waph[i] = (float) atof(value);
428  break;
429  }
430 
431  sprintf(param, "ooblw01(%d)", i + 1);
432  sprintf(wparam, "ooblw01(%d)", iwave[i]);
433  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
434  ooblw01[i] = (float) atof(value);
435  break;
436  }
437  sprintf(param, "ooblw02(%d)", i + 1);
438  sprintf(wparam, "ooblw02(%d)", iwave[i]);
439  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
440  ooblw02[i] = (float) atof(value);
441  break;
442  }
443  sprintf(param, "ooblw03(%d)", i + 1);
444  sprintf(wparam, "ooblw03(%d)", iwave[i]);
445  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
446  ooblw03[i] = (float) atof(value);
447  break;
448  }
449 
450  sprintf(param, "oobwv01(%d)", i + 1);
451  sprintf(wparam, "oobwv01(%d)", iwave[i]);
452  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
453  oobwv01[i] = (float) atof(value);
454  break;
455  }
456  sprintf(param, "oobwv02(%d)", i + 1);
457  sprintf(wparam, "oobwv02(%d)", iwave[i]);
458  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
459  oobwv02[i] = (float) atof(value);
460  break;
461  }
462  sprintf(param, "oobwv03(%d)", i + 1);
463  sprintf(wparam, "oobwv03(%d)", iwave[i]);
464  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
465  oobwv03[i] = (float) atof(value);
466  break;
467  }
468  sprintf(param, "oobwv04(%d)", i + 1);
469  sprintf(wparam, "oobwv04(%d)", iwave[i]);
470  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
471  oobwv04[i] = (float) atof(value);
472  break;
473  }
474  sprintf(param, "oobwv05(%d)", i + 1);
475  sprintf(wparam, "oobwv05(%d)", iwave[i]);
476  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
477  oobwv05[i] = (float) atof(value);
478  break;
479  }
480  sprintf(param, "oobwv06(%d)", i + 1);
481  sprintf(wparam, "oobwv06(%d)", iwave[i]);
482  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
483  oobwv06[i] = (float) atof(value);
484  break;
485  }
486  sprintf(param, "oobwv07(%d)", i + 1);
487  sprintf(wparam, "oobwv07(%d)", iwave[i]);
488  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
489  oobwv07[i] = (float) atof(value);
490  break;
491  }
492  sprintf(param, "oobwv08(%d)", i + 1);
493  sprintf(wparam, "oobwv08(%d)", iwave[i]);
494  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
495  oobwv08[i] = (float) atof(value);
496  break;
497  }
498  sprintf(param, "oobwv09(%d)", i + 1);
499  sprintf(wparam, "oobwv09(%d)", iwave[i]);
500  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
501  oobwv09[i] = (float) atof(value);
502  break;
503  }
504  sprintf(param, "oobwv10(%d)", i + 1);
505  sprintf(wparam, "oobwv10(%d)", iwave[i]);
506  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
507  oobwv10[i] = (float) atof(value);
508  break;
509  }
510  sprintf(param, "oobwv11(%d)", i + 1);
511  sprintf(wparam, "oobwv11(%d)", iwave[i]);
512  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
513  oobwv11[i] = (float) atof(value);
514  break;
515  }
516  sprintf(param, "oobwv12(%d)", i + 1);
517  sprintf(wparam, "oobwv12(%d)", iwave[i]);
518  if (strcmp(name, param) == 0 || strcmp(name, wparam) == 0) {
519  oobwv12[i] = (float) atof(value);
520  break;
521  }
522 
523  }
524  }
525 
526  }
527 
528  /* */
529  /* Separate bands into reflected and emmissive and visible */
530  /* */
531  for (i = 0; i < nbands; i++)
532  if (iwave[i] > MINWAVE_IR)
533  break;
534 
535  nbandsir = nbands - i;
536  nbands = i;
537 
538  for (i = 0; i < nbands; i++)
539  if (iwave[i] > MAXWAVE_VIS)
540  break;
541 
542  nbandsvis = i;
543 
544  /* */
545  /* Write-out what was read, for informational purposes */
546  /* */
547  if (want_verbose) {
548 
549  printf(" %3s %5s %8s %8s %8s %8s %8s %8s %8s %8s\n", "Bnd", "Lam",
550  "Fo", "Tau_r", "k_oz", "k_no2", "t_co2", "awhite", "aw",
551  "bbw");
552  for (i = 0; i < nbands; i++)
553  printf(
554  " %3d %8.3f %8.3f %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e\n",
555  i, fwave[i], Fo[i], Tau_r[i], k_oz[i], k_no2[i],
556  t_co2[i], awhite[i], aw[i], bbw[i]);
557  printf("\n");
558 
559  if (nbandsir > 0) {
560  printf(" %3s %5s\n", "Bnd", "Lam");
561  for (i = 0; i < nbandsir; i++)
562  printf(" %3d %8.3f\n", i + nbands, fwave[i + nbands]);
563  }
564  printf("\n");
565  } // want_verbose
566  }
567 
568  /* */
569  /* Return a pointer to the requested parameter */
570  /* */
571  if (pval != NULL) {
572  if (strcmp(pname, "Nbands") == 0)
573  *pval = (void *) &nbands;
574  else if (strcmp(pname, "NbandsIR") == 0)
575  *pval = (void *) &nbandsir;
576  else if (strcmp(pname, "NbandsVIS") == 0)
577  *pval = (void *) &nbandsvis;
578  else if (strcmp(pname, "Bindx") == 0)
579  *pval = (void *) bindx;
580  else if (strcmp(pname, "fwave") == 0)
581  *pval = (void *) fwave;
582  else if (strcmp(pname, "iwave") == 0)
583  *pval = (void *) iwave;
584  else if (strcmp(pname, "Lambda") == 0)
585  *pval = (void *) iwave;
586  else if (strcmp(pname, "Fobar") == 0)
587  *pval = (void *) Fo;
588  else if (strcmp(pname, "Tau_r") == 0)
589  *pval = (void *) Tau_r;
590  else if (strcmp(pname, "k_oz") == 0)
591  *pval = (void *) k_oz;
592  else if (strcmp(pname, "t_co2") == 0)
593  *pval = (void *) t_co2;
594  else if (strcmp(pname, "k_no2") == 0)
595  *pval = (void *) k_no2;
596 
597  else if (strcmp(pname, "a_h2o") == 0)
598  *pval = (void *) a_h2o;
599  else if (strcmp(pname, "b_h2o") == 0)
600  *pval = (void *) b_h2o;
601  else if (strcmp(pname, "c_h2o") == 0)
602  *pval = (void *) c_h2o;
603  else if (strcmp(pname, "d_h2o") == 0)
604  *pval = (void *) d_h2o;
605  else if (strcmp(pname, "e_h2o") == 0)
606  *pval = (void *) e_h2o;
607  else if (strcmp(pname, "f_h2o") == 0)
608  *pval = (void *) f_h2o;
609  else if (strcmp(pname, "g_h2o") == 0)
610  *pval = (void *) g_h2o;
611 
612  else if (strcmp(pname, "awhite") == 0)
613  *pval = (void *) awhite;
614 
615  else if (strcmp(pname, "aw") == 0)
616  *pval = (void *) aw;
617  else if (strcmp(pname, "bbw") == 0)
618  *pval = (void *) bbw;
619 
620  else if (strcmp(pname, "wed") == 0)
621  *pval = (void *) wed;
622  else if (strcmp(pname, "waph") == 0)
623  *pval = (void *) waph;
624 
625  else if (strcmp(pname, "ooblw01") == 0)
626  *pval = (void *) ooblw01;
627  else if (strcmp(pname, "ooblw02") == 0)
628  *pval = (void *) ooblw02;
629  else if (strcmp(pname, "ooblw03") == 0)
630  *pval = (void *) ooblw03;
631 
632  else if (strcmp(pname, "oobwv01") == 0)
633  *pval = (void *) oobwv01;
634  else if (strcmp(pname, "oobwv02") == 0)
635  *pval = (void *) oobwv02;
636  else if (strcmp(pname, "oobwv03") == 0)
637  *pval = (void *) oobwv03;
638  else if (strcmp(pname, "oobwv04") == 0)
639  *pval = (void *) oobwv04;
640  else if (strcmp(pname, "oobwv05") == 0)
641  *pval = (void *) oobwv05;
642  else if (strcmp(pname, "oobwv06") == 0)
643  *pval = (void *) oobwv06;
644  else if (strcmp(pname, "oobwv07") == 0)
645  *pval = (void *) oobwv07;
646  else if (strcmp(pname, "oobwv08") == 0)
647  *pval = (void *) oobwv08;
648  else if (strcmp(pname, "oobwv09") == 0)
649  *pval = (void *) oobwv09;
650  else if (strcmp(pname, "oobwv10") == 0)
651  *pval = (void *) oobwv10;
652  else if (strcmp(pname, "oobwv11") == 0)
653  *pval = (void *) oobwv11;
654  else if (strcmp(pname, "oobwv12") == 0)
655  *pval = (void *) oobwv12;
656 
657  else
658  return (-1);
659  }
660 
661  sensorID_s = sensorID;
662 
663  if (pname != NULL) {
664  if (strcmp(pname, "NbandsIR") == 0)
665  return (nbandsir);
666  else if (strcmp(pname, "NbandsVIS") == 0)
667  return (nbandsvis);
668  else
669  return (nbands);
670  } else
671  return (nbands);
672 }
673 
int32 value
Definition: Granule.c:1235
const char * sensorId2SensorDir(int sensorId)
Definition: sensorInfo.c:240
const int bindx[3]
Definition: DbLutNetcdf.cpp:28
int status
Definition: l1_czcs_hdf.c:32
#define NULL
Definition: decode_rs.h:63
void parseline(char *line, char *name, char *value)
Definition: rdsensorinfo.c:32
int sensorId2SubsensorId(int sensorId)
Definition: sensorInfo.c:322
#define MAXWAVE_VIS
Definition: sensorDefs.h:51
int want_verbose
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
#define isspace(c)
int32_t rdsensorinfo(int32_t sensorID, int32_t evalmask, const char *pname, void **pval)
Definition: rdsensorinfo.c:69
int32_t nbands
const char * sensorId2SensorName(int sensorId)
Definition: sensorInfo.c:198
#define MINWAVE_IR
Definition: sensorDefs.h:52
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)
const char * subsensorId2SubsensorDir(int subsensorId)
Definition: sensorInfo.c:254
#define NEWSENSINFO
Definition: rdsensorinfo.c:30
int i
Definition: decode_rs.h:71
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
int32_t sensorID[MAXNFILES]
Definition: l2bin.cpp:97
float p[MODELMAX]
Definition: atrem_corl1.h:131
#define SENSOR_INFO_FILENAME
Definition: rdsensorinfo.c:26