Go to the documentation of this file.
33 char line[500], line_sav[500], str_typ[200], *
str, *str2;
34 int i,
j,
k, idim, ifound, ierr;
39 if ((fmt->sds_info = malloc(fmt->n_sds * sizeof ( sds_info_str)))
41 printf(
"**************Program error\n");
42 printf(
"in: %s, SDS description storage allocation failed\n", __FILE__);
49 for (
i = 0;
i < fmt->n_sds;
i++) {
51 printf(
"**************Program error\n");
52 printf(
"unable to read SDS description # %d of file:\n'%s'\n",
54 printf(
"last line read:\n'%s'\n",
line);
64 printf(
"**************Program error\n");
65 printf(
"unable to read SDS ctl line %d, entry #1\n",
i);
66 printf(
"last line read:\n'%s'\n", line_sav);
75 for (
j = 0;
j < 3;
j++) {
77 printf(
"**************Program error\n");
79 "unable to read SDS ctl value %d of line # %d of file:\n'%s'\n",
81 printf(
"last line read:\n'%s'\n", line_sav);
91 if (sscanf(
str,
"%d", &(fmt->sds_info[
i].n_attr)) == EOF) {
92 printf(
"**************Program error\n");
94 "Cannot decode SDS n_attr ctl, line %d, file:\n'%s'\n",
96 printf(
"last line read:\n'%s'\n", line_sav);
103 if (sscanf(
str,
"%d", &(fmt->sds_info[
i].rank)) == EOF) {
104 printf(
"**************Program error\n");
105 printf(
"Cannot decode SDS rank ctl, line %d, file:\n'%s'\n",
107 printf(
"last line read:\n'%s'\n", line_sav);
118 for (idim = 0; idim < fmt->sds_info[
i].rank; idim++) {
120 printf(
"**************Program error\n");
122 "unable to read SDS field %d of line # %d of file:\n'%s'\n",
123 idim * 2 + 5,
i,
file);
124 printf(
"last line read:\n'%s'\n", line_sav);
132 printf(
"**************Program error\n");
134 "unable to read SDS field %d of line # %d of file:\n'%s'\n",
135 idim * 2 + 6,
i,
file);
136 printf(
"last line read:\n'%s'\n", line_sav);
143 if (strcmp(
str,
"DSIZE_NOCK") == 0)
144 fmt->sds_info[
i].e_ranges[idim] = 0;
146 else if (strcmp(
str,
"DSIZE_CK") == 0) {
147 if (sscanf(str2,
"%d", &(fmt->sds_info[
i].e_ranges[idim]))
149 printf(
"**************Program error\n");
150 printf(
"unable to get dimension size from format table\n");
151 printf(
"for dimension %d, SDS field %d, of line %d of file:"
152 "\n'%s'\n", idim, idim * 2 + 6,
i,
file);
153 printf(
"last line read:\n'%s'\n", line_sav);
157 }
else if (strcmp(
str,
"DSIZE_DIM_NM") == 0) {
163 for (
k = 0;
k < fmt->n_dim_defs;
k++) {
164 if (strcmp(str2, fmt->dim_id[
k].att_short) == 0) {
166 fmt->sds_info[
i].e_ranges[idim] = -(
k + 1);
171 printf(
"**************Program error\n");
173 "No definition of %s was found in the array definition section\n",
175 printf(
"For dimension %d, SDS field %d, of line %d of file:"
176 "\n'%s'\n", idim, idim * 2 + 6,
i,
file);
177 printf(
"last line read:\n'%s'\n", line_sav);
186 if (strcmp(str_typ,
"DFNT_CHAR") == 0) {
187 fmt->sds_info[
i].type = DFNT_CHAR;
188 fmt->sds_info[
i].byt_per_val = 1;
189 }
else if (strcmp(str_typ,
"DFNT_INT16") == 0) {
191 fmt->sds_info[
i].byt_per_val = 2;
192 }
else if (strcmp(str_typ,
"DFNT_INT32") == 0) {
194 fmt->sds_info[
i].byt_per_val = 4;
195 }
else if (strcmp(str_typ,
"DFNT_FLOAT32") == 0) {
197 fmt->sds_info[
i].byt_per_val = 4;
198 }
else if (strcmp(str_typ,
"DFNT_FLOAT64") == 0) {
199 fmt->sds_info[
i].type = DFNT_FLOAT64;
200 fmt->sds_info[
i].byt_per_val = 4;
201 }
else if (strcmp(str_typ,
"DFNT_INT8") == 0) {
202 fmt->sds_info[
i].type = DFNT_INT8;
203 fmt->sds_info[
i].byt_per_val = 1;
204 }
else if (strcmp(str_typ,
"DFNT_UINT8") == 0) {
205 fmt->sds_info[
i].type = DFNT_UINT8;
206 fmt->sds_info[
i].byt_per_val = 1;
208 printf(
"**************Program error\n");
210 "Unplanned SDS format descript encountered for line %d of file:\n'%s'\n",
212 printf(
"last line read:\n'%s'\n", line_sav);
221 printf(
"**************Program error\n");
222 printf(
"range checking keyword must be provided\n");
223 printf(
"at field %d, line %d of file:\n'%s'\n",
224 7 + 2 * fmt->sds_info[
i].rank,
i,
file);
228 if (strcmp(
str,
"NO_MN_MX") == 0) {
229 fmt->sds_info[
i].flg_rng = 0;
230 }
else if (strcmp(
str,
"MN_MX_CK") == 0) {
231 fmt->sds_info[
i].flg_rng = 1;
233 for (
j = 0;
j < 2;
j++) {
235 printf(
"**************Program error\n");
237 "unable to find SDS range value #%d in desc # %d of file:\n'%s'\n",
239 printf(
"last line read:\n'%s'\n", line_sav);
244 (
void *) fmt->sds_info[
i].sds_rng.i32,
j, 1)) != 0) {
246 printf(
"**************Program error\n");
247 printf(
"unable to decode SDS range value #%d"
248 " in description # %d of file: n'%s'\n",
j,
i,
file);
249 printf(
"last line read:\n'%s'\n", line_sav);
254 printf(
"**************Program error\n");
255 printf(
"SDS range value # %d is out of range in descrip #"
256 " %d of file:\n'%s'\n",
j,
i,
file);
257 printf(
"last line read:\n'%s'\n", line_sav);
262 printf(
"**************Program error\n");
263 printf(
"data type of: %d is not handled by fmt_read currently\n",
265 printf(
"In descrip # %d of file:\n'%s'\n",
i,
file);
272 printf(
"**************Program error\n");
274 "Range checking keyword must be either 'NO_MN_MX' or 'MN_MX_CK'\n");
275 printf(
"at field %d, line %d of file:\n'%s'\n",
276 7 + 2 * fmt->sds_info[
i].rank,
i,
file);
char * get_line(char *, int, FILE *, int)
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
int var_decode(char *, int32, void *, int32, int32)
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
char * s_parse(char *, int)
int fmt_rd_sds(char *file, FILE *fid, fmt_str *fmt)
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT16
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_FLOAT32
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")