OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
metnrt.c
Go to the documentation of this file.
1 /*****************************************************************
2  * File: metnrt.c
3  *
4  * Purpose: create HDF ancillary real time datafile from
5  * NCEP (formerly NMC) (GRIB format) W, P, PW, H input.
6  *
7  * Description: this program will create a HDF with the components:
8  *
9  * HDF DAAC compliant Annotation object
10  * 1-D Latitude SDS
11  * 1-D Longitude SDS
12  * 2-D data parameter SDS (z_wind)
13  * 2-D Q/C flag (z_wind_QC)
14  * 2-D data parameter SDS (m_wind)
15  * 2-D Q/C flag (m_wind_QC)
16  * 2-D data parameter SDS (press)
17  * 2-D Q/C flag (press_QC)
18  * 2-D data parameter SDS (rel_hum)
19  * 2-D Q/C flag (rel_hum_QC)
20  * 2-D data parameter SDS (p_water)
21  * 2-D Q/C flag (p_water_QC)
22  *
23  * Input parms:
24  * char *annotfile - input of DAAC compliant annotations ("fillenv.met")
25  * char *inz_wind - input to process ("z_wind.dat")
26  * char *inm_wind - input to process ("m_wind.dat")
27  * char *inpress - input to process ("press.dat")
28  * char *inp_water - input to process ("p_water.dat")
29  * char *inrel_hum - input to process ("rel_hum.dat")
30  * char *outdir - output directory to write file
31  *
32  * Output parms:none
33  *
34  * output name is derived from GRIB converted file header.
35  * Example name: "S199312300_NCEP.MET"
36  *
37  * Returns: run status
38  *
39  * Local vars: numerous variables for storing HDF annotations and SDSs.
40  *
41  * Subs called:
42  * wrtattr - write HDF annotation to file
43  * fill_annot - read HDF annotations from file
44  * wrtsds - write SDS from array to file
45  * pexit - print fatal errors
46  * check_usage- check command line args
47  * readgrid_ - FORTRAN routine to read binary
48  * (GRIB extracted) files
49  *
50  * History: none
51  *
52  * Note: This program is meant to generate SeaWiFS style HDF
53  * ancillary real-time datafiles.
54  *
55  * Author: Brian D. Schieber, GSC, 4/93
56  *
57  * Modification history:
58  * BDS, 4/19/93 - HDF missing flag removed after discussions
59  * with Jim F. and M.Darzi.
60  * - NCEP data in Pascals, divided by 100 => millibars.
61  * BDS, 4/30/93 - Modified GRIB read WPHLONSZ to remove "world wrapped"
62  * extra Lon. Will skip last longitude in HDF write.
63  * BDS, 10/4/93 - Modified for new HDF design and to produce and
64  * output file which holds all three met fields (WPH).
65  * BDS, 11/8/93 - Modified to create z/m wind SDS rather than windspeed.
66  * BDS, 11/28/93- Modified MAX_EAST to 177.5 (from 180.0).
67  * BDS, 12/6/93 - Assuming no missing values, 0.0's passed through.
68  * BDS, 5/19/95 - Support new SeaWiFS v 2.7 product specs.
69  * BDS, 8/21/96 - Renamed 'perror' to 'pexit' to avoid conflict with
70  * HDF4.0.
71  * BDS, 9/18/96 - Changed annot structure. Modify to support new 1x1
72  * GDAS1 files.
73  * BDS, 9/19/96 - Precipitable water has units kg/m^2
74  * W. Robinson, GSC, 4 Feb 97 put rh back in
75  *****************************************************************/
76 
77 #include "ancil.h"
78 #include <time.h>
79 
80 /*
81  * Met data specific settings
82  */
83 
84 #define VGROUPNAME "Geophysical Data"
85 
86 #define BIN_METH 2
87 #define REGISTRATION CENTER
88 #define VSIZE 1.0
89 #define HSIZE 1.0
90 #define MAX_NORTH 90.0
91 #define MAX_SOUTH -90.0
92 #define MAX_WEST -180.0
93 #define MAX_EAST 180.0
94 #define WPHLATSZ 181 /* latitude of GRIB files */
95 #define WPHLONSZ 360 /* long of MODIFIED GRIB files */
96 
97 /* #define VSIZE 2.5 */
98 /* #define HSIZE 2.5 */
99 /* #define MAX_EAST 177.5 */
100 /* #define WPHLATSZ 73 */ /* latitude of GRIB files */
101 /* #define WPHLONSZ 144 */ /* long of MODIFIED GRIB files */
102 
103 main(int argc, char *argv[]) {
104  int i, j, k, l;
105  int rank, SDSref = 0;
106  int result = 0;
107  int array_size = 0;
108  int numannarr = 0;
109  int one = 1;
110  int year = 0, month = 0, day = 0, hour = 0, msec = 0,
111  julval = 0, pyear = 0;
112  int32 shape[2];
113  /* float32 datarr1[WPHLATSZ][WPHLONSZ + 1]; actual GRID has extra LON */
114  /* float32 datarr2[WPHLATSZ][WPHLONSZ + 1]; */
115  /* float32 datarr3[WPHLATSZ][WPHLONSZ + 1]; */
116  /* float32 datarr4[WPHLATSZ][WPHLONSZ + 1]; */
117 
118  float32 datarr1[WPHLATSZ][WPHLONSZ];
119  float32 datarr2[WPHLATSZ][WPHLONSZ];
120  float32 datarr3[WPHLATSZ][WPHLONSZ];
121  float32 datarr4[WPHLATSZ][WPHLONSZ];
122  float32 datarr5[WPHLATSZ][WPHLONSZ];
123 
124  float32 latscl[WPHLATSZ], lonscl[WPHLONSZ],
125  dlat, dlon;
126  char message[MAXNAMELNG];
127  char inz_wind[MAXNAMELNG];
128  char inm_wind[MAXNAMELNG];
129  char inpress[MAXNAMELNG];
130  char inp_water[MAXNAMELNG];
131  char inrel_hum[MAXNAMELNG];
132  char longname[MAXNAMELNG];
133  char *sdsname;
134  char *units;
135  char *dataattr;
136  char *longnamelabel;
137  char *longnamevalue;
138  char *unitslabel;
139  char *unitsvalue;
140  char *datafmt;
141  char outfile[MAXNAMELNG];
142  char outfilename[MAXNAMELNG];
143  char outdir[MAXNAMELNG];
144  char annotfile[MAXNAMELNG];
145  float latstep, lonstep; /* lat/lon incr. */
146  int latsz, lonsz; /* lat/lon size */
147  float nmostlat, smostlat, wmostlon, emostlon; /* lat/lon corners */
148  time_t t; /* processing time */
149  struct tm *localtm; /* processing time */
150  struct annotation *xannot;
151 
152 
153  /*
154  * HDF datafile variables
155  */
156 
157  int32 sdfid, fid, gridid, dimid, sdsid, sdsref;
158  int32 datatype;
159 
160  /*
161  * data type array pointers
162  */
163 
164  float32 *float_SDSz_wind;
165  float32 *float_SDSm_wind;
166  float32 *float_SDSpress;
167  float32 *float_SDSp_water;
168  float32 *float_SDSrel_hum;
169  int8 *int8_SDSdataQC;
170 
171  /*
172  * external functions used
173  */
174 
175  int readgrib_();
176  void julday_();
177  int wrtattr();
178  int32 wrtsds();
179  int startHDF();
180  int setupGrid();
181  void deattachHDFGrid();
182  int writeGeom();
183  int addAttr();
184  int setSDSref();
185  void pexit();
186  int8 check_usage();
187  struct annotation * fillenv_annot();
188 
189  /*
190  * ------- check command line arguments and set args ------------------
191  */
192 
193  if ((check_usage(argc, argv)) != 0) exit(-1);
194  strcpy(annotfile, argv[1]);
195  strcpy(inz_wind, argv[2]);
196  strcpy(inm_wind, argv[3]);
197  strcpy(inpress, argv[4]);
198  strcpy(inp_water, argv[5]);
199  strcpy(inrel_hum, argv[6]);
200  if (argc < 8) strcpy(outdir, "./");
201  else strcpy(outdir, argv[7]);
202 
203  /*
204  * ------- Read each binary file, extract data array and time ----------
205  */
206 
207  result = readgrib_(inz_wind, datarr1, &year, &month, &day, &hour, MAXNAMELNG);
208  if (result == 1) {
209  strcpy(message, "readgrib_ file: ");
210  strcat(message, inz_wind);
211  pexit(message);
212  }
213 
214  result = readgrib_(inm_wind, datarr2, &year, &month, &day, &hour, MAXNAMELNG);
215  if (result == 1) {
216  strcpy(message, "readgrib_ file: ");
217  strcat(message, inm_wind);
218  pexit(message);
219  }
220 
221  result = readgrib_(inpress, datarr3, &year, &month, &day, &hour, MAXNAMELNG);
222  if (result == 1) {
223  strcpy(message, "readgrib_ file: ");
224  strcat(message, inpress);
225  pexit(message);
226  }
227 
228  result = readgrib_(inp_water, datarr4, &year, &month, &day, &hour, MAXNAMELNG);
229  if (result == 1) {
230  strcpy(message, "readgrib_ file: ");
231  strcat(message, inp_water);
232  pexit(message);
233  }
234 
235  result = readgrib_(inrel_hum, datarr5, &year, &month, &day, &hour, MAXNAMELNG);
236  if (result == 1) {
237  strcpy(message, "readgrib_ file: ");
238  strcat(message, inrel_hum);
239  pexit(message);
240  }
241 
242  /*
243  *** This used to dump the GRIB array to stdout for a data check ***
244  dlat = 2.5;
245  dlon = 2.5;
246  for (i = 0; i < WPHLATSZ; i++) {
247  for (j = 0; j < WPHLONSZ; j++) {
248  printf("\nLat: %f", 90.0 - (i * dlat));
249  printf(" Lon: %f", (-180.0 + (j * dlon)));
250  printf(" %f ", datarr1[i][j]/100.0);
251  }
252  }
253  */
254 
255  /*
256  * Create outfile name
257  */
258 
259  if (year < 90) year = year + 2000; /* 2 digit 19xx or 20xx yrs to 4 */
260  else year = year + 1900;
261 
262  julval = julian_(&day, &month, &year);
263  sprintf(outfile, "%s/S%04d%03d%02d_NCEP.MET",
264  outdir, year, julval, hour);
265 
266  sprintf(outfilename, "S%04d%03d%02d_NCEP.MET",
267  year, julval, hour);
268 
269  /* For SDPS' benefit! */
270  printf("%s\n", outfile);
271 
272  /*
273  * Write HDF annotations, lat and lon SDSs
274  */
275 
276  /**** check for existing HDF ***/
277 
278  if (!access(outfile, F_OK)) pexit("....output file exists");
279 
280  if ((numannarr = count_annot(annotfile)) == 0)
281  pexit("no annotations found");
282 
283  if ((xannot = (struct annotation *)
284  malloc(sizeof (struct annotation) * numannarr))
285  == NULL) pexit("malloc Annotation");
286 
287  xannot = fillenv_annot(annotfile);
288 
289  /*
290  * Determine processing time
291  */
292 
293  (void) time(&t);
294  localtm = localtime(&t);
295  pyear = localtm->tm_year;
296  if (pyear < 90) pyear = pyear + 2000; /* 2 digit 19xx or 20xx yrs to 4 */
297  else pyear = pyear + 1900;
298 
299  if (hour > 0) msec = hour * 60 * 60 * 1000;
300  else msec = 0;
301 
302  /*
303  * ------- assign metadata values to local descriptive variables ----
304  * ------- insert dates and other values to metadata array ---------
305  * ------- follow order of fillenv data file -----------------------
306  */
307 
308  for (i = 0; i < numannarr; i++) {
309 
310  /* Insert values to descr array element */
311 
312  if (!strcmp(xannot[i].label, "Product Name"))
313  sprintf(xannot[i].descr, "%s", outfilename);
314 
315  else if (!strcmp(xannot[i].label, "Processing Time"))
316  sprintf(xannot[i].descr, "%04d%03d%02d%02d%02d%03d",
317  pyear, (localtm->tm_yday + 1), localtm->tm_hour, localtm->tm_min,
318  localtm->tm_sec, 0);
319 
320  else if (!strcmp(xannot[i].label, "Input Files"))
321  sprintf(xannot[i].descr, "%s %s %s %s %s",
322  inz_wind, inm_wind, inpress, inrel_hum, inp_water);
323 
324  else if (!strcmp(xannot[i].label, "Processing Control"))
325  sprintf(xannot[i].descr, "%s %s %s %s %s %s %s %s",
326  argv[0], annotfile, inz_wind, inm_wind, inpress,
327  inrel_hum, inp_water, outdir);
328 
329  else if (!strcmp(xannot[i].label, "Start Time"))
330  sprintf(xannot[i].descr, "%04d%03d%02d0000000", year, julval, hour);
331 
332  else if (!strcmp(xannot[i].label, "End Time"))
333  sprintf(xannot[i].descr, "%04d%03d%02d0000000", year, julval, hour);
334 
335  else if (!strcmp(xannot[i].label, "Start Year"))
336  sprintf(xannot[i].descr, "%04d", year);
337 
338  else if (!strcmp(xannot[i].label, "Start Day"))
339  sprintf(xannot[i].descr, "%03d", julval);
340 
341  else if (!strcmp(xannot[i].label, "Start Millisec"))
342  sprintf(xannot[i].descr, "%08d", msec);
343 
344  else if (!strcmp(xannot[i].label, "End Year"))
345  sprintf(xannot[i].descr, "%04d", year);
346 
347  else if (!strcmp(xannot[i].label, "End Day"))
348  sprintf(xannot[i].descr, "%03d", julval);
349 
350  else if (!strcmp(xannot[i].label, "End Millisec"))
351  sprintf(xannot[i].descr, "%08d", msec);
352 
353  /* Extract values from descr array element for program use */
354 
355  else if (!strcmp(xannot[i].label, "Northernmost Latitude"))
356  sscanf(xannot[i].descr, "%f", &nmostlat);
357 
358  else if (!strcmp(xannot[i].label, "Southernmost Latitude"))
359  sscanf(xannot[i].descr, "%f", &smostlat);
360 
361  else if (!strcmp(xannot[i].label, "Westernmost Longitude"))
362  sscanf(xannot[i].descr, "%f", &wmostlon);
363 
364  else if (!strcmp(xannot[i].label, "Easternmost Longitude"))
365  sscanf(xannot[i].descr, "%f", &emostlon);
366 
367  else if (!strcmp(xannot[i].label, "Latitude Step"))
368  sscanf(xannot[i].descr, "%f", &latstep);
369 
370  else if (!strcmp(xannot[i].label, "Longitude Step"))
371  sscanf(xannot[i].descr, "%f", &lonstep);
372 
373  else if (!strcmp(xannot[i].label, "Number of Rows"))
374  sscanf(xannot[i].descr, "%d", &latsz);
375 
376  else if (!strcmp(xannot[i].label, "Number of Columns"))
377  sscanf(xannot[i].descr, "%d", &lonsz);
378 
379  }
380 
381  /*
382  * Create HDF file
383  */
384 
385  if ((result = startHDF(outfile, &sdfid, &fid, DFACC_CREATE)) != 0)
386  pexit("Fatal error starting HDF file");
387 
388  /*
389  * Write attribute array to HDF file
390  */
391 
392  if ((result = wrtattr(sdfid, xannot, numannarr)) != 0) pexit("wrtattr");
393  free(xannot);
394 
395  /*
396  * -------- Allocate space for 2D data arrays -----------------------
397  */
398 
399  rank = 2;
400  shape[0] = WPHLATSZ; /* lat */
401  shape[1] = WPHLONSZ; /* lon */
402  array_size = shape[0] * shape[1];
403 
404  if ((float_SDSz_wind =
405  (float32 *) malloc(sizeof (float32) * array_size)) == NULL)
406  pexit("malloc float_SDSz_wind");
407 
408  if ((float_SDSm_wind =
409  (float32 *) malloc(sizeof (float32) * array_size)) == NULL)
410  pexit("malloc float_SDSm_wind");
411 
412  if ((float_SDSpress =
413  (float32 *) malloc(sizeof (float32) * array_size)) == NULL)
414  pexit("malloc float_SDSpress");
415 
416  if ((float_SDSp_water =
417  (float32 *) malloc(sizeof (float32) * array_size)) == NULL)
418  pexit("malloc float_SDSp_water");
419 
420  if ((float_SDSrel_hum =
421  (float32 *) malloc(sizeof (float32) * array_size)) == NULL)
422  pexit("malloc float_SDSrel_hum");
423 
424  if ((int8_SDSdataQC =
425  (int8 *) calloc(array_size, sizeof (int8))) == NULL)
426  pexit("calloc int8_SDSdataQC");
427 
428 
429  /*
430  * Process z/m_winds, press, rel_hum, p_water
431  * Shift all arrays so that 0 lon is centered, divide pressure by 100.
432  */
433 
434  l = 0;
435  for (j = 0; j < shape[0]; j++) { /* lats */
436  for (k = (shape[1] / 2); k < shape[1]; k++) { /* lons */
437  float_SDSz_wind[l] = datarr1[j][k];
438  float_SDSm_wind[l] = datarr2[j][k];
439  float_SDSpress[l] = datarr3[j][k] / 100.0;
440  float_SDSp_water[l] = datarr4[j][k];
441  float_SDSrel_hum[l] = datarr5[j][k];
442  l++; /* index counter */
443  } /* for k */
444 
445  for (k = 0; k < (shape[1] / 2); k++) { /* lons */
446  float_SDSz_wind[l] = datarr1[j][k];
447  float_SDSm_wind[l] = datarr2[j][k];
448  float_SDSpress[l] = datarr3[j][k] / 100.0;
449  float_SDSp_water[l] = datarr4[j][k];
450  float_SDSrel_hum[l] = datarr5[j][k];
451  l++; /* index counter */
452  } /* for k */
453  } /* for j */
454 
455  /*
456  * ----------------- Create Vgroup ----------------------------
457  */
458 
459  gridid = setupGrid(fid, VGROUPNAME);
460 
461  /*
462  * ----------------- Write z_wind SDS ----------------------------
463  */
464 
465 
466  sdsname = "z_wind";
467  strcpy(longname, "Zonal wind at 10 m");
468  units = "m sec^-1";
469  datafmt = "float32";
470  datatype = DFNT_FLOAT32;
471 
472  if ((SDSinFile(sdsname, longname, units, datafmt,
473  datatype, sdfid, rank, shape,
474  float_SDSz_wind, gridid)) != 0)
475  pexit("SDSinFile z_wind");
476 
477  free(float_SDSz_wind);
478 
479  /*
480  * ---- Write QC flag SDS, units attribute, and add to grid Vgroup -----
481  */
482 
483  sdsname = "z_wind_QC";
484  strcpy(longname, "Zonal wind at 10 m Q/C flag");
485  units = "";
486  datafmt = "int8";
487  datatype = DFNT_INT8;
488 
489  if ((SDSinFile(sdsname, longname, units, datafmt,
490  datatype, sdfid, rank, shape,
491  int8_SDSdataQC, gridid)) != 0)
492  pexit("SDSinFile z_wind_QC");
493 
494 
495  /*
496  * ----------------- Write m_wind SDS ----------------------------
497  */
498 
499  sdsname = "m_wind";
500  strcpy(longname, "Meridional wind at 10 m");
501  units = "m sec^-1";
502  datafmt = "float32";
503  datatype = DFNT_FLOAT32;
504 
505  if ((SDSinFile(sdsname, longname, units, datafmt,
506  datatype, sdfid, rank, shape,
507  float_SDSm_wind, gridid)) != 0)
508  pexit("SDSinFile m_wind");
509 
510  free(float_SDSm_wind);
511 
512  /*
513  * ---- Write QC flag SDS, units attribute, and add to grid Vgroup -----
514  */
515 
516  sdsname = "m_wind_QC";
517  strcpy(longname, "Meridional wind at 10 m Q/C flag");
518  units = "";
519  datafmt = "int8";
520  datatype = DFNT_INT8;
521 
522  if ((SDSinFile(sdsname, longname, units, datafmt,
523  datatype, sdfid, rank, shape,
524  int8_SDSdataQC, gridid)) != 0)
525  pexit("SDSinFile m_wind_QC");
526 
527  /*
528  * ----------------- Write pressure SDS ----------------------------
529  */
530 
531 
532  sdsname = "press";
533  strcpy(longname, "Atmospheric pressure at mean sea level");
534  units = "millibars";
535  datafmt = "float32";
536  datatype = DFNT_FLOAT32;
537 
538  if ((SDSinFile(sdsname, longname, units, datafmt,
539  datatype, sdfid, rank, shape,
540  float_SDSpress, gridid)) != 0)
541  pexit("SDSinFile press");
542 
543  free(float_SDSpress);
544 
545  /*
546  * ---- Write QC flag SDS, units attribute, and add to grid Vgroup -----
547  */
548 
549  sdsname = "press_QC";
550  strcpy(longname, "Atmospheric pressure at mean sea level Q/C flag");
551  units = "";
552  datafmt = "int8";
553  datatype = DFNT_INT8;
554 
555  if ((SDSinFile(sdsname, longname, units, datafmt,
556  datatype, sdfid, rank, shape,
557  int8_SDSdataQC, gridid)) != 0)
558  pexit("SDSinFile press_QC");
559 
560  /*
561  * ----------------- Write humidity SDS ----------------------------
562  */
563 
564  sdsname = "rel_hum";
565  strcpy(longname, "Relative humidity at 1000 mb");
566  units = "percent";
567  datafmt = "float32";
568  datatype = DFNT_FLOAT32;
569 
570  if ((SDSinFile(sdsname, longname, units, datafmt,
571  datatype, sdfid, rank, shape,
572  float_SDSrel_hum, gridid)) != 0)
573  pexit("SDSinFile rel_hum");
574 
575  free(float_SDSrel_hum);
576 
577  /*
578  * ---- Write QC flag SDS, units attribute, and add to grid Vgroup -----
579  */
580 
581  sdsname = "rel_hum_QC";
582  strcpy(longname, "Relative humidity at 1000 mb Q/C flag");
583  units = "";
584  datafmt = "int8";
585  datatype = DFNT_INT8;
586 
587  if ((SDSinFile(sdsname, longname, units, datafmt,
588  datatype, sdfid, rank, shape,
589  int8_SDSdataQC, gridid)) != 0)
590  pexit("SDSinFile rel_hum_QC");
591 
592  /*
593  * ----------------- Write precipitable water SDS ----------------------------
594  */
595 
596  sdsname = "p_water";
597  strcpy(longname, "Precipitable water");
598  units = "kg m^-2";
599  datafmt = "float32";
600  datatype = DFNT_FLOAT32;
601 
602  if ((SDSinFile(sdsname, longname, units, datafmt,
603  datatype, sdfid, rank, shape,
604  float_SDSp_water, gridid)) != 0)
605  pexit("SDSinFile p_water");
606 
607  free(float_SDSp_water);
608 
609  /*
610  * ---- Write QC flag SDS, units attribute, and add to grid Vgroup -----
611  */
612 
613  sdsname = "p_water_QC";
614  strcpy(longname, "Precipitable water Q/C flag");
615  units = "";
616  datafmt = "int8";
617  datatype = DFNT_INT8;
618 
619  if ((SDSinFile(sdsname, longname, units, datafmt,
620  datatype, sdfid, rank, shape,
621  int8_SDSdataQC, gridid)) != 0)
622  pexit("SDSinFile p_water_QC");
623 
624  /*
625  * free storage for QC array (used for all products)
626  */
627 
628  free(int8_SDSdataQC);
629 
630  /*
631  * deattach HDF grid (used for all products)
632  */
633 
634  deattachHDFgrid(gridid);
635 
636  /*
637  * close HDF structures
638  */
639 
640  if ((result = closeHDFstructs(sdfid, fid)) != 0) pexit("closeHDFstructs");
641 
642 } /* main */
643 
644 /*****************************************************************
645  * File: check_usage
646  *
647  * Purpose: check command line arguments
648  *
649  * Description: check command line arguements and report proper usage
650  * on argument count error or no argumnts.
651  *
652  * Returns: success (0) or failure(-1)
653  *
654  * Subs called: none
655  *
656  * History: none
657  *
658  * Note: This routine is custom for each program that uses it since
659  * the arguments are different of course.
660  *
661  * Author: Brian D. Schieber, GSC, 10/93
662  *
663  * Mods: 10/4/93 BDS, new HDF inputs handle all 3 NCEP parms
664  * W. Robinson, GSC, 4 Feb 97 changes for 5th param:rel_hum
665  *****************************************************************/
666 
667 int8 check_usage(int argc, char *argv[]) {
668  if (argc < 7) {
669  printf("\n\nUsage:\n");
670  printf("\t%s <metadata> <file> <file> <file> <file> <file> [outdir]\n",
671  argv[0]);
672  printf("\nWhere:\n");
673  printf("\tmetadata: DAAC-style HDF metadata (ASCII file)\n");
674  printf("\tfiles: GRIB converted binary file to process\n");
675  printf(
676  "\t (z_wind.dat, m_wind.dat, press.dat, p_water.dat, rel_hum.dat)\n");
677  printf("\toutdir: Optional output directory ('.' default)\n");
678  printf("\n");
679  exit(-1);
680  }
681  return (0);
682 }
int32_t setupGrid(int32_t fid, char *grpname)
Definition: ANCroutines.c:51
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int j
Definition: decode_rs.h:73
int32_t day
int32_t SDSinFile(char *sdsname, char *longname, char *units, char *datafmt, int32_t datatype, int32_t sdfid, int32_t rank, int32_t *shape, void *data, int32_t gridid)
int addAttr(int32_t sdsid, char *dataattr, int32_t datatype, char *dataunit)
Definition: ANCroutines.c:222
#define VGROUPNAME
Definition: metnrt.c:84
main(int argc, char *argv[])
Definition: metnrt.c:103
#define NULL
Definition: decode_rs.h:63
int8 check_usage(int argc, char *argv[])
Definition: metnrt.c:667
int32 * msec
Definition: l1_czcs_hdf.c:31
float tm[MODELMAX]
#define WPHLATSZ
Definition: metnrt.c:94
char descr[MAXDESCLEN]
Definition: ancil.h:72
int wrtattr(int32_t dfile, struct annotation *annot, int numannarr)
Definition: ANCroutines.c:631
void julian_(double *dtin, double *d_jd)
int count_annot(char *filename)
Definition: countann.c:11
instead the metadata field ProcessingEnvinronment is filled in from the output of a call to the POSIX compliant function uname from within the L1B code A small bug in L1B_Tables an incorrect comparison of RVS coefficients for TEBs to RVS coefficients for RSBs was being made This was replaced with a comparison between TEB coefficients This error never resulted in an incorrect RVS correction but did lead to recalculating the coefficients for each detector in a thermal band even if the coefficients were the same for all detectors To reduce to overall size of the reflective LUT HDF fill values were eliminated from all LUTs previously dimensioned where and where NUM_TIMES is the number of time dependent table pieces In Preprocess a small error where the trailing dropped scan counter was incremented when the leading dropped scan counter should have been was fixed This counter is internal only and is not yet used for any chiefly to casting of were added to make it LINUX compatible Output of code run on LINUX machines displays differences of at most scaled sector incalculable values of the Emissive calibration factor and incalculable values of SV or BB averages was moved outside the loop over frames in Emissive_Cal c since none of these quantities are frame dependent Initialization of b1 and XMS values in Preprocess c routine Process_OBCENG_Emiss was moved inside the detector loops The code was altered so that if up to five scans are dropped between the leading middle or middle trailing the leading or trailing granule will still be used in emissive calibration to form a cross granule average QA bits and are set for a gap between the leading middle and middle trailing granules respectively This may in rare instances lead to a change in emissive calibration coefficients for scans at the beginning or end of a granule A small bug in the Band correction algorithm was corrected an uncertainty value was being checked against an upper bound whereas the proper quantity to be checked was the corresponding which is the product of the Band radiance times the ratio of the Band to Band scaling factors times the LUT correction value for that detector In addition a new LUT which allows for a frame offset with regard to the Band radiance was added A LUT which switches the correction off or on was also added Changes which do not affect scientific output of the the pixel is flagged with the newly created flag and the number of pixels for which this occurs is counted in the QA_common table The array of b1s in Preprocess c was being initialized to outside the loop over which meant that if b1 could not be the value of b1 from the previous band for that scan detector combination was used The initialization was moved inside the band loop Minor code changes were made to eliminate compiler warnings when the code is compiled in bit mode Temperature equations were upgraded to be MODIS AQUA or MODIS TERRA specific and temperature conversion coefficients for AQUA were MOD_PR02 will not cease execution if the value of this parameter is not but will print a message
Definition: HISTORY.txt:644
int32_t wrtsds(int32_t sdfid, int rank, int32_t *shape, int32_t datatype, char *datalabel, void *data)
struct annotation * fillenv_annot(char *filename)
Definition: fillenv.c:15
int deattachHDFgrid(int32_t gridid)
Definition: ANCroutines.c:267
#define WPHLONSZ
Definition: metnrt.c:95
int closeHDFstructs(int32_t sdfid, int32_t fid)
Definition: ANCroutines.c:281
void pexit(char *string)
Definition: pexit.c:10
int32_t writeGeom(int32_t fid, int32_t gridid, char *geomname, int32_t bin_meth, int32_t registration, float vsize, float hsize, float max_north, float max_south, float max_west, float max_east)
Definition: ANCroutines.c:92
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution offsets between the high resolution geolocation and a bi linear interpolation extrapolation of the positions This can be used to reconstruct the high resolution geolocation Resolved Bug by delaying cumulation of gflags until after validation of derived products Resolved Bug by setting Latitude and Longitude to the correct fill resolving to support Near Real Time because they may be unnecessary if use of entrained ephemeris and attitude data is turned resolving bug report Corrected to filter out Aqua attitude records with missing status helping resolve bug MOD_PR03 will still correctly write scan and pixel data that does not depend upon the start time
Definition: HISTORY.txt:248
Extra metadata that will be written to the HDF4 file l2prod rank
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_FLOAT32
int setSDSref(int32_t sdsid, int32_t gridid)
Definition: ANCroutines.c:245
#define MAXNAMELNG
Definition: ancil.h:43
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")
int k
Definition: decode_rs.h:73
string outfilename
Definition: color_dtdb.py:220
int startHDF(char *outfile, int32_t *sdfid, int32_t *fid, int32_t mode)
Definition: ANCroutines.c:27