OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_core.h
Go to the documentation of this file.
1 /*
2  * $Id: epr_core.h,v 1.1.1.1 2004-10-28 19:22:22 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 #ifndef EPR_CORE_H_INCL
19 #define EPR_CORE_H_INCL
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 
26 #include <stdio.h> /* just to get the ANSI-C type FILE */
27 
28 #include "epr_ptrarray.h"
29 
30 struct EPR_API;
31 struct EPR_Parameter;
32 
33 typedef struct EPR_API EPR_SAPI;
34 typedef struct EPR_Parameter EPR_SParameter;
35 
36 
37 #define EPR_ENVISAT_PRODUCT_MERIS "MER"
38 #define EPR_ENVISAT_PRODUCT_ASAR "ASA"
39 #define EPR_ENVISAT_PRODUCT_SAR "SAR"
40 #define EPR_ENVISAT_PRODUCT_AATSR "ATS"
41 
42 #define EPR_LONGI_BAND_NAME "longitude"
43 
44 #define EPR_AATSR_LINES_PER_TIE_PT 32
45 
46 #define EPR_MPH_SIZE 1247
47 #define EPR_SPH_SIZE 11622
48 #define EPR_DSD_SIZE 280
49 
50 #define EPR_PRODUCT_MPH_SIZE 1048 /*??????*/
51 #define EPR_PRODUCT_MAGIC_STR "PRODUCT=\""
52 #define EPR_PRODUCT_ID_OFFSET 9
53 
54 #define EPR_PRODUCT_TYPE_ID_STRLEN 10
55 #define EPR_LENGTH_NUM_DSD_IDENTIFIER 9
56 #define EPR_COUNT_SEPARATOR_ARRAY ",*"
57 #define EPR_IRRELEVANCE_SYMBOL '*'
58 #define EPR_FIELD_SEPARATOR_ARRAY "|"
59 #define EPR_HEADER_SEPARATOR_ARRAY "=<>"
60 #define EPR_HEADER_EXCEPTIONS_ARRAY "eE"
61 
62 #define EPR_LONGI_ABS_MAX 180
63 #define EPR_LONGI_ABS_MIN -180
64 
65 #define EPR_LINE_MAX_LENGTH 2000
66 
67 #define EPR_BE_MAGIC_NUMBER 1162761801UL
68 #define EPR_LE_MAGIC_NUMBER 1230392901UL
69 #define EPR_LE_MAGIC_BYTE_0 'E'
70 #define EPR_LE_MAGIC_BYTE_1 'N'
71 #define EPR_LE_MAGIC_BYTE_2 'V'
72 #define EPR_LE_MAGIC_BYTE_3 'I'
73 
74 #define EPR_ATS_NUM_PER_POINT_ACROSS_LOCAT 23
75 #define EPR_ATS_NUM_PER_POINT_ACROSS_SOLAR 11
76 #define EPR_ATS_LINE_LENGTH 512
77 
78 #define EPR_ASAR_NUM_PER_POINT_ACROSS_LOCAT 11
79 
86 struct EPR_API {
91 
99 
104 
108  /*char* db_dir_path;*/
109 
114 
120 
125 
130 
136 };
137 
138 
142 extern EPR_SAPI epr_api;
143 
144 
145 /*
146  * ======================================================================
147  */
148 
158 void epr_free_product_id(EPR_SProductId* product_id);
159 
160 
171 void epr_log(EPR_ELogLevel log_level, const char* log_message);
172 
180 void epr_set_err(EPR_EErrCode err_code, const char* err_message);
181 
190 EPR_SRecord* epr_read_mph(EPR_SProductId* product_id);
191 
200 EPR_SRecord* epr_read_sph(EPR_SProductId* product_id);
201 
211 
212 /*
213  * Converts the given string into a field length.
214  *
215  * The string can represent a single integer value or a sequence
216  * of integer value and parameter references (names). Integers
217  * and value are expected to be separated by the asterisk
218  * character ('*'). E.g. the string "3 * 4 * num_pixels_across"
219  * is represents a valid field length as long as the parameter
220  * name 'num_pixels_across' is found in the given parameter table.
221  *
222  * @param str the string to be converted
223  * @param param_table the parameter table containing the values
224  * for the parameter references in the string
225  * @return the field length computed from the given string or
226  * <code>(uint)-1</code> if an error occured.
227  */
228 /*epr_uint epr_str_to_field_length(const char* str, EPR_SParamTable* param_table);*/
229 
243 char* epr_build_db_file_istream_name(EPR_SProductId* product_id, char* what);
244 FILE* epr_open_file(char* path_to_file);
245 int epr_str_to_number(const char* str);
246 epr_uint epr_parse_value_count(EPR_SProductId* product_id, const char* str);
247 epr_uint epr_param_to_value(const char* str, EPR_SPtrArray* param_table);
250 
251 /*
252 void epr_make_image_header(EPR_SProductId* product_id, EPR_SDatasetId* dataset_id, EPR_SRecord* record);
253 int epr_make_image(EPR_SProductId* product_id, EPR_SDatasetId* dataset_id, EPR_SRecord* record);
254  */
255 
262 void epr_output_element(const EPR_SField* field, epr_uint field_index, epr_uint element_index, FILE* istream);
263 
264 #ifdef __cplusplus
265 } /* extern "C" */
266 #endif
267 
268 #endif /* #ifndef EPR_CORE_H_INCL */
int epr_str_to_number(const char *str)
Definition: epr_core.c:328
FILE * epr_open_file(char *path_to_file)
Definition: epr_core.c:295
char * last_err_message
Definition: epr_core.h:129
EPR_FLogHandler log_handler
Definition: epr_core.h:119
enum EPR_LogLevel EPR_ELogLevel
Definition: epr_api.h:163
EPR_SAPI epr_api
Definition: epr_core.c:43
void epr_free_product_id(EPR_SProductId *product_id)
Definition: epr_product.c:269
epr_uint epr_param_to_value(const char *str, EPR_SPtrArray *param_table)
Definition: epr_core.c:424
unsigned int epr_uint
Definition: epr_api.h:188
void epr_set_err(EPR_EErrCode err_code, const char *err_message)
Definition: epr_core.c:221
enum EPR_ErrCode EPR_EErrCode
Definition: epr_api.h:162
int epr_boolean
Definition: epr_api.h:185
EPR_EDataTypeId epr_str_to_data_type_id(const char *str)
Definition: epr_core.c:58
EPR_SRecord * epr_read_mph(EPR_SProductId *product_id)
Definition: epr_msph.c:47
void(* EPR_FErrHandler)(EPR_EErrCode err_code, const char *err_message)
Definition: epr_api.h:181
struct EPR_Parameter EPR_SParameter
Definition: epr_core.h:34
void(* EPR_FLogHandler)(EPR_ELogLevel log_level, const char *log_message)
Definition: epr_api.h:182
string path
Definition: color_dtdb.py:221
EPR_EErrCode last_err_code
Definition: epr_core.h:124
EPR_ELogLevel log_level
Definition: epr_core.h:113
What value is used by your function when the data value is bad Default is BAD_FLT l2prod product_id[0]
void epr_output_element(const EPR_SField *field, epr_uint field_index, epr_uint element_index, FILE *istream)
EPR_FErrHandler err_handler
Definition: epr_core.h:135
void epr_log(EPR_ELogLevel log_level, const char *log_message)
Definition: epr_core.c:199
const char * str
Definition: l1c_msi.cpp:35
epr_uint epr_parse_value_count(EPR_SProductId *product_id, const char *str)
Definition: epr_core.c:373
int little_endian_order
Definition: epr_core.h:98
epr_boolean epr_check_api_init_flag()
Definition: epr_core.c:475
enum EPR_DataTypeId EPR_EDataTypeId
Definition: epr_api.h:161
epr_boolean init_flag
Definition: epr_core.h:90
epr_uint epr_head_size
Definition: epr_core.h:103
char * epr_build_db_file_istream_name(EPR_SProductId *product_id, char *what)
void epr_make_os_compatible_path(char *path)
Definition: epr_core.c:449
EPR_SRecord * epr_read_sph(EPR_SProductId *product_id)
Definition: epr_msph.c:92