OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ias_odl_read_tree.c
Go to the documentation of this file.
1 /******************************************************************************
2 
3 UNIT NAME: ias_odl_read_tree.c
4 
5 PURPOSE: Open and parse the ODL file.
6 
7 RETURN VALUE:
8  Type = OBJDESC *
9 
10 Value Description
11 --------------- ----------------------------------------------------------------
12 successful Pointer to ODL tree
13 NULL Failure
14 
15 ******************************************************************************/
16 
17 #include <sys/param.h>
18 #include "lablib3.h" /* prototypes for the ODL functions */
19 #include "ias_odl.h"
20 #include "ias_logging.h"
21 
22 extern char ODLErrorMessage[]; /* External Variables */
23 
24 IAS_OBJ_DESC *ias_odl_read_tree
25 (
26  const char *p_ODLFile /* I: file to read */
27 )
28 {
29  OBJDESC *p_lp= NULL; /* pointer to struct to populate */
30  char ODLPathName[MAXPATHLEN]; /* file path buffer */
31  ODLErrorMessage[0] = '\0'; /* error message buffer */
32 
33  strncpy(ODLPathName, p_ODLFile, MAXPATHLEN);
34 
35  /* open and parse ODL file - error messages are suppressed */
36  if ((p_lp = OdlParseLabelFile(ODLPathName, NULL, ODL_NOEXPAND, TRUE))
37  == NULL)
38  {
39  IAS_LOG_ERROR("ODL Error on File: %s: %s", ODLPathName,
41  return NULL;
42  }
43 
44  /* Check of ODL syntax errors */
45  if (ODLErrorMessage[0] != '\0')
46  {
48  OdlFreeTree(p_lp);
49  return NULL;
50  }
51 
52  return p_lp;
53 }
#define IAS_LOG_ERROR(format,...)
Definition: ias_logging.h:96
#define NULL
Definition: decode_rs.h:63
#define TRUE
Definition: rice.h:165
OBJDESC * OdlParseLabelFile(char *filespec, char *message_fname, MASK expand, unsigned short suppress_messages)
Definition: lablib3.c:124
IAS_OBJ_DESC * ias_odl_read_tree(const char *p_ODLFile)
char ODLErrorMessage[]
Definition: lablib3.c:3061
OBJDESC * OdlFreeTree(OBJDESC *object)
Definition: lablib3.c:2459
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)
#define ODL_NOEXPAND
Definition: lablib3.h:33