OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
hdf_ras_chk.c
Go to the documentation of this file.
1 #include "l1io.h"
2 #include <mfhdf.h>
3 
4 extern int fmt_status; /* format checker status, see fmt_check */
5 
6 int hdf_ras_chk(char *file, char *lbl_ras, char *lbl_pal, int npix, int nlin)
7 /*******************************************************************
8 
9  hdf_ras_chk
10 
11  purpose: check the raster and associated palette for a file
12 
13  Returns type: int for possible future use
14 
15  Parameters: (in calling order)
16  Type Name I/O Description
17  ---- ---- --- -----------
18  char * file I hdf file to use
19  char * lbl_ras I expected raster image
20  label, if it says '*NONE*',
21  there is no raster
22  char * lbl_pal I expected palette label
23  int npix I expected # of pixels in
24  image
25  int nlin I expected # of lines in image
26 
27  Modification history:
28  Programmer Date Description of change
29  ---------- ---- ---------------------
30  W. Robinson 15-Mar-1995 Original development
31  W. Robinson 2-May-1995 adapt for no raster but a palettel
32  W. Robinson 30-Jun-1995 set fmt_status if problems
33  W. Robinson 13-jun-1996 DFANlablist expects char* even tho
34  it should be char** so cast it so
35  W. Robinson 4-aug-1997 disable the # raster images check
36  (hdfpack makes this 2 for some reason)
37 
38  *******************************************************************/
39  {
40  intn nimg, label_len = 300, pal_flg;
41  int nlbl, list_len = 300, ipix, ilin;
42  uint16 ref_list[300];
43  char label_list[300][300];
44  /*
45  * get the labels for the raster and palette and check them
46  * we only expect 1 image and palette
47  */
48  if (strcmp(lbl_ras, "*NONE*") != 0) {
49  nlbl = DFANlablist(file, DFTAG_RIG, ref_list, (char *) label_list,
50  list_len, label_len, 1);
51  if (nlbl != 1) {
52  printf("****dataset has improper # of raster images = %d\n",
53  nlbl);
54  fmt_status = fmt_status | 2;
55  }
56 
57  /*
58  * check label
59  */
60  if (strcmp(label_list[0], lbl_ras) != 0) {
61  printf(
62  "****Raster image has improper label\nread : '%s'\nexpected: '%s'\n",
63  label_list[0], lbl_ras);
64  fmt_status = fmt_status | 2;
65  }
66  }
67 
68  nlbl = DFANlablist(file, DFTAG_LUT, ref_list, (char *) label_list,
69  list_len, label_len, 1);
70  if (nlbl != 1) {
71  printf("****dataset has improper # of palettes = %d\n",
72  nlbl);
73  fmt_status = fmt_status | 2;
74  }
75 
76  /*
77  * check label
78  */
79  if (strcmp(label_list[0], lbl_pal) != 0) {
80  printf(
81  "****palette has improper label\nread : '%s'\nexpected: '%s'\n",
82  label_list[0], lbl_pal);
83  printf("However, this is alright (There should be no label)\n");
84  }
85  /*
86  * Ok, use DFR8nimages to see if any images are there
87  * use DFR8getdims to get the image info
88  * use DFR8getimage to finally get the image
89  */
90  if (strcmp(lbl_ras, "*NONE*") != 0) {
91  nimg = DFR8nimages(file);
92  if (nimg != 1) {
93  printf("****dataset has improper # of raster images = %d\n",
94  nimg);
95  /*
96  * WDR 4aug97 the hdf pack makes this 2 so disable it for now
97  fmt_status = fmt_status | 2;
98  return -1;
99  */
100  printf("However, this will be ignored while hdfpack is checked\n");
101  }
102 
103  if (DFR8getdims(file, (int32 *) & ipix, (int32 *) & ilin, &pal_flg) == -1) {
104  printf("****For raster image, DFR8getdims got an error\n");
105  fmt_status = fmt_status | 2;
106  return -1;
107  }
108  if (!pal_flg) {
109  printf("****DFR8getdims found no palette\n");
110  fmt_status = fmt_status | 2;
111  }
112 
113  if (ipix != npix) {
114  printf("****raster image has %d pixels, expected %d pixels\n",
115  ipix, npix);
116  fmt_status = fmt_status | 2;
117  }
118 
119  if (ilin != nlin) {
120  printf("****raster image has %d lines, expected %d lines\n",
121  ilin, nlin);
122  fmt_status = fmt_status | 2;
123  }
124  }
125  return 0;
126 }
int nlin
Definition: get_cmp.c:28
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
Definition: HISTORY.txt:413
int fmt_status
Definition: fmt_check.c:7
int hdf_ras_chk(char *file, char *lbl_ras, char *lbl_pal, int npix, int nlin)
Definition: hdf_ras_chk.c:6
int npix
Definition: get_cmp.c:27