OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_dsd.c
Go to the documentation of this file.
1 /*
2 * $Id: epr_dsd.c,v 1.1.1.1 2004-10-28 19:22:23 norman Exp $
3 *
4 * Copyright (C) 2002 by Brockmann Consult (info@brockmann-consult.de)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation. This program is distributed in the hope it will
9 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 * See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 */
17 
18 #include <assert.h>
19 #include <errno.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #include "epr_api.h"
25 #include "epr_core.h"
26 #include "epr_string.h"
27 #include "epr_ptrarray.h"
28 #include "epr_swap.h"
29 #include "epr_field.h"
30 #include "epr_record.h"
31 #include "epr_param.h"
32 #include "epr_dsd.h"
33 #include "epr_msph.h"
34 #include "epr_band.h"
35 #include "epr_bitmask.h"
36 
37 #include "epr_dddb.h"
38 
39 
48 EPR_SDSD* epr_create_dsd(int dsd_index)
49 {
50  EPR_SDSD* dsd;
51  dsd = (EPR_SDSD*) calloc(1, sizeof (EPR_SDSD));
52  if (dsd == NULL) {
54  "epr_create_dsd: out of memory");
55  return NULL;
56  }
57  dsd->index = dsd_index;
58  return dsd;
59 }
60 
61 
62 
64 {
65  epr_clear_err();
66 
67  if (product_id == NULL) {
69  "epr_get_num_datasets: product_id must not be NULL");
70  return (epr_uint)-1;
71  }
72  return product_id->dataset_ids->length;
73 }
74 
75 EPR_SDatasetId* epr_get_dataset_id_at(EPR_SProductId* product_id, epr_uint index)
76 {
77  EPR_SDatasetId* dataset_id = NULL;
78 
79  epr_clear_err();
80 
81  if (product_id == NULL) {
83  "epr_get_dataset_id_at: product_id must not be NULL");
84  return NULL;
85  }
86  if (index >= product_id->dataset_ids->length){
88  "epr_get_dataset_id_at: dataset index out of range");
89  return NULL;
90  }
91 
92  dataset_id = (EPR_SDatasetId*)epr_get_ptr_array_elem_at(product_id->dataset_ids, index);
93  return dataset_id;
94 }
95 
96 EPR_SDatasetId* epr_get_dataset_id(EPR_SProductId* product_id, const char* dataset_name)
97 {
98  EPR_SDatasetId* dataset_id = NULL;
99  int datasets_num, i;
100 
101  epr_clear_err();
102 
103  if (product_id == NULL) {
105  "epr_get_dataset_id: product_id must not be NULL");
106  return NULL;
107  }
108  if (dataset_name == NULL) {
110  "epr_get_dataset_id: dataset_name must not be NULL");
111  return NULL;
112  }
113 
114  datasets_num = epr_get_num_datasets(product_id);
115  for (i = 0; i < datasets_num; i ++) {
116  dataset_id = epr_get_dataset_id_at(product_id, i);
117  if (epr_equal_names(dataset_name, epr_get_dataset_name(dataset_id)))
118  return dataset_id;
119  }
121  "epr_get_dataset_id: dataset_id not found");
122  return NULL;
123 }
124 
126 {
127  EPR_SDSD** elems;
128  int size = 0;
129  int rec_size = 0;
130  int i, ioddFormat = 7;
131  char* name;
132 
133  /* reflect L1b product format change from IODD5 to IODD6 */
134  if (strncmp("MER_RR__1P", product_id->id_string, 10) == 0
135  || strncmp("MER_FR__1P", product_id->id_string, 10) == 0) {
136 
137  elems = (EPR_SDSD**)product_id->dsd_array->elems;
138  size = product_id->dsd_array->length;
139  for (i=0; i< size;i++){
140  name = elems[i]->ds_name;
141  if (strcmp("Flags MDS(16)", name) == 0) {
142  rec_size = elems[i]->dsr_size;
143  if (rec_size == 2255 || rec_size == 4495) {
144  ioddFormat = 5;
145  }
146  break;
147  }
148  }
149  }
150  /* reflect L2 product format change from IODD6 to IODD7 */
151  else if (strncmp("MER_RR__2P", product_id->id_string, 10) == 0
152  || strncmp("MER_FR__2P", product_id->id_string, 10) == 0) {
153 
154  elems = (EPR_SDSD**)product_id->dsd_array->elems;
155  size = product_id->dsd_array->length;
156  for (i=0; i<size; i++){
157  name = elems[i]->ds_name;
158  if (strcmp("Epsilon, OPT - MDS(19)", name) == 0) {
159  ioddFormat = 6;
160  break;
161  }
162  }
163  }
164  return ioddFormat;
165 }
166 
167 
175 void epr_free_dsd(EPR_SDSD* dsd)
176 {
177  if (dsd == NULL)
178  return;
179 
180  epr_free_string(dsd->ds_name);
181  dsd->ds_name = NULL;
182 
183  epr_free_string(dsd->ds_type);
184  dsd->ds_type = NULL;
185 
186  epr_free_string(dsd->filename);
187  dsd->filename = NULL;
188 
189  dsd->index = 0;
190  dsd->ds_offset = 0;
191  dsd->ds_size = 0;
192  dsd->num_dsr = 0;
193  dsd->dsr_size = 0;
194 
195  free(dsd);
196 }
197 
198 
199 #define EPR_LENGTH_DS_NAME_IDENTIFIER 9
200 #define EPR_LENGTH_DS_TYPE_IDENTIFIER 8
201 #define EPR_LENGTH_FILENAME_IDENTIFIER 10
202 #define EPR_LENGTH_DS_OFFSEN_IDENTIFIER 11
203 #define EPR_LENGTH_DS_SIZE_IDENTIFIER 9
204 #define EPR_LENGTH_NUM_DSR_IDENTIFIER 9
205 #define EPR_LENGTH_DSR_SIZE_IDENTIFIER 10
206 
207 #define EPR_LENGTH_DS_NAME_FIELD 39
208 #define EPR_LENGTH_DS_TYPE_FIELD 10
209 #define EPR_LENGTH_DS_FILENAME_FIELD 74
210 #define EPR_LENGTH_DS_OFFSEN_FIELD 39
211 #define EPR_LENGTH_DS_SIZE_FIELD 37
212 #define EPR_LENGTH_NUM_DSR_FIELD 20
213 #define EPR_LENGTH_DSR_SIZE_FIELD 28
214 
215 #define EPR_LENGTH_EMPTY_FIELD 33
216 
217 
226 EPR_SDSD* epr_read_each_dsd(FILE* envisat_source_file, int* pos)
227 {
228  epr_uint l;
229  epr_uint l_limit;
230  char code_block[EPR_LINE_MAX_LENGTH];
231  EPR_SDSD* dsd;
232  int ch = '"';
233  char* tmp;
234 
235  if (envisat_source_file == NULL)
236  {
238  "epr_read_each_dsd: the product file handle must not be NULL");
239  return NULL;
240  }
241 
242  dsd = (EPR_SDSD*) calloc(1, sizeof (EPR_SDSD));
243  if (dsd == NULL)
244  {
246  "epr_read_each_dsd: out of memory");
247  return NULL;
248  }
249 
250  if (* pos == 0)
251  {
252  l_limit = 9999;
253  }
254  else l_limit = 0;
255 
256  for (l = 0; l <= l_limit; l++)
257  {
258  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
259  if (strncmp (code_block, "DS_NAME=\"", EPR_LENGTH_DS_NAME_IDENTIFIER) == 0)
260  {
261  /* DS_NAME to be searched for */
262  if (((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_DS_NAME_FIELD)) || ((epr_uint)(strrchr(code_block, ch) - code_block) != (epr_uint)(strlen(code_block) - 2)))
263  {
265  "epr_read_each_dsd: invalid dataset name format");
266  epr_free_dsd(dsd);
267  return NULL;
268  }
269  dsd->ds_name = epr_sub_string(code_block, EPR_LENGTH_DS_NAME_IDENTIFIER, strlen(code_block) - EPR_LENGTH_DS_NAME_IDENTIFIER - 2);
270  if (dsd->ds_name == NULL)
271  {
273  "epr_read_each_dsd: invalid DS_NAME value");
274  epr_free_dsd(dsd);
275  return NULL;
276  }
277 
278  /* DS_TYPE to be searched for */
279  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
280  if (strncmp (code_block, "DS_TYPE=", EPR_LENGTH_DS_TYPE_IDENTIFIER) == 0)
281  {
282  dsd->ds_type = epr_sub_string(code_block, EPR_LENGTH_DS_TYPE_IDENTIFIER, strlen(code_block) - EPR_LENGTH_DS_TYPE_IDENTIFIER - 1);
283  if (dsd->ds_type == NULL)
284  {
286  "epr_read_each_dsd: invalid DS_TYPE value");
287  epr_free_dsd(dsd);
288  return NULL;
289  }
290  }
291 
292  /* FILENAME to be searched for */
293  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
294  if (strncmp (code_block, "FILENAME=\"", EPR_LENGTH_FILENAME_IDENTIFIER) == 0)
295  {
296  if (((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_DS_FILENAME_FIELD)) || ((epr_uint)(strrchr(code_block, ch) - code_block) != (epr_uint)(strlen(code_block) - 2)))
297  {
299  "epr_read_each_dsd: invalid dataset filename format");
300  epr_free_dsd(dsd);
301  return NULL;
302  }
303  dsd->filename = epr_sub_string(code_block, EPR_LENGTH_FILENAME_IDENTIFIER, strlen(code_block) - EPR_LENGTH_FILENAME_IDENTIFIER - 1);
304  if (dsd->ds_name == NULL)
305  {
307  "epr_read_each_dsd: invalid file name");
308  epr_free_dsd(dsd);
309  return NULL;
310  }
311  }
312 
313  /* DS_OFFSET to be searched for */
314  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
315  if (strncmp (code_block, "DS_OFFSET=+", EPR_LENGTH_DS_OFFSEN_IDENTIFIER) == 0)
316  {
317  if (((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_DS_OFFSEN_FIELD)) || (strncmp(code_block + strlen(code_block) - strlen("<bytes>") - 1, "<bytes>", strlen("<bytes>")) != 0))
318  {
320  "epr_read_each_dsd: invalid dataset filename format");
321  epr_free_dsd(dsd);
322  return NULL;
323  }
324 
325  tmp = epr_sub_string(code_block, EPR_LENGTH_DS_OFFSEN_IDENTIFIER, strlen(code_block) - strlen("<bytes>") - EPR_LENGTH_DS_OFFSEN_IDENTIFIER - 1);
326  dsd->ds_offset = (epr_uint)epr_str_to_number(tmp);
328  if (dsd->ds_offset == -1)
329  {
331  "epr_read_each_dsd: invalid OFFSET value");
332  epr_free_dsd(dsd);
333  return NULL;
334  }
335  }
336 
337  /* DS_SIZE to be searched for */
338  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
339  if (strncmp (code_block, "DS_SIZE=+", EPR_LENGTH_DS_SIZE_IDENTIFIER) == 0)
340  {
341  if (((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_DS_SIZE_FIELD)) || (strncmp(code_block + strlen(code_block) - strlen("<bytes>") - 1, "<bytes>", strlen("<bytes>")) != 0))
342  {
344  "epr_read_each_dsd: invalid dataset filename format");
345  epr_free_dsd(dsd);
346  return NULL;
347  }
348  tmp = epr_sub_string(code_block, EPR_LENGTH_DS_SIZE_IDENTIFIER, strlen(code_block) - strlen("<bytes>") - EPR_LENGTH_DS_SIZE_IDENTIFIER - 1);
349  dsd->ds_size = (epr_uint)epr_str_to_number(tmp);
351  if (dsd->ds_size == -1)
352  {
354  "epr_read_each_dsd: invalid OFFSET value");
355  epr_free_dsd(dsd);
356  return NULL;
357  }
358  }
359 
360  /* NUM_DSR to be searched for */
361  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
362  if (strncmp (code_block, "NUM_DSR=+", EPR_LENGTH_NUM_DSR_IDENTIFIER) == 0)
363  {
364  if ((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_NUM_DSR_FIELD))
365  {
367  "epr_read_each_dsd: invalid dataset record number format");
368  epr_free_dsd(dsd);
369  return NULL;
370  }
371  tmp = epr_sub_string(code_block, EPR_LENGTH_NUM_DSR_IDENTIFIER, strlen(code_block) - EPR_LENGTH_NUM_DSR_IDENTIFIER - 1);
372  dsd->num_dsr = (epr_uint)epr_str_to_number(tmp);
374  if (dsd->num_dsr == -1)
375  {
377  "epr_read_each_dsd: invalid dsr number value");
378  epr_free_dsd(dsd);
379  return NULL;
380  }
381  }
382 
383  /* DSR_SIZE to be searched for */
384  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
385  if (strncmp (code_block, "DSR_SIZE=+", EPR_LENGTH_DSR_SIZE_IDENTIFIER) == 0)
386  {
387  if (((epr_uint)strlen(code_block) != (epr_uint)(EPR_LENGTH_DSR_SIZE_FIELD)) || (strncmp(code_block + strlen(code_block) - strlen("<bytes>") - 1, "<bytes>", strlen("<bytes>")) != 0))
388  {
390  "epr_read_each_dsd: invalid dataset record size format");
391  epr_free_dsd(dsd);
392  return NULL;
393  }
394  tmp = epr_sub_string(code_block, EPR_LENGTH_DSR_SIZE_IDENTIFIER, strlen(code_block) - strlen("<bytes>") - EPR_LENGTH_DSR_SIZE_IDENTIFIER - 1);
395  dsd->dsr_size = (epr_uint)epr_str_to_number(tmp);
397  if (dsd->dsr_size == -1)
398  {
400  "epr_read_each_dsd: invalid record size value");
401  epr_free_dsd(dsd);
402  return NULL;
403  }
404  }
405 
406  /* EMPTY LINE BETWEEN DSD's */
407  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
408  if ((strlen(code_block) > 0) && (code_block[0] != ' '))
409  {
411  "epr_read_each_dsd: invalid code_block, must be empty");
412  epr_free_dsd(dsd);
413  return NULL;
414  }
415  *pos = *pos + 1;
416  return dsd;
417  }
418  }
419  epr_free_dsd(dsd);
420  return NULL;
421 }
422 
423 
433 epr_uint epr_find_first_dsd(FILE* envisat_source_file, epr_uint sph_length)
434 {
435  epr_uint l;
436  char code_block[EPR_LINE_MAX_LENGTH];
437 
438  if (envisat_source_file == NULL)
439  {
441  "epr_find_first_dsd: the product file handle must not be NULL");
442  return 0;
443  }
444 
445  l = 0;
446  while (l < sph_length)
447  {
448  fgets(code_block, EPR_LINE_MAX_LENGTH, envisat_source_file);
449  if (strncmp (code_block, "DS_NAME=\"", EPR_LENGTH_DS_NAME_IDENTIFIER) == 0)
450  {
451  return l;
452  }
453  else {
454  l += strlen(code_block);
455  }
456  }
457  return 0;
458 }
459 
460 #define EPR_LENGTH_NUM_DSD_FIELD 20
461 
469 EPR_SPtrArray* epr_read_all_dsds(EPR_SProductId* product_id)
470 {
471  EPR_SPtrArray* dsds_array = NULL;
472  EPR_SRecord* dsd_record = NULL;
473  const EPR_SField* field;
474  EPR_SDSD* dsd;
475  epr_uint sph_length;
476  char* code_block;
477  int numread;
478  epr_uint dsd_number = 0;
479  epr_uint dsd_begin = 0;
480  epr_uint dsd_index;
481 
482  if (product_id == NULL) {
484  "epr_read_all_dsds: product_id must not be NULL");
485  return NULL;
486  }
487 
488  dsds_array = epr_create_ptr_array(32);
489 
490  field = epr_get_field(product_id->mph_record, "NUM_DSD");
491  dsd_number = ((epr_uint*) field->elems)[0];
492  /*dsd_begin = epr_api.epr_head_size - dsd_number * EPR_DSD_SIZE;*/
493 
494  if (fseek(product_id->istream, EPR_MPH_SIZE, SEEK_SET) != 0) {
496  "epr_read_all_dsds: file seek failed");
497  if (dsds_array != NULL) {
498  epr_free_ptr_array(dsds_array);
499  }
500  return NULL;
501  }
502  field = epr_get_field(product_id->mph_record, "SPH_SIZE");
503  sph_length = ((epr_uint*) field->elems)[0];
504  dsd_begin = EPR_MPH_SIZE + (epr_uint)epr_find_first_dsd(product_id->istream, sph_length);
505  if (dsd_begin == EPR_MPH_SIZE) {
507  "epr_read_all_dsds: no DS_NAME in SPH");
508  if (dsds_array != NULL) {
509  epr_free_ptr_array(dsds_array);
510  }
511  return NULL;
512  }
513  for(dsd_index = 0; dsd_index < dsd_number; dsd_index ++) {
514  if (fseek(product_id->istream, dsd_begin + dsd_index * EPR_DSD_SIZE, SEEK_SET) != 0) {
516  "epr_read_all_dsds: file seek failed");
517  if (dsds_array != NULL) {
518  epr_free_ptr_array(dsds_array);
519  }
520  return NULL;
521  }
522  code_block = epr_create_string(EPR_DSD_SIZE);
523  numread = fread(code_block, 1, EPR_DSD_SIZE, product_id->istream);
524  if ((epr_uint)numread != EPR_DSD_SIZE) {
526  "epr_read_all_dsds: error in reading SPH from product data file");
527  if (code_block != NULL) {
528  epr_free_string(code_block);
529  code_block = NULL;
530  }
531  if (dsds_array != NULL) {
532  epr_free_ptr_array(dsds_array);
533  }
534  return NULL;
535  }
536 
537 
538  /* If this is NOT an empty DSD (empty DSD's seem to be quite 'normal')
539  */
540  if ((strlen(code_block) > 0) && (code_block[0] != ' ')) {
541 
542  dsd_record = epr_parse_header("dsd", code_block);
543 
544  dsd = epr_create_dsd(dsd_index);
545 
546  if (dsd == NULL) {
548  "epr_read_all_dsds: out of memory");
549  if (code_block != NULL) {
550  epr_free_string(code_block);
551  code_block = NULL;
552  }
553  if (dsd_record != NULL) {
554  epr_free_record_info(dsd_record->info);
555  dsd_record->info = NULL;
556  epr_free_record(dsd_record);
557  dsd_record = NULL;
558  }
559  if (dsds_array != NULL) {
560  epr_free_ptr_array(dsds_array);
561  }
562  return NULL;
563  }
564 
565  field = epr_get_field(dsd_record, "DS_NAME");
566  dsd->ds_name = epr_clone_string((char*)field->elems);
567  field = epr_get_field(dsd_record, "DS_TYPE");
568  dsd->ds_type = epr_sub_string((char*)field->elems, 0, sizeof(epr_uchar));
569  field = epr_get_field(dsd_record, "FILENAME");
570  dsd->filename = epr_clone_string((char*)field->elems);
571  field = epr_get_field(dsd_record, "DS_OFFSET");
572  dsd->ds_offset = (epr_uint)((epr_uint*) field->elems)[0];
573 
574  field = epr_get_field(dsd_record, "DS_SIZE");
575  dsd->ds_size = (epr_uint)((epr_uint*) field->elems)[0];
576 
577  field = epr_get_field(dsd_record, "NUM_DSR");
578  dsd->num_dsr = (epr_uint)((epr_uint*) field->elems)[0];
579 
580  field = epr_get_field(dsd_record, "DSR_SIZE");
581  dsd->dsr_size = (epr_uint)((epr_uint*) field->elems)[0];
582 
583  epr_add_ptr_array_elem(dsds_array, dsd);
584 
585  if (dsd_record != NULL) {
586  /* NOTE:dsd_record->info is not a shared object, it is NOT used by
587  * multiple instances of a DSD record, and thus, we free it here!
588  */
589  epr_free_record_info(dsd_record->info);
590  dsd_record->info = NULL;
591 
592  epr_free_record(dsd_record);
593  dsd_record = NULL;
594  } else {
595  printf("%s\n", epr_get_last_err_message());
596  }
597 
598  } else {
599  epr_log(e_log_debug, "empty DSD seen (don't worry)");
600  }
601 
602  epr_free_string(code_block);
603  code_block = NULL;
604  }
605 
606  rewind(product_id->istream);
607  return dsds_array;
608 }
609 
610 epr_uint epr_get_num_dsds(const EPR_SProductId* product_id)
611 {
612  return product_id->dsd_array->length;
613 }
614 
615 EPR_SDSD* epr_get_dsd_at(const EPR_SProductId* product_id, epr_uint dsd_index)
616 {
617  EPR_SDSD* dsd = NULL;
618  dsd = (EPR_SDSD*) epr_get_ptr_array_elem_at(product_id->dsd_array, dsd_index);
619  return dsd;
620 }
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 EPR_LENGTH_DS_OFFSEN_IDENTIFIER
Definition: epr_dsd.c:202
@ e_err_out_of_memory
Definition: epr_api.h:83
@ e_err_invalid_band_name
Definition: epr_api.h:106
@ e_log_debug
Definition: epr_api.h:125
#define EPR_LENGTH_DSR_SIZE_IDENTIFIER
Definition: epr_dsd.c:205
epr_uint epr_get_num_dsds(const EPR_SProductId *product_id)
Definition: epr_dsd.c:610
#define EPR_LENGTH_DS_SIZE_IDENTIFIER
Definition: epr_dsd.c:203
void epr_free_dsd(EPR_SDSD *dsd)
Definition: epr_dsd.c:175
unsigned int epr_uint
Definition: epr_api.h:188
void epr_free_ptr_array(EPR_SPtrArray *ptr_array)
Definition: epr_ptrarray.c:51
void epr_free_record(EPR_SRecord *record)
Definition: epr_record.c:405
int epr_str_to_number(const char *str)
Definition: epr_core.c:328
#define NULL
Definition: decode_rs.h:63
char * epr_sub_string(const char *str, int start, int length)
Definition: epr_string.c:62
EPR_SDSD * epr_create_dsd(int dsd_index)
Definition: epr_dsd.c:48
#define EPR_LENGTH_NUM_DSR_FIELD
Definition: epr_dsd.c:212
float32 * pos
Definition: l1_czcs_hdf.c:35
@ e_err_file_access_denied
Definition: epr_api.h:90
#define EPR_LENGTH_DS_SIZE_FIELD
Definition: epr_dsd.c:211
#define EPR_LENGTH_DS_TYPE_IDENTIFIER
Definition: epr_dsd.c:200
@ e_err_invalid_data_format
Definition: epr_api.h:107
#define EPR_LENGTH_DS_NAME_FIELD
Definition: epr_dsd.c:207
const EPR_SField * epr_get_field(const EPR_SRecord *record, const char *field_name)
Definition: epr_field.c:247
#define EPR_LENGTH_DS_NAME_IDENTIFIER
Definition: epr_dsd.c:199
char * epr_create_string(unsigned int length)
Definition: epr_string.c:37
epr_boolean epr_equal_names(const char *name1, const char *name2)
Definition: epr_string.c:91
#define EPR_LENGTH_DS_OFFSEN_FIELD
Definition: epr_dsd.c:210
const char * epr_get_last_err_message()
Definition: epr_core.c:281
EPR_SDatasetId * epr_get_dataset_id(EPR_SProductId *product_id, const char *dataset_name)
Definition: epr_dsd.c:96
@ e_err_null_pointer
Definition: epr_api.h:80
int epr_detect_meris_iodd_version(EPR_SProductId *product_id)
Definition: epr_dsd.c:125
#define EPR_LINE_MAX_LENGTH
Definition: epr_core.h:65
EPR_SRecord * epr_parse_header(const char *header_name, const char *ascii_source)
Definition: epr_msph.c:174
void epr_free_record_info(EPR_SRecordInfo *record_info)
Definition: epr_record.c:109
data_t tmp
Definition: decode_rs.h:74
char * epr_clone_string(const char *str)
Definition: epr_string.c:43
@ e_err_file_read_error
Definition: epr_api.h:91
@ e_err_index_out_of_range
Definition: epr_api.h:84
@ e_err_invalid_value
Definition: epr_api.h:108
#define EPR_LENGTH_FILENAME_IDENTIFIER
Definition: epr_dsd.c:201
const char * epr_get_dataset_name(EPR_SDatasetId *dataset_id)
Definition: epr_dataset.c:172
What value is used by your function when the data value is bad Default is BAD_FLT l2prod product_id[0]
EPR_SPtrArray * epr_read_all_dsds(EPR_SProductId *product_id)
Definition: epr_dsd.c:469
epr_uint epr_get_num_datasets(EPR_SProductId *product_id)
Definition: epr_dsd.c:63
void * epr_get_ptr_array_elem_at(const EPR_SPtrArray *ptr_array, unsigned int index)
Definition: epr_ptrarray.c:122
int epr_add_ptr_array_elem(EPR_SPtrArray *ptr_array, void *elem)
Definition: epr_ptrarray.c:75
void epr_log(EPR_ELogLevel log_level, const char *log_message)
Definition: epr_core.c:199
void epr_clear_err()
Definition: epr_core.c:247
void epr_set_err(EPR_EErrCode err_code, const char *err_message)
Definition: epr_core.c:221
#define EPR_MPH_SIZE
Definition: epr_core.h:46
#define EPR_LENGTH_NUM_DSR_IDENTIFIER
Definition: epr_dsd.c:204
#define EPR_DSD_SIZE
Definition: epr_core.h:48
epr_uint epr_find_first_dsd(FILE *envisat_source_file, epr_uint sph_length)
Definition: epr_dsd.c:433
EPR_SDatasetId * epr_get_dataset_id_at(EPR_SProductId *product_id, epr_uint index)
Definition: epr_dsd.c:75
#define EPR_LENGTH_DSR_SIZE_FIELD
Definition: epr_dsd.c:213
for(i=0;i< NROOTS;i++) s[i]
Definition: decode_rs.h:85
unsigned char epr_uchar
Definition: epr_api.h:186
EPR_SDSD * epr_read_each_dsd(FILE *envisat_source_file, int *pos)
Definition: epr_dsd.c:226
int i
Definition: decode_rs.h:71
EPR_SDSD * epr_get_dsd_at(const EPR_SProductId *product_id, epr_uint dsd_index)
Definition: epr_dsd.c:615
void epr_free_string(char *str)
Definition: epr_string.c:100
#define EPR_LENGTH_DS_FILENAME_FIELD
Definition: epr_dsd.c:209
EPR_SPtrArray * epr_create_ptr_array(unsigned int capacity)
Definition: epr_ptrarray.c:29