OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
put_l2brs.c
Go to the documentation of this file.
1 #include "l2brsgen.h"
2 
3 #include <get_product_table.h>
4 
5 #include <math.h>
6 #include <strings.h>
7 #include <png.h>
8 #include <setupflags.h>
9 #include <hdf.h>
10 
11 static float32 base = BASE_VAL, slope, intercept;
12 static char sc_eqn[128], sc_type[64], param_val[128], units_val[32];
13 
14 /*-----------------------------------------------------------------------------
15 
16  Function: put_l2brs
17 
18  Returns: int32(status)
19  The return code is FAIL (-1) if an error occurs, SUCCEED (0)
20  otherwise.
21 
22  Description:
23  The function put_l2brs creates a level 2 Browse data file with
24  the file name given by l2brs_path. Level 2 file meta data, palette,
25  and data will be written. See "INTERFACE SPECIFICATIONS FOR SeaWiFS
26  OPERATIONAL PRODUCT INPUT AND OUTPUT SOFTWARE" (By Fred Patt,
27  Jim Firestone, and Mike Darzi).
28 
29  Arguments: (in calling order)
30  Type Name I/O Description
31  ---- ---- --- -----------
32  char * l2brs_path I directory path & file name for browse product
33  char * replaces I filename of previously generated product
34  that current product is intended to replace
35  char * ptime I processing start time
36  char * infiles I name of input product
37  int32 px_start I scan data start pixel (1 based)
38  int32 px_end I scan data end pixel (1 based)
39  int32 px_subsamp I pixel subsampling rate
40  int32 sc_start I start scan line (1 based)
41  int32 sc_end I end scan line (1 based)
42  int32 sc_subsamp I scan subsampling rate
43  char * l2brs_name I name of the geophysical parameter to which
44  l2brs_data corresponds
45  float32 * l2brs_data I image data for parameter l2brs_name
46  int16 * l2brs_flags I level2 data flags
47  char * flag_names I list of algorithm names
48  char * mskflg I names of all flag algorithms used as masks
49  usigned char *palette I RGB wts for each of 256 gray-levels of the
50  l2brs_data byte values
51  int32 px_ll_num I number of lat/lon pairs in px_ll_first and
52  px_ll_last
53  float32 * px_ll_first I lat/lon pairs of pixels along the first scan
54  float32 * px_ll_last I lat/lon pairs of pixels along the last scan
55  int32 sc_ll_num I number of lat/lon pairs in sc_ll_first and
56  sc_ll_last
57  float32 * sc_ll_first I lat/lon pairs of scan line start points
58  float32 * sc_ll_last I lat/lon pairs of scal line end points
59  char * proc_con I processing control input
60  char * proc_log I processing log output
61  int16 syear I yr of data start time; as ret by get_l2_open
62  int16 sday I day-of-year for data start time; as ret by
63  get_l2_open
64  int32 smsec I millisecs of day for data start time; as ret
65  by get_l2_open
66  int16 eyear I yr data end time; as ret by get_l2_open
67  int16 eday I day-of-year for data end time; as ret by
68  get_l2_open
69  int16 emsec I millisecs of day for data end time; as ret by
70  get_l2_open
71  char * dtype I data type flag; as ret by get_l2_oepn
72  int32 nrec I no. of scan lines; as ret by get_l2_open
73  int32 nsamp I pixels/scan line; as ret by get_l2_open
74  int32 ntilts I Number of tilt states in the scene; as ret by
75  get_l2_open
76  uint8 * tilt_flags I tilt flags corres. to eh tilt state in the
77  scene; as ret by get_l2_open
78  int16 * tilt_ranges I first and last scan line nos. corrsp. to eh.
79  tilt state in the scee; as ret by get_l2_open
80  float32 * tilt_lats I lats of the end pixels for the scan lines of
81  tilt_ranges; as ret by get_l2_open
82  float32 * tilt_lons I lons of the end pixels for the scan lines of
83  tilt_ranges; as ret by get_l2_open
84  meta_l2Type *meta_l2 I L2 product metadata read by get_l2_open
85 
86  Notes:
87 
88  Modification history:
89  Programmer Organization Date Description of change
90  -------------- ------------ -------- ---------------------
91  Lakshmi Kumar Hughes STX 03/23/94 Original development
92  Lakshmi Kumar Hughes STX 06/16/94 Modified according to
93  Interface specs v3.1
94  Lakshmi Kumar Hughes STX 10/06/94 Modified according to
95  Interface specs v3.3
96  Lakshmi Kumar Hughes STX 01/24/94 Corrected ctime/ntime
97  datatype to character type
98  Lakshmi Kumar HITC 05/19/95 Added code to write
99  Navigation vgp, its data
100  sets and tilt vgroup
101  Lakshmi Kumar Hughes STX 07/25/95 Added code to define gray
102  levels between 250 & 255
103  Lakshmi Kumar Hughes STX 11/01/95 Added legend, start and
104  end center coordinates as
105  global attributes (V4.4)
106  Sets l2brs pix to 0 if
107  mskflg indicates some flag
108  & masking bit is turned on
109  for that pixel
110  Lakshmi Kumar Hughes STX 02/15/96 Added some comments and
111  deleted a redundent if
112  check
113  Lakshmi Kumar Hughes STX 02/23/96 Added gray level 252 for
114  representing invalid data
115  Lakshmi Kumar Hughes STX 06/18/96 Changed defn. of MAX to
116  MAXVAL inorder to remove
117  compile time warning
118  Lakshmi Kumar Hughes STX 11/01/96 Gray levels from 251-255
119  are reset as shown below:
120  255 - missing data
121  253 - land
122  254 - cloud & ice
123  252 - glint
124  251 - invalid data
125  (Ref. V3.0 product specs.)
126  Lakshmi Kumar Hughes STX 08/08/97 ff_mising and sdps_missing
127  flags needed casting as
128  their input values were
129  bytes and output values
130  were 4bytes int.
131  Lakshmi Kumar Hughes STX 10/16/97 updated to add upper left,
132  right and lower left,
133  right lat/lon attributes
134  Norman Kuring NASA/GSFC 11/12/97 Mask stray-light pixels
135  Norman Kuring NASA/GSFC 11/14/97 More mask fiddling
136 -----------------------------------------------------------------------------*/
137 int32 put_l2brs(char *l2brs_path, char *replaces, char *ptime, char *infiles,
138  int32 px_start, int32 px_end, int32 px_subsamp, int32 brs_nsamp,
139  int32 sc_start, int32 sc_end, int32 sc_subsamp, int32 brs_nrec,
140  char *l2brs_name, float32 *l2brs_data, int32 *l2brs_flags,
141  char *flag_names, char *flaguse, unsigned char *palette,
142  float32 *px_ll_first, float32 *px_ll_last, float32 *sc_ll_first,
143  float32 *sc_ll_last, char *proc_con, int16 syear, int16 sday,
144  int32 smsec, int16 eyear, int16 eday, int32 emsec, char *dtype,
145  int32 nrec, int32 nsamp, int32 ntilts, short *tilt_flags,
146  int16 *tilt_ranges, int16 *cntl_pt_lat, int16 *cntl_pt_lon,
147  meta_l2Type *meta_l2, product_table_t *ptable_rec, const char* oformat, int32 apply_pal) {
148 
149  int32 i, fid, sdfid, sdsid, rank = 2, dimsizes[3], start[3];
150 
151  uint32 mask_253, mask_254;
152  double scaled_value;
153  unsigned char *brs_data;
154  uint32 required_mask = 0;
155 
156 
157  FILE *outfp = NULL;
158 
159  if (strcasecmp(ptable_rec->scaling, "logarithmic") == 0) {
160  intercept = log10(ptable_rec->min);
161  slope = (log10(ptable_rec->max) - intercept) / 250.0;
162  strcpy(sc_type, "logarithmic");
163  strcpy(sc_eqn, "Base**((Slope*brs_data) + Intercept) = ");
164  strcat(sc_eqn, ptable_rec->description);
165  } else {
166  intercept = ptable_rec->min;
167  slope = (ptable_rec->max - ptable_rec->min) / 250.0;
168  strcpy(sc_type, "linear");
169  strcpy(sc_eqn, "Slope*brs_data + Intercept = ");
170  strcat(sc_eqn, ptable_rec->description);
171  }
172  strcpy(param_val, ptable_rec->description);
173  strcpy(units_val, ptable_rec->units);
174 
175  brs_data = (unsigned char *) malloc(sizeof (unsigned char) * brs_nsamp * brs_nrec);
176  if (brs_data == NULL) {
177  fprintf(stderr, "\nput_l2brs: Unable to allocate space for scaling brs data\n");
178  return FAIL;
179  }
180 
181  // land mask
182  mask_253 = 1 << 1;
183  mask_254 = 0;
184  required_mask = 0;
185 
186  /* Check masks against their names and set the masking fld "xmask" */
187  if (flag_names == NULL) {
188  fprintf(stderr, "\nError: put_l2brs: flag_names = null string");
189  fprintf(stderr, "\n\t masking will not be applied ");
190  } else {
191  if (flaguse != NULL && flaguse[0] != '\0') {
192  int status;
193  setupflags(flag_names, flaguse, &mask_254, &required_mask, &status);
194  }
195  }
196 
197  for (i = 0; i < brs_nsamp * brs_nrec; i++) {
198  if (l2brs_flags[i] & mask_253)
199  brs_data[i] = 253;
200  else if (l2brs_flags[i] & mask_254)
201  brs_data[i] = 254;
202  else if ((l2brs_flags[i] & required_mask) != required_mask)
203  brs_data[i] = 254;
204  else if (l2brs_data[i] < ptable_rec->min)
205  brs_data[i] = 0;
206  else {
207  if (strcasecmp(ptable_rec->scaling, "logarithmic") == 0)
208  scaled_value = floor((log10(l2brs_data[i]) - intercept) / slope + 0.5);
209  else
210  scaled_value = floor((l2brs_data[i] - intercept) / slope + 0.5);
211 
212  if (scaled_value > 250.0)
213  brs_data[i] = 250;
214  else
215  brs_data[i] = (unsigned char) scaled_value;
216  }
217  }
218 
219  if (strcmp(oformat, "HDF4") == 0) { // hdf
220  sdfid = SDstart(l2brs_path, DFACC_CREATE);
221  fid = Hopen(l2brs_path, DFACC_RDWR, 0);
222  Vstart(fid);
223 
224  write_attrs(sdfid, l2brs_path, replaces, ptime, infiles, px_start, px_end,
225  px_subsamp, brs_nsamp, sc_start, sc_end, sc_subsamp, brs_nrec,
226  l2brs_name, proc_con, syear, sday, smsec, eyear, eday, emsec, dtype,
227  nrec, nsamp, meta_l2);
228 
229  write_image(l2brs_path, brs_data, brs_nsamp, brs_nrec, palette);
230 
231  free(brs_data);
232 
233  /* write px_ll_first SDS */
234  start[0] = start[1] = start[2] = 0;
235  dimsizes[0] = brs_nsamp;
236  dimsizes[1] = 2;
237  if ((sdsid = write_SDS(sdfid, PX_LL_FIRST, DFNT_FLOAT32, rank, dimsizes,
238  start, px_ll_first)) < 0)
239  return FAIL;
240  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(PX_LL_FST_ATTR) + 1,
241  (VOIDP) PX_LL_FST_ATTR);
242 
243  SDsetdimname(SDgetdimid(sdsid, 0), "Pixels per Scan");
244  SDsetdimname(SDgetdimid(sdsid, 1), "Lat/Lon");
245 
246  /* write px_ll_last SDS */
247 
248  dimsizes[0] = brs_nsamp;
249  dimsizes[1] = 2;
250  if ((sdsid = write_SDS(sdfid, PX_LL_LAST, DFNT_FLOAT32, rank, dimsizes,
251  start, px_ll_last)) < 0)
252  return FAIL;
253  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(PX_LL_LST_ATTR) + 1,
254  (VOIDP) PX_LL_LST_ATTR);
255 
256  SDsetdimname(SDgetdimid(sdsid, 0), "Pixels per Scan");
257  SDsetdimname(SDgetdimid(sdsid, 1), "Lat/Lon");
258 
259  /* write sc_ll_first SDS */
260 
261  dimsizes[0] = brs_nrec;
262  dimsizes[1] = 2;
263  if ((sdsid = write_SDS(sdfid, SC_LL_FIRST, DFNT_FLOAT32, rank, dimsizes,
264  start, sc_ll_first)) < 0)
265  return FAIL;
266  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(SC_LL_FST_ATTR) + 1,
267  (VOIDP) SC_LL_FST_ATTR);
268 
269  SDsetdimname(SDgetdimid(sdsid, 0), "Number of Scans");
270  SDsetdimname(SDgetdimid(sdsid, 1), "Lat/Lon");
271 
272  /* write sc_ll_last SDS */
273 
274  dimsizes[0] = brs_nrec;
275  dimsizes[1] = 2;
276  if ((sdsid = write_SDS(sdfid, SC_LL_LAST, DFNT_FLOAT32, rank, dimsizes,
277  start, sc_ll_last)) < 0)
278  return FAIL;
279  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(SC_LL_LST_ATTR) + 1,
280  (VOIDP) SC_LL_LST_ATTR);
281 
282  SDsetdimname(SDgetdimid(sdsid, 0), "Number of Scans");
283  SDsetdimname(SDgetdimid(sdsid, 1), "Lat/Lon");
284 
285  /*** create tilt vgroup and its datasets */
286  if (ntilts > 0) {
287  if ((write_tilt_sets(fid, sdfid, ntilts, tilt_flags, tilt_ranges)) < 0)
288  return FAIL;
289  }
290 
291  /*** create navigation vgroup and its datasets */
292  if ((write_nav_sets(fid, sdfid, brs_nrec, brs_nsamp, cntl_pt_lat, cntl_pt_lon)) < 0)
293  return FAIL;
294 
295  SDend(sdfid);
296  Vend(fid);
297  Hclose(fid);
298 
299  // end outmode = 0 = hdf
300 
301  } else if (strcmp(oformat, "PPM") == 0) {
302  if ((outfp = fopen(l2brs_path, "w")) == NULL) {
303  fprintf(stderr, "put_l2brs: Error: Unable to open %s for writing.\n", l2brs_path);
304  exit(1);
305  }
306 
307  if (apply_pal) {
308 
309  /* Write ppm header */
310  fprintf(outfp, "P6\n");
311  fprintf(outfp, "%d %d\n", brs_nsamp, brs_nrec);
312  fprintf(outfp, "255\n");
313  for (i = 0; i < brs_nsamp * brs_nrec; i++) {
314  fwrite(palette + brs_data[i]*3, 1, 3, outfp);
315  }
316 
317  } else {
318 
319  /* Write pgm header */
320  fprintf(outfp, "P5\n");
321  fprintf(outfp, "%d %d\n", brs_nsamp, brs_nrec);
322  fprintf(outfp, "255\n");
323 
324  for (i = 0; i < brs_nsamp * brs_nrec; i++) {
325  fwrite(brs_data + i, 1, 1, outfp);
326  }
327  }
328 
329  fclose(outfp);
330 
331  // outmode = 1 = ppm or pgm
332 
333  } else if (strcmp(oformat, "PNG") == 0) { // png
334 
335  outfp = fopen(l2brs_path, "w");
336  if (!outfp) {
337  fprintf(stderr, "put_l2brs: Error: Unable to open %s for writing.\n", l2brs_path);
338  exit(1);
339  }
340 
341  png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
342  NULL, NULL, NULL);
343  if (!png_ptr) {
344  fprintf(stderr, "put_l2brs: Error: Unable to create PNG write structure.\n");
345  exit(1);
346  }
347 
348  png_infop info_ptr = png_create_info_struct(png_ptr);
349  if (!info_ptr) {
350  png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
351  fprintf(stderr, "put_l2brs: Error: Unable to create PNG info structure.\n");
352  exit(1);
353  }
354  if (setjmp(png_jmpbuf(png_ptr))) {
355  png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
356  fprintf(stderr, "put_l2brs: Error: Unable to call PNG setjmp().\n");
357  exit(1);
358  }
359  png_init_io(png_ptr, outfp);
360 
361  if (apply_pal) {
362  // color
363  png_set_IHDR(png_ptr, info_ptr, brs_nsamp, brs_nrec,
364  8, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
365  PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
366  png_set_PLTE(png_ptr, info_ptr, (png_const_colorp) palette, 256);
367 
368  } else {
369  // Grayscale
370  png_set_IHDR(png_ptr, info_ptr, brs_nsamp, brs_nrec,
371  8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE,
372  PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
373  }
374 
375  uint8 * row_pointers[brs_nrec];
376  for (i = 0; i < brs_nrec; i++)
377  row_pointers[i] = brs_data + (i * brs_nsamp);
378  png_set_rows(png_ptr, info_ptr, row_pointers);
379 
380  png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
381 
382  /* clean up after the write, and free any memory allocated */
383  png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
384 
385  fclose(outfp);
386 
387  // end 2 = png
388 
389  } else {
390  fprintf(stderr, "put_l2brs: Error: oformat=%s is not supported.\n", oformat);
391  exit(1);
392  }
393 
394  return SUCCEED;
395 }
396 
397 /*-----------------------------------------------------------------------------
398  Function: write_attrs
399 
400  Returns: void
401 
402  Description:
403  The function write_attrs writes metadata (global attributes).
404 
405  Arguments: (in calling order)
406  Type Name I/O Description
407  ---- ---- --- -----------
408  int32 sdfid I file ID
409  char * l2brs_path I directory path & file name for browse product
410  char * replaces I filename of previously generated product
411  that current product is intended to replace
412  char * ptime I processing start time
413  char * infiles I name of input product
414  int32 px_start I scan data start pixel
415  int32 px_subsamp I pixel subsampling rate
416  int32 px_num I no. of pixels in the browse image
417  int32 sc_start I start scan line
418  int32 sc_subsamp I scan subsampling rate
419  int32 sc_num I no. of scan lines in the browse image
420  char * l2brs_name I name of the geophysical parameter to which
421  l2brs_data corresponds
422  int32 px_ll_num I number of lat/lon pairs in px_ll_first and
423  px_ll_last
424  int32 sc_ll_num I number of lat/lon pairs in sc_ll_first and
425  sc_ll_last
426  char * proc_con I processing control input
427  char * proc_log I processing log output
428  int16 syear I yr of data start time; as ret by get_l2_open
429  int16 sday I day-of-year for data start time; as ret by
430  get_l2_open
431  int32 smsec I millisecs of day for data start time; as ret
432  by get_l2_open
433  int16 eyear I yr data end time
434  int16 eday I day-of-year for data end time
435  int16 emsec I millisecs of day for data end time
436  char * dtype I data type flag
437  int32 nrec I no. of scan lines
438  int32 nsamp I pixels/scan line
439  meta_l2Type *meta_l2 I L2 product metadata read by get_l2_open
440 
441  Notes:
442 
443  Modification history:
444  Programmer Organization Date Description of change
445  -------------- ------------ -------- ---------------------
446  Lakshmi Kumar Hughes STX 03/23/94 Original development
447  Lakshmi Kumar Hughes STX 06/16/94 Made changes to agree with
448  Interface specs v3.1
449  Lakshmi Kumar Hughes STX 10/06/94 Made changes to agree with
450  Interface specs v3.3
451  Lakshmi Kumar Hughes STX 01/24/94 Corrected ctime/ntime
452  datatype to character type
453  Lakshmi Kumar Hughes STX 10/24/95 Added legend, start and
454  end center coordinates as
455  global attributes (V4.4)
456  Lakshmi Kumar Hughes STX 10/16/97 Added sc_ll_first and
457  sc_ll_last as input params.
458  Norman Kuring NASA/GSFC 11/26/97 Removed hard-coded data-
459  type from legend attribute
460  Norman Kuring NASA/GSFC 02/09/97 Removed sc_ll_first and
461  sc_ll_last as inputs; get
462  corner coordinates from
463  meta_l2 structure instead.
464 -----------------------------------------------------------------------------*/
465 
466 void write_attrs(int32 sdfid, char *l2brs_path, char *replaces, char *ptime,
467  char *infiles, int32 px_start, int32 px_end, int32 px_subsamp,
468  int32 brs_nsamp, int32 sc_start, int32 sc_end, int32 sc_subsamp,
469  int32 brs_nrec, char *l2brs_name, char *proc_con, int16 syear,
470  int16 sday, int32 smsec, int16 eyear, int16 eday, int32 emsec,
471  char *dtype, int32 nrec, int32 nsamp, meta_l2Type *meta_l2) {
472  div_t quot1, quot2, quot3;
473  char string[20], pname[2048], *p, *pinfile;
474  int32 lac_px_st, lac_px_subsamp;
475  char legend[132];
476 
477  char *soft_name = "l2brsgen";
478  char *soft_ver = "5.1";
479 
480  /* write out global attributes */
481  p = strrchr(l2brs_path, '/');
482  if (p == NULL)
483  strcpy(pname, l2brs_path);
484  else
485  strcpy(pname, ++p);
486 
487  SDsetattr(sdfid, L2B_PNAME, DFNT_CHAR, strlen(pname) + 1, (VOIDP) pname);
488 
489  strcpy(pname, meta_l2->sensor_name);
490  strcat(pname, TITLE_VAL);
491  SDsetattr(sdfid, L2B_TITLE, DFNT_CHAR, strlen(pname) + 1, pname);
492  SDsetattr(sdfid, SENSOR_NAME, DFNT_CHAR, strlen(meta_l2->sensor_name) + 1,
493  meta_l2->sensor_name);
494 
495  sprintf(legend,
496  "%s Level-2 %s %s browse data, day %3.3d, %4.4d",
497  meta_l2->sensor_name, dtype, param_val, sday, syear);
498  SDsetattr(sdfid, LEGEND, DFNT_CHAR, strlen(legend) + 1, (VOIDP) legend);
499 
500  SDsetattr(sdfid, DCENTER, DFNT_CHAR, strlen(DCENTER_VAL) + 1, DCENTER_VAL);
501  SDsetattr(sdfid, SOFT_NAME, DFNT_CHAR, strlen(soft_name) + 1,
502  (VOIDP) soft_name);
503  SDsetattr(sdfid, SOFT_VER, DFNT_CHAR, strlen(soft_ver) + 1,
504  (VOIDP) soft_ver);
505  SDsetattr(sdfid, REPLACES, DFNT_CHAR, strlen(replaces) + 1, (VOIDP) replaces);
506 
507  if (meta_l2->mission != 0x0) {
508  SDsetattr(sdfid, L2BRS_MISSION, DFNT_CHAR, strlen(meta_l2->mission) + 1,
509  (VOIDP) meta_l2->mission);
510  }
511 
512  if (meta_l2->mission_char != 0x0) {
513  SDsetattr(sdfid, MSNCHAR, DFNT_CHAR, strlen(meta_l2->mission_char) + 1,
514  (VOIDP) meta_l2->mission_char);
515  }
516 
517  if (meta_l2->sensor != 0x0) {
518  SDsetattr(sdfid, SENSOR, DFNT_CHAR, strlen(meta_l2->sensor) + 1,
519  (VOIDP) meta_l2->sensor);
520  }
521 
522  if (meta_l2->sensor_char != 0x0) {
523  SDsetattr(sdfid, SNSCHAR, DFNT_CHAR, strlen(meta_l2->sensor_char) + 1,
524  (VOIDP) meta_l2->sensor_char);
525  }
526 
527  SDsetattr(sdfid, PTIME, DFNT_CHAR, strlen(ptime) + 1, (VOIDP) ptime);
528  SDsetattr(sdfid, L2BRS_INFILES, DFNT_CHAR,
529  strlen(infiles) + 1, (VOIDP) infiles);
530  SDsetattr(sdfid, PROC_CON, DFNT_CHAR, strlen(proc_con) + 1, (VOIDP) proc_con);
531 
532  if(meta_l2->infiles) {
533  pinfile = strrchr(meta_l2->infiles, '/');
534  if (pinfile == NULL)
535  pinfile = meta_l2->infiles;
536  else
537  pinfile++;
538  } else {
539  pinfile = "unknown";
540  }
541  SDsetattr(sdfid, PINFILES, DFNT_CHAR, strlen(pinfile) + 1,
542  (VOIDP) pinfile);
543 
544  SDsetattr(sdfid, DTYPE, DFNT_CHAR, strlen(dtype) + 1, (VOIDP) dtype);
545  SDsetattr(sdfid, NSAMP, DFNT_INT32, 1, (VOIDP) & nsamp);
546 
547  SDsetattr(sdfid, NREC, DFNT_INT32, 1, (VOIDP) & nrec);
548  SDsetattr(sdfid, SNCNTR, DFNT_INT32, 1, (VOIDP) & meta_l2->ncrec);
549  SDsetattr(sdfid, L2BRS_PCTFLAG, DFNT_FLOAT32, 32, (VOIDP) meta_l2->flags_pc);
550 
551  quot1 = div(smsec, MSECHOUR);
552  quot2 = div(quot1.rem, MSECMIN);
553  quot3 = div(quot2.rem, MSECSEC);
554  sprintf(string, "%4.4d%3.3d%2.2d%2.2d%2.2d%3.3d", syear, sday,
555  quot1.quot, quot2.quot, quot3.quot, quot3.rem);
556  SDsetattr(sdfid, STIME, DFNT_CHAR, strlen(string) + 1, (VOIDP) string);
557  quot1 = div(emsec, MSECHOUR);
558  quot2 = div(quot1.rem, MSECMIN);
559  quot3 = div(quot2.rem, MSECSEC);
560  sprintf(string, "%4.4d%3.3d%2.2d%2.2d%2.2d%3.3d", eyear, eday,
561  quot1.quot, quot2.quot, quot3.quot, quot3.rem);
562  SDsetattr(sdfid, END_TIME, DFNT_CHAR,
563  strlen(string) + 1, (VOIDP) string);
564 
565  if (meta_l2->ctime != 0x0)
566  SDsetattr(sdfid, CTIME, DFNT_CHAR, strlen(meta_l2->ctime) + 1,
567  (VOIDP) meta_l2->ctime);
568  if (meta_l2->ntime != 0x0)
569  SDsetattr(sdfid, NTIME, DFNT_CHAR, strlen(meta_l2->ntime) + 1,
570  (VOIDP) meta_l2->ntime);
571 
572  SDsetattr(sdfid, SYEAR, DFNT_INT16, 1, (VOIDP) & syear);
573  SDsetattr(sdfid, SDAY, DFNT_INT16, 1, (VOIDP) & sday);
574  SDsetattr(sdfid, SMSEC, DFNT_INT32, 1, (VOIDP) & smsec);
575  SDsetattr(sdfid, EYEAR, DFNT_INT16, 1, (VOIDP) & eyear);
576  SDsetattr(sdfid, EDAY, DFNT_INT16, 1, (VOIDP) & eday);
577  SDsetattr(sdfid, EMSEC, DFNT_INT32, 1, (VOIDP) & emsec);
578 
579  if (meta_l2->snode != 0x0)
580  SDsetattr(sdfid, SNODE, DFNT_CHAR, strlen(meta_l2->snode) + 1,
581  (VOIDP) meta_l2->snode);
582  if (meta_l2->enode != 0x0)
583  SDsetattr(sdfid, ENODE, DFNT_CHAR, strlen(meta_l2->enode) + 1,
584  (VOIDP) meta_l2->enode);
585 
586  SDsetattr(sdfid, ORBNUM, DFNT_INT32, 1, (VOIDP) & meta_l2->orbnum);
587  SDsetattr(sdfid, LATUNITS, DFNT_CHAR, strlen(LATUNITS_VAL) + 1,
588  (VOIDP) LATUNITS_VAL);
589  SDsetattr(sdfid, LONUNITS, DFNT_CHAR, strlen(LONUNITS_VAL) + 1,
590  (VOIDP) LONUNITS_VAL);
591  SDsetattr(sdfid, NLAT, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->northlat);
592  SDsetattr(sdfid, SLAT, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->southlat);
593  SDsetattr(sdfid, WLON, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->westlon);
594  SDsetattr(sdfid, ELON, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->eastlon);
595  SDsetattr(sdfid, STCLAT, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->startclat);
596  SDsetattr(sdfid, STCLON, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->startclon);
597  SDsetattr(sdfid, ENDCLAT, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->endclat);
598  SDsetattr(sdfid, ENDCLON, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->endclon);
599 
600  SDsetattr(sdfid, NODEL, DFNT_FLOAT32, 1, (VOIDP) & meta_l2->nodel);
601 
602  SDsetattr(sdfid, PARAM, DFNT_CHAR, strlen(param_val) + 1, (VOIDP) param_val);
603  SDsetattr(sdfid, UNITS, DFNT_CHAR, strlen(units_val) + 1, (VOIDP) units_val);
604  SDsetattr(sdfid, PX_START, DFNT_INT32, 1, (VOIDP) & px_start);
605  SDsetattr(sdfid, PX_END, DFNT_INT32, 1, (VOIDP) & px_end);
606  lac_px_st = meta_l2->pix_start + ((px_start - 1) * meta_l2->pix_sub);
607  SDsetattr(sdfid, LAC_PX_ST, DFNT_INT32, 1, (VOIDP) & lac_px_st);
608  SDsetattr(sdfid, PX_SUBSAMP, DFNT_INT32, 1, (VOIDP) & px_subsamp);
609  lac_px_subsamp = meta_l2->pix_sub * px_subsamp;
610  SDsetattr(sdfid, LAC_PX_SUBSAMP, DFNT_INT32, 1, (VOIDP) & lac_px_subsamp);
611  SDsetattr(sdfid, PX_NUM, DFNT_INT32, 1, (VOIDP) & brs_nsamp);
612  SDsetattr(sdfid, SC_START, DFNT_INT32, 1, (VOIDP) & sc_start);
613  SDsetattr(sdfid, SC_END, DFNT_INT32, 1, (VOIDP) & sc_end);
614  SDsetattr(sdfid, SC_SUBSAMP, DFNT_INT32, 1, (VOIDP) & sc_subsamp);
615  SDsetattr(sdfid, SC_NUM, DFNT_INT32, 1, (VOIDP) & brs_nrec);
616  SDsetattr(sdfid, PX_LL_NUM, DFNT_INT32, 1, (VOIDP) & brs_nsamp);
617  SDsetattr(sdfid, SC_LL_NUM, DFNT_INT32, 1, (VOIDP) & brs_nrec);
618  SDsetattr(sdfid, SC_TYPE, DFNT_CHAR, strlen(sc_type) + 1, (VOIDP) sc_type);
619  SDsetattr(sdfid, SC_EQN, DFNT_CHAR, strlen(sc_eqn) + 1, (VOIDP) sc_eqn);
620  SDsetattr(sdfid, BASE, DFNT_FLOAT32, 1, (VOIDP) & base);
621  SDsetattr(sdfid, SLOPE, DFNT_FLOAT32, 1, (VOIDP) & slope);
622  SDsetattr(sdfid, INTERCEPT, DFNT_FLOAT32, 1, (VOIDP) & intercept);
623 
624 }
625 
626 /*-----------------------------------------------------------------------------
627  Function: write_image
628 
629  Returns: int32 (status)
630  The return code is FAIL (-1) if an error occurs, SUCCEED (0)
631  otherwise.
632 
633  Description:
634  The function write_image writes the image in to the product file
635 
636  Arguments: (in calling order)
637  Type Name I/O Description
638  ---- ---- --- -----------
639  char * l2brs_path I directory path & file name for browse product
640  char l2brs_data I image data
641  int32 px_num I no. of pixels in the browse image
642  int32 sc_num I no. of scan lines in the browse image
643  uchar * palette I RGB wts for each of 256 gray-levels of the
644  l2brs_data byte values
645  Notes:
646 
647  Modification history:
648  Programmer Organization Date Description of change
649  -------------- ------------ -------- ---------------------
650  Lakshmi Kumar Hughes STX 03/23/94 Original development
651  Lakshmi Kumar Hughes STX 06/16/94 Made changes to agree with
652  Interface specs v3.1
653 -----------------------------------------------------------------------------*/
654 int32
655 write_image(char *l2brs_path, unsigned char *l2brs_data, int32 brs_nsamp, int32 brs_nrec,
656  unsigned char *palette) {
657  int32 img_ref;
658 
659  DFR8setpalette(palette);
660 
661  if ((DFR8addimage(l2brs_path, (VOIDP) l2brs_data, brs_nsamp, brs_nrec, 0)) < 0) {
662  fprintf(stderr, "\n Error writing browse image\n");
663  return FAIL;
664  }
665 
666  if ((img_ref = DFR8lastref()) > 0) {
667  if ((DFANputlabel(l2brs_path, DFTAG_RIG, img_ref, "brs_data")) < 0) {
668  fprintf(stderr, "\nwrite_image: Error writing - brs_data label\n");
669  fprintf(stderr, "\n No label is written to the raster image\n");
670  }
671  } else {
672  fprintf(stderr, "\nwrite_image: Error reading image ref. no. \n");
673  fprintf(stderr, "\n No label is written to the raster image\n");
674  }
675 
676  return SUCCEED;
677 }
678 
679 /*-----------------------------------------------------------------------------
680  Function: write_SDS
681 
682  Returns: int32 (status)
683  The return code is FAIL (-1) if an error occurs, SUCCEED (0)
684  otherwise.
685 
686  Description:
687  The function write_image writes the image in to the product file
688 
689  Arguments: (in calling order)
690  Type Name I/O Description
691  ---- ---- --- -----------
692  int32 sdfid I file ID
693  char * label I Name of the dataset
694  int32 ntype I Data type
695  int32 rank I Number of dimensions of the dataset
696  int32 * dimsizes I Dimensions of the data
697  int32 * start I start dimensions of the data
698  void * buf I data buffer
699 
700  Notes:
701 
702  Modification history:
703  Programmer Organization Date Description of change
704  -------------- ------------ -------- ---------------------
705  Lakshmi Kumar Hughes STX 03/23/94 Original development
706  Lakshmi Kumar Hughes STX 06/16/94 Made changes to agree with
707  Interface specs v3.1
708 -----------------------------------------------------------------------------*/
709 int32
710 write_SDS(int32 sdfid, char *label, int32 ntype, int32 rank, int32 *dimsizes,
711  int32 *start, void *buf) {
712  int32 sdsid, ret;
713 
714  if ((sdsid = SDcreate(sdfid, label, ntype, rank, dimsizes)) < 0)
715  return FAIL;
716 
717  if ((ret = SDwritedata(sdsid, start, NULL, dimsizes, (VOIDP) buf)) < 0)
718  return FAIL;
719 
720  SDendaccess(sdsid);
721  return sdsid;
722 }
723 
724 /*-----------------------------------------------------------------------------
725  Function: write_nav_sets
726 
727  Returns: int32 (status)
728  The return code is FAIL (-1) if an error occurs, SUCCEED (0)
729  otherwise.
730 
731  Description:
732  The function write_nav_sets creates navigation vgroup and its
733  datasets.
734 
735  Arguments: (in calling order)
736  Type Name I/O Description
737  ---- ---- --- -----------
738  int32 fid I file ID
739  int32 sdfid I SD interface file ID
740  float32 *orb_vec I Orbit position vector data buffer
741  float32 *l_vert I local vertical vector in ECEF frame databuf
742  float32 *sun_ref I referecnce sun vector data buffer
743  float32 *att_ang I computed yaw, roll, pitch data buffer
744  float32 *sen_mat I sensor-frame matrix data buffer
745  float32 *scan_ell I scan-track ellipse coefficients data buffer
746  int32 *nflag I navigation flags buffer
747 
748  Notes:
749 
750  Modification history:
751  Programmer Organization Date Description of change
752  -------------- ------------ -------- ---------------------
753  Lakshmi Kumar Hughes STX 05/12/95 Original development
754 -----------------------------------------------------------------------------*/
755 int32
756 write_nav_sets(int32 fid, int32 sdfid, int32 brs_nrec, int32 brs_nsamp,
757  int16 *cntl_pt_lat, int16 *cntl_pt_lon) {
758 
759  int32 vid, sdsid, sdsref;
760  int32 rank, start[3] = {0, 0, 0}, dimsizes[3];
761  char FUNC[] = "write_nav_sets:";
762  float32 f32;
763 
764  if ((vid = Vattach(fid, -1, "w")) < 0) {
765  sprintf(ERR_MSG, "\n%s Vattach failed for navigation vgp", FUNC);
766  return FAIL;
767  }
768 
769  Vsetname(vid, "Navigation");
770 
771  /**** write cntl_pt_lat SDS and link it to navigation vgroup */
772  dimsizes[0] = brs_nrec;
773  dimsizes[1] = brs_nsamp;
774  dimsizes[2] = 0;
775  if ((sdsid = write_SDS(sdfid, CNTLPTLAT, DFNT_INT16, rank = 2,
776  dimsizes, start, cntl_pt_lat)) < 0) return FAIL;
777 
778  if ((SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(CNTLPTLAT_NAME) + 1,
779  (VOIDP) CNTLPTLAT_NAME)) < 0) {
780  sprintf(ERR_MSG,
781  "\n%s Error writing attribute %s for cnlt_pt_lat", FUNC, LONGNAME);
782  return FAIL;
783  }
784 
785  if ((sdsref = SDidtoref(sdsid)) < 0) {
786  sprintf(ERR_MSG, "\nError SDidtoref failed for cntl_pt_lat dataset");
787  return FAIL;
788  }
789 
790  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
791  sprintf(ERR_MSG, "\nError Vaddtagref failed for cntl_pt_lat");
792  return FAIL;
793  }
794 
795  SDsetdimname(SDgetdimid(sdsid, 0), "Number of Scans");
796  SDsetdimname(SDgetdimid(sdsid, 1), "Pixels per Scan");
797 
798  f32 = 1. / 360;
799  SDsetattr(sdsid, "slope", DFNT_FLOAT32, 1, &f32);
800  f32 = 0.0;
801  SDsetattr(sdsid, "intercept", DFNT_FLOAT32, 1, &f32);
802 
803 
804  /**** write cntl_pt_lon SDS and link it to navigation vgroup */
805  dimsizes[0] = brs_nrec;
806  dimsizes[1] = brs_nsamp;
807  dimsizes[2] = 0;
808  if ((sdsid = write_SDS(sdfid, CNTLPTLON, DFNT_INT16, rank = 2,
809  dimsizes, start, cntl_pt_lon)) < 0) return FAIL;
810 
811  if ((SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(CNTLPTLON_NAME) + 1,
812  (VOIDP) CNTLPTLON_NAME)) < 0) {
813  sprintf(ERR_MSG,
814  "\n%s Error writing attribute %s for cnlt_pt_lon", FUNC, LONGNAME);
815  return FAIL;
816  }
817 
818  if ((sdsref = SDidtoref(sdsid)) < 0) {
819  sprintf(ERR_MSG, "\nError SDidtoref failed for cntl_pt_lon dataset");
820  return FAIL;
821  }
822 
823  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
824  sprintf(ERR_MSG, "\nError Vaddtagref failed for cntl_pt_lon");
825  return FAIL;
826  }
827 
828  SDsetdimname(SDgetdimid(sdsid, 0), "Number of Scans");
829  SDsetdimname(SDgetdimid(sdsid, 1), "Pixels per Scan");
830 
831  f32 = 1.0 / 180.0;
832  SDsetattr(sdsid, "slope", DFNT_FLOAT32, 1, &f32);
833  f32 = 0.0;
834  SDsetattr(sdsid, "intercept", DFNT_FLOAT32, 1, &f32);
835 
836  Vdetach(vid);
837 
838  return SUCCEED;
839 
840 }
841 
842 /*-----------------------------------------------------------------------------
843  Function: write_tilt_sets
844 
845  Returns: int32 (status)
846  The return code is FAIL (-1) if an error occurs, SUCCEED (0)
847  otherwise.
848 
849  Description:
850  The function write_tilt_sets creates tilt vgroup and its
851  datasets.
852 
853  Arguments: (in calling order)
854  Type Name I/O Description
855  ---- ---- --- -----------
856  int32 fid I file ID
857  int32 sdfid I SD interface file ID
858  int32 ntilts I Number of tilts
859  short tilt_flags I tilt flags corresponding to each tilt state
860  short tilt_ranges I first and last scan line nos. corresponding
861  to each tilt state
862  float32 tilt_lats I latitudes of the end pixels for the scan
863  lines of tilt_ranges
864  float32 tilt_lons I longitudes of the end pixels for the scan
865  lines of tilt_ranges
866 
867  Notes:
868 
869  Modification history:
870  Programmer Organization Date Description of change
871  -------------- ------------ -------- ---------------------
872  Lakshmi Kumar Hughes STX 05/12/95 Original development
873 -----------------------------------------------------------------------------*/
874 int32
875 write_tilt_sets(int32 fid, int32 sdfid, int32 ntilts, short *tilt_flags,
876  int16 *tilt_ranges) {
877  int32 vid, sdsid, sdsref;
878  int32 rank, start[3] = {0, 0, 0}, dimsizes[3] = {0, 0, 0};
879  int16 int_range[2];
880  char FUNC[] = "write_tilt_sets";
881 
882 
883  if ((vid = Vattach(fid, -1, "w")) < 0) {
884  sprintf(ERR_MSG, "\n%s Vattach failed for tilt vgp", FUNC);
885  return FAIL;
886  }
887 
888  Vsetname(vid, "Sensor Tilt");
889 
890  /* write ntilts SDS */
891 
892  dimsizes[0] = 1;
893  if ((sdsid = write_SDS(sdfid, NTILTS, DFNT_INT32, rank = 1,
894  dimsizes, start, &ntilts)) < 0)
895  return FAIL;
896  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(NTILTS_NAME) + 1,
897  (VOIDP) NTILTS_NAME);
898 
899  if ((sdsref = SDidtoref(sdsid)) < 0) {
900  sprintf(ERR_MSG, "\nError SDidtoref failed for ntilts dataset");
901  return FAIL;
902  }
903 
904  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
905  sprintf(ERR_MSG, "\nError Vaddtagref failed for ntilts");
906  return FAIL;
907  }
908 
909  /* write tilt_flags SDS */
910 
911  dimsizes[0] = MAXTILTS;
912  if ((sdsid = write_SDS(sdfid, T_FLAGS, DFNT_INT16, rank = 1, dimsizes,
913  start, tilt_flags)) < 0)
914  return FAIL;
915  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(T_FLAGS_NAME) + 1,
916  (VOIDP) T_FLAGS_NAME);
917 
918  int_range[0] = -1;
919  int_range[1] = 3;
920  SDsetattr(sdsid, RANGE, DFNT_INT16, 2, (VOIDP) int_range);
921 
922  if ((sdsref = SDidtoref(sdsid)) < 0) {
923  sprintf(ERR_MSG, "\nError SDidtoref failed for tilt_flags dataset");
924  return FAIL;
925  }
926 
927  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
928  sprintf(ERR_MSG, "\nError Vaddtagref failed for tilt_flags");
929  return FAIL;
930  }
931 
932 
933  /* write tilt_ranges SDS */
934 
935  dimsizes[0] = MAXTILTS;
936  dimsizes[1] = 2;
937  if ((sdsid = write_SDS(sdfid, T_RANGES, DFNT_INT16, rank = 2,
938  dimsizes, start, tilt_ranges)) < 0)
939  return FAIL;
940  SDsetattr(sdsid, LONGNAME, DFNT_CHAR, strlen(T_RANGES_NAME) + 1,
941  (VOIDP) T_RANGES_NAME);
942 
943  if ((sdsref = SDidtoref(sdsid)) < 0) {
944  sprintf(ERR_MSG, "\nError SDidtoref failed for tilt_ranges dataset");
945  return FAIL;
946  }
947 
948  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
949  sprintf(ERR_MSG, "\nError Vaddtagref failed for tilt_ranges");
950  return FAIL;
951  }
952 
953  Vdetach(vid);
954 
955  return SUCCEED;
956 
957 }
958 
959 
char ERR_MSG[255]
Definition: extract_sub.c:119
#define SC_LL_NUM
Definition: l2brsgen.h:143
integer, parameter int16
Definition: cubeio.f90:3
#define ENDCLON
Definition: l2brsgen.h:124
#define SC_END
Definition: l2brsgen.h:139
int16 eday
Definition: l1_czcs_hdf.c:17
#define L2BRS_PCTFLAG
Definition: l2brsgen.h:82
#define SLAT
Definition: regen_attr.h:27
#define SLOPE
Definition: regen_attr.h:18
#define SNCNTR
Definition: l2brsgen.h:78
#define PX_LL_FIRST
Definition: l2brsgen.h:157
int status
Definition: l1_czcs_hdf.c:32
#define EYEAR
Definition: regen.h:37
#define LATUNITS_VAL
Definition: l2brsgen.h:103
#define T_FLAGS_NAME
Definition: l2brsgen.h:170
#define DCENTER_VAL
Definition: l2brsgen.h:53
#define DTYPE
Definition: l1stat.h:26
#define SC_LL_FST_ATTR
Definition: l2brsgen.h:162
#define T_RANGES_NAME
Definition: l2brsgen.h:172
#define SYEAR
Definition: regen.h:34
#define FAIL
Definition: ObpgReadGrid.h:18
#define SC_LL_FIRST
Definition: l2brsgen.h:161
#define MAXTILTS
Definition: swl0_parms.h:11
#define NULL
Definition: decode_rs.h:63
#define SDAY
Definition: regen.h:35
#define LAC_PX_SUBSAMP
Definition: l2brsgen.h:136
#define PX_NUM
Definition: l2brsgen.h:137
#define CNTLPTLAT_NAME
Definition: l2brsgen.h:198
#define SOFT_VER
Definition: l2brsgen.h:65
#define SC_LL_LST_ATTR
Definition: l2brsgen.h:164
#define PX_LL_LAST
Definition: l2brsgen.h:159
#define LONUNITS_VAL
Definition: l2brsgen.h:105
#define LAC_PX_ST
Definition: l2brsgen.h:134
#define MSECMIN
Definition: regen.h:13
#define LATUNITS
Definition: l2brsgen.h:102
#define CTIME
Definition: regen.h:42
int16 eyear
Definition: l1_czcs_hdf.c:17
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
int syear
Definition: l1_czcs_hdf.c:15
#define NTILTS_NAME
Definition: l2brsgen.h:168
int32 write_image(char *l2brs_path, unsigned char *l2brs_data, int32 brs_nsamp, int32 brs_nrec, unsigned char *palette)
Definition: put_l2brs.c:655
#define PROC_CON
Definition: l2brsgen.h:68
#define PARAM
Definition: GEO_main.h:69
#define BASE_VAL
Definition: l2brsgen.h:149
#define NLAT
Definition: l2brsgen.h:117
#define MSECSEC
Definition: regen.h:14
int32 smsec
Definition: l1_czcs_hdf.c:16
#define ELON
Definition: regen_attr.h:32
#define ORBNUM
Definition: l2brsgen.h:97
#define LONGNAME
Definition: regen_attr.h:17
#define ENODE
Definition: l2brsgen.h:96
#define PTIME
Definition: regen.h:33
#define PINFILES
Definition: l2brsgen.h:73
int sday
Definition: l1_czcs_hdf.c:15
#define SC_EQN
Definition: l2brsgen.h:146
#define PX_LL_NUM
Definition: l2brsgen.h:142
#define MSECHOUR
Definition: regen.h:12
#define SC_LL_LAST
Definition: l2brsgen.h:163
#define NSAMP
Definition: l1stat.h:23
#define TITLE_VAL
#define L2BRS_MISSION
Definition: l2brsgen.h:54
int32 write_tilt_sets(int32 fid, int32 sdfid, int32 ntilts, short *tilt_flags, int16 *tilt_ranges)
Definition: put_l2brs.c:875
#define EMSEC
Definition: regen.h:39
#define T_RANGES
Definition: l2brsgen.h:171
#define L2BRS_INFILES
Definition: l2brsgen.h:67
#define PX_LL_LST_ATTR
Definition: l2brsgen.h:160
#define BASE
Definition: l2brsgen.h:148
#define CNTLPTLON
Definition: l2brsgen.h:199
void setupflags(char *flagdef, char *flaguse, uint32_t *flagusemask, uint32_t *required, int *status)
Definition: setupflags.c:5
#define PX_END
Definition: l2brsgen.h:133
float32 slope[]
Definition: l2lists.h:30
#define SMSEC
Definition: regen.h:36
#define CNTLPTLON_NAME
Definition: l2brsgen.h:200
subroutine legend(N, M, X, P)
Definition: legend.f:2
#define NODEL
Definition: l2brsgen.h:125
#define END_TIME
Definition: l2brsgen.h:86
#define SC_START
Definition: l2brsgen.h:138
#define INTERCEPT
Definition: regen_attr.h:19
#define NTIME
Definition: l2brsgen.h:88
#define T_FLAGS
Definition: l2brsgen.h:169
float32 intercept[]
Definition: l2lists.h:44
#define L2B_TITLE
Definition: l2brsgen.h:49
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT16
#define SENSOR_NAME
Definition: l2brsgen.h:56
#define LEGEND
Definition: l2brsgen.h:50
#define L2B_PNAME
Definition: l2brsgen.h:48
#define PX_LL_FST_ATTR
Definition: l2brsgen.h:158
#define PX_START
Definition: l2brsgen.h:132
#define RANGE
Definition: GEO_product.h:234
SENSOR
Definition: DDProcess.h:81
int32 write_nav_sets(int32 fid, int32 sdfid, int32 brs_nrec, int32 brs_nsamp, int16 *cntl_pt_lat, int16 *cntl_pt_lon)
Definition: put_l2brs.c:756
#define MSNCHAR
Definition: l2brsgen.h:55
int32 emsec
Definition: l1_czcs_hdf.c:18
#define SC_NUM
Definition: l2brsgen.h:141
#define EDAY
Definition: regen.h:38
#define SOFT_NAME
Definition: l2brsgen.h:64
dtype
Definition: DDataset.hpp:31
char * flag_names[]
Definition: l2lists.h:46
Extra metadata that will be written to the HDF4 file l2prod rank
int32 put_l2brs(char *l2brs_path, char *replaces, char *ptime, char *infiles, int32 px_start, int32 px_end, int32 px_subsamp, int32 brs_nsamp, int32 sc_start, int32 sc_end, int32 sc_subsamp, int32 brs_nrec, char *l2brs_name, float32 *l2brs_data, int32 *l2brs_flags, char *flag_names, char *flaguse, unsigned char *palette, float32 *px_ll_first, float32 *px_ll_last, float32 *sc_ll_first, float32 *sc_ll_last, char *proc_con, int16 syear, int16 sday, int32 smsec, int16 eyear, int16 eday, int32 emsec, char *dtype, int32 nrec, int32 nsamp, int32 ntilts, short *tilt_flags, int16 *tilt_ranges, int16 *cntl_pt_lat, int16 *cntl_pt_lon, meta_l2Type *meta_l2, product_table_t *ptable_rec, const char *oformat, int32 apply_pal)
Definition: put_l2brs.c:137
#define SC_SUBSAMP
Definition: l2brsgen.h:140
#define PX_SUBSAMP
Definition: l2brsgen.h:135
#define REPLACES
Definition: l2brsgen.h:61
#define NREC
Definition: regen.h:28
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_FLOAT32
#define STCLON
Definition: l2brsgen.h:122
#define STIME
Definition: l2brsgen.h:85
#define ENDCLAT
Definition: l2brsgen.h:123
#define SNODE
Definition: l2brsgen.h:95
#define UNITS
Definition: regen_attr.h:21
int i
Definition: decode_rs.h:71
#define SC_TYPE
Definition: l2brsgen.h:144
#define WLON
Definition: l2brsgen.h:119
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define STCLAT
Definition: l2brsgen.h:121
void write_attrs(int32 sdfid, char *l2brs_path, char *replaces, char *ptime, char *infiles, int32 px_start, int32 px_end, int32 px_subsamp, int32 brs_nsamp, int32 sc_start, int32 sc_end, int32 sc_subsamp, int32 brs_nrec, char *l2brs_name, char *proc_con, int16 syear, int16 sday, int32 smsec, int16 eyear, int16 eday, int32 emsec, char *dtype, int32 nrec, int32 nsamp, meta_l2Type *meta_l2)
Definition: put_l2brs.c:466
#define CNTLPTLAT
Definition: l2brsgen.h:197
#define SNSCHAR
Definition: l2brsgen.h:58
int32 write_SDS(int32 sdfid, char *label, int32 ntype, int32 rank, int32 *dimsizes, int32 *start, void *buf)
Definition: put_l2brs.c:710
float p[MODELMAX]
Definition: atrem_corl1.h:131
float32 f32
Definition: l2bin.cpp:104
#define LONUNITS
Definition: l2brsgen.h:104
#define NTILTS
Definition: l1stat.h:45
#define DCENTER
Definition: l2brsgen.h:52