OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
put_l3m.c
Go to the documentation of this file.
1 #include <ctype.h>
2 #include "map.h"
3 #include "mapattr.h"
4 #include "meta_l3b.h"
5 #include "mapproto_o.h"
6 #include "maplists.h"
7 #include <palette.h>
8 
9 #include <math.h>
10 
11 #define VERSION "1.0"
12 
13 #define max(A, B) ((A) > (B) ? (A) : (B))
14 #define min(A, B) ((A) > (B) ? (B) : (A))
15 
16 /*-----------------------------------------------------------------------------
17 
18  Function: put_l3m
19 
20  Returns: intn (status)
21  The return code is
22  FAIL (-1) If an I/O error occurs.
23  NOMATCH_ERR (-2) The routine checks l3m_name to find out for
24  which parameter the data is being written.
25  It tries to match a substring of the paramter
26  name with given l3m_name. If no match occurs
27  it returns NOMATCH_ERR (-2).
28  SUCCEED (0) If no errors occur.
29 
30  Description:
31  The function put_l3m.c creates a level 3 Standard Map Image (SMI)
32  file with the file name given by l3m_path. Level 3 SMI file meta
33  data, palette, and data will be written. See "INTERFACE SPECIFICATIONS
34  FOR SeaWiFS OPERATIONAL PRODUCT INPUT AND OUTPUT AND SENSOR CALIBRATION
35  SOFTWARE", v3.3, dated 12th July 94, (By Fred Patt, Jim Firestone,
36  and Mike Darzi) and "SeaWiFS OPERATIONAL ARCHIVE PRODUCT
37  SPECIFICATIONS, v1.0 (Incomplete DRAFT version), dated 22 July 1994
38  (By F. Patt, J. Firestone, B. Schieber, L. Kumar, D. Ilg, and M. Darzi)
39  for details.
40 
41  Arguments: (in calling order)
42  Type Name I/O Description
43  ---- ---- --- -----------
44  char * l3m_path I directory path & file name for SMI product
45  char * replaces I filename of previously generated product
46  that current product is intended to replace
47  int16 bin_syear I year of start of binning period of the parent
48  product
49  int16 bin_sday I GMT day-of-year of start of binning period
50  of the parent product
51  int16 bin_eyear I year of end of binning period of the parent
52  product
53  int16 bin_eday I GMT day-of-year of end of binning period
54  of the parent product
55  int16 syear I data start time year (from l3 bin product)
56  int16 sday I data start time day-of-year
57  int32 smsec I data start time milliseconds-of-day
58  int16 eyear I data end time year; read from l3 bin product
59  int16 eday I data end day-of-year
60  int16 emsec I data end time milliseconds-of-day
61  float32 *lat_range I lats of the outside edges of the northernmost
62  and easternmost columns for l3mdata
63  float32 *lon_range I lons of the outside edges of the westernmost
64  and easternmost columns for l3m_data
65  int32 lines I number of points in the vertical direction
66  int32 columns I number of points in horizontal direction
67  char *flag_use I specifies use of parent l2 product's l2_flags
68  uint8 *eng_q_use I specifies use of l2 product's eng_qua values
69  char * ptime I processing start time
70  char * infiles I name of input product
71  char * prod_type I binning period description(scene, day.....)
72  int32 nbins I Number of bins containing data in the parent
73  char * l3m_name I name of the geophysical parameter to which
74  l3m_data corresponds
75  void * l3m_data I image data for parameter l3m_name
76  product
77  char * measure I indicates whether it is mean, median, mode,
78  standard deviation, scenes or pixels
79  char * proc_con I processing control input
80  char * proc_log I processing log output
81 
82  Notes: (see V4.2 I/O & V2.6 Product Specs for updated changes)
83 
84  Modification history:
85  Programmer Organization Date Description of change
86  -------------- ------------ -------- ---------------------
87  Lakshmi Kumar Hughes STX 12/16/93 Original development
88  Lakshmi Kumar Hughes STX 08/29/94 Revised version
89  Lakshmi Kumar Hughes STX 03/01/95 changed l3m data type to
90  float & added code to
91  scale the data to byte
92  Added some global attrs
93  Changed l3m_name "epsilon"
94  to "eps_68"
95  Lakshmi Kumar Hughes STX 03/14/95 Added label "palette" to
96  palette.
97  Lakshmi Kumar Hughes STX 05/08/95 Removed longname attribute
98  from l3m_data SDS
99  Lakshmi Kumar HITC 05/18/95 Changed datatype of
100  flag_use global attribute
101  Lakshmi Kumar Hughes STX 05/27/95 Removed palette fr put_l3m
102  interface call & is
103  defined in an include file
104  Lakshmi Kumar Hughes STX 09/28/95 Added orbit & flag_names
105  as input args and written
106  them as global attributes
107  Added SW point lat/lon as
108  global attributes
109  (V2.8 prod & V4.4 I/O
110  specs)
111  Lakshmi Kumar Hughes STX 10/27/95 Added "Start Orbit" and
112  "End Orbit" global attrs.
113  moved the prototype defn.
114  of this fun. to an .h file
115  Lakshmi Kumar Hughes STX 11/08/95 Changed eps_68 to eps_78
116  Lakshmi Kumar Hughes STX 02/23/96 Added rounding factor to
117  the scaling equation
118  changed local variable
119  names from min & max to
120  datamin and datamax.
121  Lakshmi Kumar Hughes STX 06/18/96 Changed defn. of MAX to
122  MAXVAL inorder to remove
123  compile time warning
124  Lakshmi Kumar Hughes STX 10/16/96 Removed 'median' & 'mode'
125  as input for measure.
126  Sets NODATA pixels to 255.
127  Ref. V5.0 I/O specs.
128  Lakshmi Kumar Hughes STX 12/11/96 Removed 'orbit' as input
129  (it can be accessed thro'
130  meta_l3b structure)
131  Also, removed non-ANSI
132  declarations
133 -----------------------------------------------------------------------------*/
134 int32
135 put_l3m(char *l3m_path, char *replaces, int16 bin_syear, int16 bin_sday,
136  int16 bin_eyear, int16 bin_eday, int16 syear, int16 sday,
137  int32 smsec, int16 eyear, int16 eday, int32 emsec,
138  float32 *lat_range, float32 *lon_range, int32 lines, int32 columns,
139  char *flag_names, char *flag_use, uint8 *eng_q_use, char *ptime,
140  char *infiles, char *prod_type, int32 nbins, char *l3m_name,
141  void *l3m_data, char *measure, char *proc_con, char *proc_log,
142  meta_l3bType *meta_l3b) {
143 
144  int32 fid, sdfid, sdsid;
145  int32 nrows = lines, ncols = columns;
146  int32 i, rank = 2, index, pal_ref;
147  int32 start[2] = {0, 0};
148  int32 dimsizes[2];
149  uint8 *l3m_outdata = NULL; /* buf to hold scaled data */
150  const uint8 NODATA_VAL = 255;
151  div_t quot1, quot2, quot3;
152  char parm_name[MAXVAL];
153  char string[MAXVAL], *loc_path, *str, loc_measure[25];
154  char *softid = VERSION; /* SW id obtained fr the makefile*/
155  float32 max_val, min_val, datamax, datamin;
156  float32 lat_step, lon_step, slope, intercept;
157  float32 swlat, swlon;
158  const float32 NODATA_FLAG = -9E6f;
159  VOIDP pal;
160  float *l3m_fdata = (float *) l3m_data;
161  uint8 *l3m_bdata = (uint8 *) l3m_data;
162 
163  uint8 sixteenbit = 0;
164 
165  /*** Open/create output file in the given l3m_path */
166 
167  sdfid = SDstart(l3m_path, DFACC_CREATE);
168  fid = Hopen(l3m_path, DFACC_RDWR, 0);
169 
170  if (sdfid < 0 || fid < 0) {
171  printf("\n put_l3m: Error in creating file %s ", l3m_path);
172  return FAIL;
173  }
174 
175  /*** Convert l3m_name to lower case */
176 
177  for (i = 0; i < strlen(l3m_name); i++)
178  parm_name[i] = tolower(l3m_name[i]);
179 
180  parm_name[i] = 0;
181 
182  /*** Use parameter name as index in to parameter full name list, units list,
183  scales list and intercept list */
184 
185  printf("name=%s\n", parm_name);
186 
187  if ((strcmp(parm_name, "nlw_412")) == 0)
188  index = NLW_412;
189  else if ((strcmp(parm_name, "nlw_443")) == 0)
190  index = NLW_443;
191  else if ((strcmp(parm_name, "nlw_490")) == 0)
192  index = NLW_490;
193  else if ((strcmp(parm_name, "nlw_510")) == 0)
194  index = NLW_510;
195  else if ((strcmp(parm_name, "nlw_555")) == 0)
196  index = NLW_555;
197  else if ((strcmp(parm_name, "nlw_670")) == 0)
198  index = NLW_670;
199  else if ((strcmp(parm_name, "czcs_pigment")) == 0)
201  else if ((strcmp(parm_name, "chlor_a")) == 0)
202  index = CHLOR_A;
203  else if ((strcmp(parm_name, "k_490")) == 0)
204  index = K_490;
205  else if ((strcmp(parm_name, "chlor_a_k_490")) == 0)
207  else if ((strcmp(parm_name, "eps_78")) == 0)
208  index = EPSILON;
209  else if ((strcmp(parm_name, "tau_865")) == 0)
210  index = TAU_865;
211  else if ((strcmp(parm_name, "angstrom_510")) == 0)
213  else if ((strcmp(parm_name, "pixels")) == 0)
214  index = PIXELS;
215  else if ((strcmp(parm_name, "scenes")) == 0)
216  index = SCENES;
217  else if ((strcmp(parm_name, "ndvi")) == 0)
218  index = NDVI;
219  else if ((strcmp(parm_name, "biosphere")) == 0)
220  index = BIOSPHERE;
221  else {
222  printf("\nput_l3m: Error: given l3m_name - %s unrecognized\n", l3m_name);
223  free(l3m_outdata);
224  return FAIL;
225  }
226 
227  if (nbins < 0) {
228  nbins = -nbins;
229  sixteenbit = 1;
230  }
231 
232 
233  /*** Write out global attributes */
234 
235  if ((loc_path = strrchr(l3m_path, '/')) != NULL)
236  loc_path++;
237  else
238  loc_path = l3m_path;
239  SDsetattr(sdfid, L3M_PNAME, DFNT_CHAR, strlen(loc_path) + 1, (VOIDP) loc_path);
240  SDsetattr(sdfid, L3M_TITLE, DFNT_CHAR, strlen(L3M_TITLE_VAL) + 1, L3M_TITLE_VAL);
241  SDsetattr(sdfid, L3M_DCENTER, DFNT_CHAR,
242  strlen(L3M_DCENTER_VAL) + 1, L3M_DCENTER_VAL);
243  SDsetattr(sdfid, L3M_MISSION, DFNT_CHAR,
244  strlen(L3M_MISSION_VAL) + 1, (VOIDP) L3M_MISSION_VAL);
245  SDsetattr(sdfid, L3M_SENSOR_NAME, DFNT_CHAR,
246  strlen(meta_l3b->sensor_name) + 1, (VOIDP) meta_l3b->sensor_name);
247  SDsetattr(sdfid, L3M_PRODTYPE, DFNT_CHAR,
248  strlen(prod_type) + 1, (VOIDP) prod_type);
249  if (replaces == NULL || (strcmp(replaces, "")) == 0) {
250  strcpy(string, "ORIGINAL");
251  replaces = string;
252  }
253  SDsetattr(sdfid, L3M_REPLACE, DFNT_CHAR,
254  strlen(replaces) + 1, (VOIDP) replaces);
255  SDsetattr(sdfid, L3M_SOFTID, DFNT_CHAR, strlen(softid) + 1, (VOIDP) softid);
256  SDsetattr(sdfid, L3M_PTIME, DFNT_CHAR, strlen(ptime) + 1, (VOIDP) ptime);
257 
258  if ((str = strrchr(infiles, '/')) != NULL)
259  str++;
260  else
261  str = infiles;
262  SDsetattr(sdfid, L3M_INFILES, DFNT_CHAR, strlen(str) + 1, (VOIDP) str);
263  SDsetattr(sdfid, L3M_PROCCON, DFNT_CHAR, strlen(proc_con) + 1, (VOIDP) proc_con);
264  /*
265  SDsetattr(sdfid, L3M_PROCLOG, DFNT_CHAR, strlen(proc_log)+1,(VOIDP)proc_log);
266  */
267  SDsetattr(sdfid, L3M_FLAG_NAMES, DFNT_CHAR,
268  strlen(flag_names) + 1, (VOIDP) flag_names);
269  quot1 = div(smsec, MSECHOUR);
270  quot2 = div(quot1.rem, MSECMIN);
271  quot3 = div(quot2.rem, MSECSEC);
272  sprintf(string, "%4.4d%3.3d%2.2d%2.2d%2.2d%3.3d", syear, sday,
273  quot1.quot, quot2.quot, quot3.quot, quot3.rem);
274  SDsetattr(sdfid, L3M_STIME, DFNT_CHAR, strlen(string) + 1, (VOIDP) string);
275  quot1 = div(emsec, MSECHOUR);
276  quot2 = div(quot1.rem, MSECMIN);
277  quot3 = div(quot2.rem, MSECSEC);
278  sprintf(string, "%4.4d%3.3d%2.2d%2.2d%2.2d%3.3d", eyear, eday,
279  quot1.quot, quot2.quot, quot3.quot, quot3.rem);
280  SDsetattr(sdfid, L3M_ETIME, DFNT_CHAR, strlen(string) + 1, (VOIDP) string);
281  SDsetattr(sdfid, L3M_ORBIT, DFNT_INT32, 1, (VOIDP) & meta_l3b->orbit);
282  SDsetattr(sdfid, L3M_SORBIT, DFNT_INT32, 1, (VOIDP) & meta_l3b->start_orb);
283  SDsetattr(sdfid, L3M_EORBIT, DFNT_INT32, 1, (VOIDP) & meta_l3b->end_orb);
284  SDsetattr(sdfid, L3M_MAPPROJ, DFNT_CHAR, strlen(L3M_MAPPROJ_VAL) + 1,
285  (VOIDP) L3M_MAPPROJ_VAL);
286  SDsetattr(sdfid, L3M_LATUNITS, DFNT_CHAR, strlen(L3M_LATUNITS_VAL) + 1,
287  (VOIDP) L3M_LATUNITS_VAL);
288  SDsetattr(sdfid, L3M_LONUNITS, DFNT_CHAR, strlen(L3M_LONUNITS_VAL) + 1,
289  (VOIDP) L3M_LONUNITS_VAL);
290 
291  /*** check validity of given latitude ranges-- 1st value should be greater
292  than the second one. If in error, output error message */
293  if (lat_range[0] <= lat_range[1]) {
294  printf("\nput_l3m: Given latitude range is in error \n");
295  free(l3m_outdata);
296  return FAIL;
297  }
298  SDsetattr(sdfid, L3M_NLAT, DFNT_FLOAT32, 1, (VOIDP) & lat_range[0]);
299  SDsetattr(sdfid, L3M_SLAT, DFNT_FLOAT32, 1, (VOIDP) & lat_range[1]);
300  SDsetattr(sdfid, L3M_WLON, DFNT_FLOAT32, 1, (VOIDP) & lon_range[0]);
301  SDsetattr(sdfid, L3M_ELON, DFNT_FLOAT32, 1, (VOIDP) & lon_range[1]);
302 
303  lat_step = (lat_range[0] - lat_range[1]) / lines;
304  SDsetattr(sdfid, L3M_LAT_STEP, DFNT_FLOAT32, 1, (VOIDP) & lat_step);
305 
306  if (lon_range[1] > lon_range[0])
307  lon_step = (lon_range[1] - lon_range[0]) / columns;
308  else
309  lon_step = (360 - lon_range[0] + lon_range[1]) / columns;
310  SDsetattr(sdfid, L3M_LON_STEP, DFNT_FLOAT32, 1, (VOIDP) & lon_step);
311 
312  swlat = (lat_range[1] + lat_step / 2.0);
313  swlon = (lon_range[0] + lon_step / 2.0);
314  SDsetattr(sdfid, L3M_SWLAT, DFNT_FLOAT32, 1, (VOIDP) & swlat);
315  SDsetattr(sdfid, L3M_SWLON, DFNT_FLOAT32, 1, (VOIDP) & swlon);
316 
317  SDsetattr(sdfid, L3M_DATABINS, DFNT_INT32, 1, (VOIDP) & nbins);
318  SDsetattr(sdfid, L3M_NROWS, DFNT_INT32, 1, (VOIDP) & nrows);
319  SDsetattr(sdfid, L3M_NCOLS, DFNT_INT32, 1, (VOIDP) & ncols);
320 
321  SDsetattr(sdfid, L3M_PARAMETER, DFNT_CHAR, strlen(parmname_list[index]) + 1,
322  (VOIDP) parmname_list[index]);
323 
324  for (i = 0; i < strlen(measure); i++)
325  loc_measure[i] = tolower(measure[i]);
326  loc_measure[i] = 0;
327 
328  if (strcmp(loc_measure, "mean") == 0)
329  strcpy(loc_measure, "Mean");
330  else
331  if (strcmp(loc_measure, "standard deviation") == 0)
332  strcpy(loc_measure, "Standard deviation");
333  else
334  if (strcmp(loc_measure, "maximum") == 0)
335  strcpy(loc_measure, "Max Value");
336  else
337  if (strcmp(loc_measure, "scenes") == 0)
338  strcpy(loc_measure, "Scenes per bin");
339  else
340  if (strcmp(loc_measure, "pixels") == 0)
341  strcpy(loc_measure, "Pixels per bin");
342  else {
343  printf("\nput_l3m: measure does not contain valid string\n");
344  return FAIL;
345  }
346 
347 
348  SDsetattr(sdfid, L3M_MEASURE, DFNT_CHAR, strlen(loc_measure) + 1,
349  (VOIDP) loc_measure);
350 
351  SDsetattr(sdfid, L3M_UNITS, DFNT_CHAR, strlen(unit_list[index]) + 1,
352  (VOIDP) unit_list[index]);
353 
354  if (index == CHLOR_A || index == CZCS_PIGMENT) {
355  SDsetattr(sdfid, L3M_SCALING, DFNT_CHAR, strlen(L3M_LOG_SCALE) + 1,
356  (VOIDP) L3M_LOG_SCALE);
357  SDsetattr(sdfid, L3M_SC_EQN, DFNT_CHAR, strlen(L3M_LOG_EQN) + 1,
358  (VOIDP) L3M_LOG_EQN);
359  SDsetattr(sdfid, L3M_BASE, DFNT_FLOAT32, 1, (VOIDP) & base);
360  } else {
361  SDsetattr(sdfid, L3M_SCALING, DFNT_CHAR, strlen(L3M_LINEAR_SCALE) + 1,
362  (VOIDP) L3M_LINEAR_SCALE);
363  SDsetattr(sdfid, L3M_SC_EQN, DFNT_CHAR, strlen(L3M_LINEAR_EQN) + 1,
364  (VOIDP) L3M_LINEAR_EQN);
365  }
366 
367  SDsetattr(sdfid, L3M_SLOPE, DFNT_FLOAT32, 1, (VOIDP) & slope_list[index]);
368  SDsetattr(sdfid, L3M_INTERCEPT, DFNT_FLOAT32, 1,
369  (VOIDP) & intercept_list[index]);
370 
373 
374  datamin = 9E6f;
375  datamax = -9E6f;
376  dimsizes[0] = lines;
377  dimsizes[1] = columns;
378 
379 
380  if (index == BIOSPHERE)
381  l3m_outdata = l3m_bdata;
382 
383  else if (index == CHLOR_A || index == CZCS_PIGMENT) {
384  if ((l3m_outdata = (uint8 *) malloc(lines * columns * sizeof (uint8))) == NULL) {
385  printf("\n put_l3m: malloc Error: Memory allocation unsuccessful\n");
386  return FAIL;
387  }
388  max_val = pow(base, slope * 254 + intercept);
389  min_val = pow(base, intercept);
390  for (i = 0; i < nrows * ncols; i++) {
391  if (l3m_fdata[i] > datamax)
392  datamax = l3m_fdata[i];
393  if (l3m_fdata[i] < datamin && l3m_fdata[i] > NODATA_FLAG)
394  datamin = l3m_fdata[i];
395  /* add 0.5 at the end to accomplish rounding */
396  if (l3m_fdata[i] < NODATA_FLAG)
397  l3m_outdata[i] = NODATA_VAL; /* NODATA_VAL = 255 */
398  else
399  l3m_outdata[i] =
400  ((log10(min((max(l3m_fdata[i], min_val)), max_val))
401  - intercept) / slope) + 0.5;
402  }
403 
404  } else {
405  if ((l3m_outdata = (uint8 *) malloc(lines * columns * sizeof (uint8))) == NULL) {
406  printf("\n put_l3m: malloc Error: Memory allocation unsuccessful\n");
407  return FAIL;
408  }
409  min_val = intercept;
410  max_val = slope * 254 + intercept;
411  for (i = 0; i < nrows * ncols; i++) {
412  if (l3m_fdata[i] > datamax)
413  datamax = l3m_fdata[i];
414  if (l3m_fdata[i] < datamin && l3m_fdata[i] > NODATA_FLAG)
415  datamin = l3m_fdata[i];
416  if (l3m_fdata[i] < NODATA_FLAG)
417  l3m_outdata[i] = NODATA_VAL;
418  else
419  l3m_outdata[i] = ((min((max(l3m_fdata[i], min_val)), max_val)
420  - intercept) / slope) + 0.5;
421  }
422  }
423 
424  SDsetattr(sdfid, L3M_MIN, DFNT_FLOAT32, 1, (VOIDP) & datamin);
425  SDsetattr(sdfid, L3M_MAX, DFNT_FLOAT32, 1, (VOIDP) & datamax);
426 
427  /*** write SDS */
428  if (sixteenbit) {
429  if ((sdsid = SDcreate(sdfid, SDS_NAME, DFNT_UINT16, rank, dimsizes)) < 0) {
430  printf("\nput_l3m: SDcreate call to create %s is unsuccessful",
431  SDS_NAME);
432  free(l3m_outdata);
433  return FAIL;
434  }
435 
436  if ((SDwritedata(sdsid, start, NULL, dimsizes, (VOIDP) l3m_outdata)) < 0) {
437  printf("\nput_l3m: SDwritedata unsuccessful\n");
438  free(l3m_outdata);
439  return FAIL;
440  }
441  } else {
442  if ((sdsid = SDcreate(sdfid, SDS_NAME, DFNT_UINT8, rank, dimsizes)) < 0) {
443  printf("\nput_l3m: SDcreate call to create %s is unsuccessful",
444  SDS_NAME);
445  free(l3m_outdata);
446  return FAIL;
447  }
448 
449  if ((SDwritedata(sdsid, start, NULL, dimsizes, (VOIDP) l3m_outdata)) < 0) {
450  printf("\nput_l3m: SDwritedata unsuccessful\n");
451  free(l3m_outdata);
452  return FAIL;
453  }
454  }
455 
456  SDendaccess(sdsid);
457 
458  /*** write palette */
459  switch (index) {
460  case NDVI: pal = (VOIDP) ndvi_palette;
461  break;
462  case BIOSPHERE: pal = (VOIDP) bios_palette;
463  break;
464  default: pal = (VOIDP) default_palette;
465  break;
466  }
467 
468  if ((DFPaddpal(l3m_path, pal)) < 0)
469  return FAIL;
470 
471  if ((pal_ref = DFPlastref()) > 0) {
472  if ((DFANputlabel(l3m_path, DFTAG_IP8, pal_ref, "palette")) < 0) {
473  printf("\nput_l3m: Error writing - palette label\n");
474  printf("\n No label is written to the palette\n");
475  }
476  }
477 
478  /*** free the buffer space that was allocated */
479  /*
480  free(l3m_outdata);
481  */
482 
483  /*** close down interfaces and close file */
484  SDend(sdfid);
485  Hclose(fid);
486  return SUCCEED;
487 }
488 
#define L3M_LATUNITS
Definition: mapattr.h:67
#define L3M_TITLE
Definition: mapattr.h:9
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame index(0-based) was previously being used the frame number(1-based) should have been used. There were only a few minor changes to the uncertainty index(maximum of 1 digit). 3. Some inefficient arrays(Sigma_RVS_norm_sq) were eliminated and some code lines in Preprocess_L1A_Data were moved into Process_OBCEng_Emiss. There were no changes to the product. Required RAM was reduced by 20 MB. Now
#define NDVI
Definition: maplists.h:21
integer, parameter int16
Definition: cubeio.f90:3
int16 eday
Definition: l1_czcs_hdf.c:17
#define L3M_NLAT
Definition: mapattr.h:71
#define L3M_WLON
Definition: mapattr.h:75
#define L3M_DCENTER_VAL
Definition: mapattr.h:12
#define L3M_NCOLS
Definition: mapattr.h:92
#define L3M_INFILES
Definition: mapattr.h:37
#define L3M_SC_EQN
Definition: mapattr.h:99
#define L3M_LOG_SCALE
Definition: mapattr.h:97
#define K_490
Definition: l2lists.h:12
#define FAIL
Definition: ObpgReadGrid.h:18
#define MAXVAL
Definition: l3stat.h:13
#define NULL
Definition: decode_rs.h:63
#define L3M_MAX
Definition: mapattr.h:106
#define VERSION
Definition: put_l3m.c:11
#define L3M_LAT_STEP
Definition: mapattr.h:79
#define L3M_SORBIT
Definition: mapattr.h:60
#define L3M_MISSION
Definition: mapattr.h:19
#define L3M_LON_STEP
Definition: mapattr.h:80
#define L3M_SCALING
Definition: mapattr.h:96
int32_t start_orb
Definition: meta_l3b.h:42
float32 base
Definition: maplists.h:106
#define L3M_LONUNITS
Definition: mapattr.h:69
#define NLW_490
Definition: l2lists.h:6
#define MSECMIN
Definition: regen.h:13
int16 eyear
Definition: l1_czcs_hdf.c:17
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
#define L3M_DCENTER
Definition: mapattr.h:11
int syear
Definition: l1_czcs_hdf.c:15
#define L3M_LINEAR_SCALE
Definition: mapattr.h:98
#define PIXELS
Definition: maplists.h:19
#define L3M_MEASURE
Definition: mapattr.h:93
#define MSECSEC
Definition: regen.h:14
#define CZCS_PIGMENT
Definition: maplists.h:12
int32 smsec
Definition: l1_czcs_hdf.c:16
#define L3M_REPLACE
Definition: mapattr.h:32
#define L3M_PNAME
Definition: mapattr.h:8
@ string
#define NLW_555
Definition: l2lists.h:8
#define SCENES
Definition: maplists.h:20
int sday
Definition: l1_czcs_hdf.c:15
#define MSECHOUR
Definition: regen.h:12
#define CHLOR_A
Definition: l2lists.h:11
#define L3M_MIN
Definition: mapattr.h:105
char ** unit_list
Definition: main_l2mapgen.c:76
#define max(A, B)
Definition: put_l3m.c:13
float32 intercept_list[]
Definition: maplists.h:104
#define NLW_443
Definition: l2lists.h:5
#define L3M_LONUNITS_VAL
Definition: mapattr.h:70
#define L3M_ORBIT
Definition: mapattr.h:59
#define SDS_NAME
Definition: mapattr.h:86
#define L3M_DATABINS
Definition: mapattr.h:90
float32 slope[]
Definition: l2lists.h:30
#define L3M_NROWS
Definition: mapattr.h:91
#define min(A, B)
Definition: put_l3m.c:14
int32 nrows
#define L3M_PROCCON
Definition: mapattr.h:38
#define ANGSTROM_510
Definition: maplists.h:16
float32 intercept[]
Definition: l2lists.h:44
#define NLW_670
Definition: l2lists.h:9
char ** parmname_list
Definition: main_l2mapgen.c:74
#define TAU_865
Definition: l2lists.h:14
#define L3M_LATUNITS_VAL
Definition: mapattr.h:68
#define L3M_SWLAT
Definition: mapattr.h:81
int32_t orbit
Definition: meta_l3b.h:41
int32 emsec
Definition: l1_czcs_hdf.c:18
#define L3M_FLAG_NAMES
Definition: mapattr.h:41
#define L3M_STIME
Definition: mapattr.h:51
const char * str
Definition: l1c_msi.cpp:35
#define NLW_510
Definition: l2lists.h:7
#define EPSILON
Definition: regen_attr.h:50
#define L3M_ETIME
Definition: mapattr.h:52
int16 ncols[121]
#define L3M_SLOPE
Definition: mapattr.h:103
char * flag_names[]
Definition: l2lists.h:46
#define L3M_UNITS
Definition: mapattr.h:95
float32 slope_list[]
Definition: maplists.h:84
Extra metadata that will be written to the HDF4 file l2prod rank
#define L3M_PARAMETER
Definition: mapattr.h:94
#define NLW_412
Definition: l2lists.h:4
int32 put_l3m(char *l3m_path, char *replaces, int16 bin_syear, int16 bin_sday, int16 bin_eyear, int16 bin_eday, int16 syear, int16 sday, int32 smsec, int16 eyear, int16 eday, int32 emsec, float32 *lat_range, float32 *lon_range, int32 lines, int32 columns, char *flag_names, char *flag_use, uint8 *eng_q_use, char *ptime, char *infiles, char *prod_type, int32 nbins, char *l3m_name, void *l3m_data, char *measure, char *proc_con, char *proc_log, meta_l3bType *meta_l3b)
Definition: put_l3m.c:135
#define L3M_MISSION_VAL
Definition: mapattr.h:20
#define CHOR_A_K_490
Definition: maplists.h:15
#define L3M_SWLON
Definition: mapattr.h:82
#define BIOSPHERE
Definition: maplists.h:22
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_FLOAT32
#define L3M_MAPPROJ
Definition: mapattr.h:65
#define L3M_ELON
Definition: mapattr.h:77
#define L3M_BASE
Definition: mapattr.h:102
#define L3M_EORBIT
Definition: mapattr.h:61
char sensor_name[SM_ATTRSZ]
Definition: meta_l3b.h:19
int i
Definition: decode_rs.h:71
#define L3M_SOFTID
Definition: mapattr.h:33
#define L3M_LINEAR_EQN
Definition: mapattr.h:101
#define L3M_MAPPROJ_VAL
Definition: mapattr.h:66
#define L3M_INTERCEPT
Definition: mapattr.h:104
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 end_orb
Definition: meta_l3b.h:43
#define L3M_SLAT
Definition: mapattr.h:73
#define L3M_LOG_EQN
Definition: mapattr.h:100
#define L3M_TITLE_VAL
Definition: mapattr.h:10
#define L3M_PRODTYPE
Definition: mapattr.h:30
#define L3M_SENSOR_NAME
Definition: mapattr.h:24
#define L3M_PTIME
Definition: mapattr.h:36