OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_core.h File Reference
#include <stdio.h>
#include "epr_ptrarray.h"
Include dependency graph for epr_core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EPR_SAPI
 

Macros

#define EPR_ENVISAT_PRODUCT_MERIS   "MER"
 
#define EPR_ENVISAT_PRODUCT_ASAR   "ASA"
 
#define EPR_ENVISAT_PRODUCT_SAR   "SAR"
 
#define EPR_ENVISAT_PRODUCT_AATSR   "ATS"
 
#define EPR_LONGI_BAND_NAME   "longitude"
 
#define EPR_AATSR_LINES_PER_TIE_PT   32
 
#define EPR_MPH_SIZE   1247
 
#define EPR_SPH_SIZE   11622
 
#define EPR_DSD_SIZE   280
 
#define EPR_PRODUCT_MPH_SIZE   1048 /*??????*/
 
#define EPR_PRODUCT_MAGIC_STR   "PRODUCT=\""
 
#define EPR_PRODUCT_ID_OFFSET   9
 
#define EPR_PRODUCT_TYPE_ID_STRLEN   10
 
#define EPR_LENGTH_NUM_DSD_IDENTIFIER   9
 
#define EPR_COUNT_SEPARATOR_ARRAY   ",*"
 
#define EPR_IRRELEVANCE_SYMBOL   '*'
 
#define EPR_FIELD_SEPARATOR_ARRAY   "|"
 
#define EPR_HEADER_SEPARATOR_ARRAY   "=<>"
 
#define EPR_HEADER_EXCEPTIONS_ARRAY   "eE"
 
#define EPR_LONGI_ABS_MAX   180
 
#define EPR_LONGI_ABS_MIN   -180
 
#define EPR_LINE_MAX_LENGTH   2000
 
#define EPR_BE_MAGIC_NUMBER   1162761801UL
 
#define EPR_LE_MAGIC_NUMBER   1230392901UL
 
#define EPR_LE_MAGIC_BYTE_0   'E'
 
#define EPR_LE_MAGIC_BYTE_1   'N'
 
#define EPR_LE_MAGIC_BYTE_2   'V'
 
#define EPR_LE_MAGIC_BYTE_3   'I'
 
#define EPR_ATS_NUM_PER_POINT_ACROSS_LOCAT   23
 
#define EPR_ATS_NUM_PER_POINT_ACROSS_SOLAR   11
 
#define EPR_ATS_LINE_LENGTH   512
 
#define EPR_ASAR_NUM_PER_POINT_ACROSS_LOCAT   11
 

Typedefs

typedef struct EPR_Parameter EPR_SParameter
 

Functions

void epr_free_product_id (EPR_SProductId *product_id)
 
void epr_log (EPR_ELogLevel log_level, const char *log_message)
 
void epr_set_err (EPR_EErrCode err_code, const char *err_message)
 
EPR_SRecord * epr_read_mph (EPR_SProductId *product_id)
 
EPR_SRecord * epr_read_sph (EPR_SProductId *product_id)
 
EPR_EDataTypeId epr_str_to_data_type_id (const char *str)
 
char * epr_build_db_file_istream_name (EPR_SProductId *product_id, char *what)
 
FILE * epr_open_file (char *path_to_file)
 
int epr_str_to_number (const char *str)
 
epr_uint epr_parse_value_count (EPR_SProductId *product_id, const char *str)
 
epr_uint epr_param_to_value (const char *str, EPR_SPtrArray *param_table)
 
void epr_make_os_compatible_path (char *path)
 
epr_boolean epr_check_api_init_flag ()
 
void epr_output_element (const EPR_SField *field, epr_uint field_index, epr_uint element_index, FILE *istream)
 

Variables

EPR_SAPI epr_api
 

Macro Definition Documentation

◆ EPR_AATSR_LINES_PER_TIE_PT

#define EPR_AATSR_LINES_PER_TIE_PT   32

Definition at line 44 of file epr_core.h.

◆ EPR_ASAR_NUM_PER_POINT_ACROSS_LOCAT

#define EPR_ASAR_NUM_PER_POINT_ACROSS_LOCAT   11

Definition at line 78 of file epr_core.h.

◆ EPR_ATS_LINE_LENGTH

#define EPR_ATS_LINE_LENGTH   512

Definition at line 76 of file epr_core.h.

◆ EPR_ATS_NUM_PER_POINT_ACROSS_LOCAT

#define EPR_ATS_NUM_PER_POINT_ACROSS_LOCAT   23

Definition at line 74 of file epr_core.h.

◆ EPR_ATS_NUM_PER_POINT_ACROSS_SOLAR

#define EPR_ATS_NUM_PER_POINT_ACROSS_SOLAR   11

Definition at line 75 of file epr_core.h.

◆ EPR_BE_MAGIC_NUMBER

#define EPR_BE_MAGIC_NUMBER   1162761801UL

Definition at line 67 of file epr_core.h.

◆ EPR_COUNT_SEPARATOR_ARRAY

#define EPR_COUNT_SEPARATOR_ARRAY   ",*"

Definition at line 56 of file epr_core.h.

◆ EPR_DSD_SIZE

#define EPR_DSD_SIZE   280

Definition at line 48 of file epr_core.h.

◆ EPR_ENVISAT_PRODUCT_AATSR

#define EPR_ENVISAT_PRODUCT_AATSR   "ATS"

Definition at line 40 of file epr_core.h.

◆ EPR_ENVISAT_PRODUCT_ASAR

#define EPR_ENVISAT_PRODUCT_ASAR   "ASA"

Definition at line 38 of file epr_core.h.

◆ EPR_ENVISAT_PRODUCT_MERIS

#define EPR_ENVISAT_PRODUCT_MERIS   "MER"

Definition at line 37 of file epr_core.h.

◆ EPR_ENVISAT_PRODUCT_SAR

#define EPR_ENVISAT_PRODUCT_SAR   "SAR"

Definition at line 39 of file epr_core.h.

◆ EPR_FIELD_SEPARATOR_ARRAY

#define EPR_FIELD_SEPARATOR_ARRAY   "|"

Definition at line 58 of file epr_core.h.

◆ EPR_HEADER_EXCEPTIONS_ARRAY

#define EPR_HEADER_EXCEPTIONS_ARRAY   "eE"

Definition at line 60 of file epr_core.h.

◆ EPR_HEADER_SEPARATOR_ARRAY

#define EPR_HEADER_SEPARATOR_ARRAY   "=<>"

Definition at line 59 of file epr_core.h.

◆ EPR_IRRELEVANCE_SYMBOL

#define EPR_IRRELEVANCE_SYMBOL   '*'

Definition at line 57 of file epr_core.h.

◆ EPR_LE_MAGIC_BYTE_0

#define EPR_LE_MAGIC_BYTE_0   'E'

Definition at line 69 of file epr_core.h.

◆ EPR_LE_MAGIC_BYTE_1

#define EPR_LE_MAGIC_BYTE_1   'N'

Definition at line 70 of file epr_core.h.

◆ EPR_LE_MAGIC_BYTE_2

#define EPR_LE_MAGIC_BYTE_2   'V'

Definition at line 71 of file epr_core.h.

◆ EPR_LE_MAGIC_BYTE_3

#define EPR_LE_MAGIC_BYTE_3   'I'

Definition at line 72 of file epr_core.h.

◆ EPR_LE_MAGIC_NUMBER

#define EPR_LE_MAGIC_NUMBER   1230392901UL

Definition at line 68 of file epr_core.h.

◆ EPR_LENGTH_NUM_DSD_IDENTIFIER

#define EPR_LENGTH_NUM_DSD_IDENTIFIER   9

Definition at line 55 of file epr_core.h.

◆ EPR_LINE_MAX_LENGTH

#define EPR_LINE_MAX_LENGTH   2000

Definition at line 65 of file epr_core.h.

◆ EPR_LONGI_ABS_MAX

#define EPR_LONGI_ABS_MAX   180

Definition at line 62 of file epr_core.h.

◆ EPR_LONGI_ABS_MIN

#define EPR_LONGI_ABS_MIN   -180

Definition at line 63 of file epr_core.h.

◆ EPR_LONGI_BAND_NAME

#define EPR_LONGI_BAND_NAME   "longitude"

Definition at line 42 of file epr_core.h.

◆ EPR_MPH_SIZE

#define EPR_MPH_SIZE   1247

Definition at line 46 of file epr_core.h.

◆ EPR_PRODUCT_ID_OFFSET

#define EPR_PRODUCT_ID_OFFSET   9

Definition at line 52 of file epr_core.h.

◆ EPR_PRODUCT_MAGIC_STR

#define EPR_PRODUCT_MAGIC_STR   "PRODUCT=\""

Definition at line 51 of file epr_core.h.

◆ EPR_PRODUCT_MPH_SIZE

#define EPR_PRODUCT_MPH_SIZE   1048 /*??????*/

Definition at line 50 of file epr_core.h.

◆ EPR_PRODUCT_TYPE_ID_STRLEN

#define EPR_PRODUCT_TYPE_ID_STRLEN   10

Definition at line 54 of file epr_core.h.

◆ EPR_SPH_SIZE

#define EPR_SPH_SIZE   11622

Definition at line 47 of file epr_core.h.

Typedef Documentation

◆ EPR_SParameter

typedef struct EPR_Parameter EPR_SParameter

Definition at line 34 of file epr_core.h.

Function Documentation

◆ epr_build_db_file_istream_name()

char* epr_build_db_file_istream_name ( EPR_SProductId *  product_id,
char *  what 
)

Compares the two given names and returns TRUE if they are equal ignoring the case of each letter.

This function is used to compare names throughout the ENVISAT product reader API.

Parameters
name1the first name, must not be NULL
name2the second name, must not be NULL
Returns
TRUE if the names are equal, FALSE otherwise

◆ epr_check_api_init_flag()

epr_boolean epr_check_api_init_flag ( )

Definition at line 475 of file epr_core.c.

◆ epr_free_product_id()

void epr_free_product_id ( EPR_SProductId *  product_id)

Frees the memory allocated by the given product file identifier.

After calling this function the give product file identifier pointer gets invalid and should not be used anymore.

Parameters
recordthe product file identifier to be released, if NULL the function immediately returns

Destructor for an EPR_SProductId structure instance.

Parameters
product_idthe product file identifier to be destructed

Definition at line 269 of file epr_product.c.

◆ epr_log()

void epr_log ( EPR_ELogLevel  log_level,
const char *  log_message 
)

Logs a message with the given log level.

The function calls this API's log handler if it is not NULL and if the given log level is greater than or equal to the global log level.

Parameters
log_levelthe log level (or message type) for the mesage
log_messagethe mesage

Definition at line 199 of file epr_core.c.

◆ epr_make_os_compatible_path()

void epr_make_os_compatible_path ( char *  path)

Adapts path description to operating system.

Parameters
paththe path to a file.

Definition at line 449 of file epr_core.c.

◆ epr_open_file()

FILE* epr_open_file ( char *  file_path)

Opens a file to read.

Parameters
file_paththe path to the file.
Returns
the file handle or NULL if an error occured.

Definition at line 295 of file epr_core.c.

◆ epr_output_element()

void epr_output_element ( const EPR_SField *  field,
epr_uint  field_index,
epr_uint  element_index,
FILE *  istream 
)

Gets the element content to output FILE stream.

Parameters
fieldthe pointer at the field to get out.
istreamthe identifier of the output file.

◆ epr_param_to_value()

epr_uint epr_param_to_value ( const char *  str,
EPR_SPtrArray *  param_table 
)

Finds in the param_table the value corresponding to its name.

Parameters
strthe parameter name
param_tablethe pointer to param_table
Returns
the value of the given name or (uint)-1 if an error occured.

Definition at line 424 of file epr_core.c.

◆ epr_parse_value_count()

epr_uint epr_parse_value_count ( EPR_SProductId *  product_id,
const char *  count 
)

Converts the given string into a field length.

The string can represent a single integer value or a sequence of integer value and parameter references (names). Integers and value are expected to be separated by the asterisk character ('*'). E.g. the string "3 * 4 * num_pixels_across" is represents a valid field length as long as the parameter name 'num_pixels_across' is found in the given parameter table.

Parameters
countthe string to be converted
product_idthe Product identifier containing the values for the Product
Returns
the field length computed from the given string or (uint)-1 if an error occured.

Definition at line 373 of file epr_core.c.

◆ epr_read_mph()

EPR_SRecord* epr_read_mph ( EPR_SProductId *  product_id)

Reads the full main product header (MPH) of the ENVISAT product file given by the given product identifier.

Parameters
product_idthe product identifier, must not be NULL
Returns
a record representing the MPH of the specified product file or NULL if an error occured.

Reads the full main product header (MPH) of the ENVISAT product file by the given product identifier.

Parameters
product_idthe product identifier, must not be NULL
Returns
a record representing the MPH of the specified product file or NULL if an error occured.

Definition at line 47 of file epr_msph.c.

◆ epr_read_sph()

EPR_SRecord* epr_read_sph ( EPR_SProductId *  product_id)

Reads the full specific product header (SPH) of the ENVISAT product file given by the given product identifier.

Parameters
product_idthe product identifier, must not be NULL
Returns
a record representing the MPH of the specified product file or NULL if an error occured.

Reads the full specific product header (SPH) of the ENVISAT product file by the given product identifier.

Parameters
product_idthe product identifier, must not be NULL
Returns
a record representing the MPH of the specified product file or NULL if an error occured.

Definition at line 92 of file epr_msph.c.

◆ epr_set_err()

void epr_set_err ( EPR_EErrCode  err_code,
const char *  err_message 
)

Sets the given error code and the associated error message and calls this API's error handler if it is not NULL.

Parameters
err_codethe error code
err_messagethe error mesage

Definition at line 221 of file epr_core.c.

◆ epr_str_to_data_type_id()

EPR_EDataTypeId epr_str_to_data_type_id ( const char *  str)

Converts the given string into a data type identifier.

Parameters
strthe string to be converted.
Returns
the data type identifier represented by the given string. If the string can not be converted the special value e_tid_unknown is returned.

Definition at line 58 of file epr_core.c.

◆ epr_str_to_number()

int epr_str_to_number ( const char *  str)

Converts the given string into an int number.

Parameters
strthe string to be converted.
Returns
the int type number represented by the given string. If the string can not be converted, the value of 1 is returned.

Definition at line 328 of file epr_core.c.

Variable Documentation

◆ epr_api

EPR_SAPI epr_api

The one and only ENVISAT API instance.

Definition at line 43 of file epr_core.c.