ENVISAT Product Reader API for C |

epr_api.h
Go to the documentation of this file.
1/*
2 * $Id: epr_api.h,v 1.3 2009-03-27 10:25:54 sabine 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_API_H_INCL
19#define EPR_API_H_INCL
20
21
22#ifdef __cplusplus
23 extern "C"
24{
25#endif
26
27/* to make the FILE structure available */
28#include <stdio.h>
29
30/* to make dynamic arrays available*/
31#include "epr_ptrarray.h"
32
33#define EPR_PRODUCT_API_NAME_STR "ENVISAT Product Reader API"
34#define EPR_PRODUCT_API_VERSION_STR "2.3"
35
36/* needed by Doxygen */
45 enum EPR_DataTypeId
46{
48 e_tid_unknown = 0,
50 e_tid_uchar = 1,
52 e_tid_char = 2,
54 e_tid_ushort = 3,
56 e_tid_short = 4,
58 e_tid_uint = 5,
60 e_tid_int = 6,
62 e_tid_float = 7,
64 e_tid_double = 8,
66 e_tid_string = 11,
68 e_tid_spare = 13,
70 e_tid_time = 21
71};
72
73
78 enum EPR_ErrCode
79{
80 /* Not an error */
81 e_err_none = 0,
82
83 /* Low level errors */
84 e_err_null_pointer = 1,
85 e_err_illegal_arg = 2,
86 e_err_illegal_state = 3,
87 e_err_out_of_memory = 4,
88 e_err_index_out_of_range = 5,
89 e_err_illegal_conversion = 6,
90 e_err_illegal_data_type = 7,
91
92 /* I/O errors */
93 e_err_file_not_found = 101,
94 e_err_file_access_denied = 102,
95 e_err_file_read_error = 103,
96 e_err_file_write_error = 104,
97 e_err_file_open_failed = 105,
98 e_err_file_close_failed = 106,
99
100 /* API related errors */
101 e_err_api_not_initialized = 201,
102 e_err_invalid_product_id = 203,
103 e_err_invalid_record = 204,
104 e_err_invalid_band = 205,
105 e_err_invalid_raster = 206,
106 e_err_invalid_dataset_name = 207,
107 e_err_invalid_field_name = 208,
108 e_err_invalid_record_name = 209,
109 e_err_invalid_product_name = 210,
110 e_err_invalid_band_name = 211,
111 e_err_invalid_data_format = 212,
112 e_err_invalid_value = 213,
113 e_err_invalid_keyword_name = 214,
114 e_err_unknown_endian_order = 216,
115
116 /* Bitmask term errors */
117 e_err_flag_not_found = 301,
118
119
120 /* DDDB errors */
121 e_err_invalid_ddbb_format = 402
122};
123
124
129 enum EPR_LogLevel
130{
131 e_log_debug = -1,
132 e_log_info = 0,
133 e_log_warning = 1,
134 e_log_error = 2
135};
136
137 enum EPR_SampleModel
138{
139 e_smod_1OF1 = 0,
140 e_smod_1OF2 = 1,
141 e_smod_2OF2 = 2,
142 e_smod_3TOI = 3,
143 e_smod_2TOF = 4
144};
145
146 enum EPR_ScalingMethod
147{
148 e_smid_non = 0,
149 e_smid_lin = 1,
150 e_smid_log = 2
151};
152
153 struct EPR_ProductId;
154 struct EPR_DatasetId;
155 struct EPR_BandId;
156 struct EPR_Record;
157 struct EPR_RecordInfo;
158 struct EPR_Field;
159 struct EPR_FieldInfo;
160 struct EPR_ProductInfo;
161 struct EPR_DSD;
162 struct EPR_Raster;
163 struct EPR_DatasetRef;
164 struct EPR_Flag;
165 struct EPR_BandId;
166 struct EPR_ParamElem;
167 struct EPR_Time;
168
169 typedef enum EPR_DataTypeId EPR_EDataTypeId;
170 typedef enum EPR_ErrCode EPR_EErrCode;
171 typedef enum EPR_LogLevel EPR_ELogLevel;
172 typedef enum EPR_SampleModel EPR_ESampleModel;
173 typedef enum EPR_ScalingMethod EPR_EScalingMethod;
174 typedef struct EPR_ProductId EPR_SProductId;
175 typedef struct EPR_DatasetId EPR_SDatasetId;
176 typedef struct EPR_BandId EPR_SBandId;
177 typedef struct EPR_Record EPR_SRecord;
178 typedef struct EPR_RecordInfo EPR_SRecordInfo;
179 typedef struct EPR_Field EPR_SField;
180 typedef struct EPR_FieldInfo EPR_SFieldInfo;
181 typedef struct EPR_DSD EPR_SDSD;
182 typedef struct EPR_Raster EPR_SRaster;
183 typedef struct EPR_FlagDef EPR_SFlagDef;
184 typedef struct EPR_ParamElem EPR_SParamElem;
185 typedef struct EPR_Time EPR_STime;
186 typedef struct EPR_DatasetRef EPR_SDatasetRef;
187 typedef struct EPR_BitmaskTerm EPR_SBitmaskTerm;
188 typedef struct EPR_FlagSet EPR_SFlagSet;
189 typedef void (*EPR_FErrHandler)(EPR_EErrCode err_code, const char* err_message);
190 typedef void (*EPR_FLogHandler)(EPR_ELogLevel log_level, const char* log_message);
191
192
193 typedef int epr_boolean;
194 typedef unsigned char uchar;
195 typedef unsigned short ushort;
196 typedef unsigned int uint;
197 typedef unsigned long ulong;
198
199
200 typedef int EPR_Magic;
201
202#define EPR_MAGIC_PRODUCT_ID 0xCAFFEE64
203#define EPR_MAGIC_DATASET_ID 0xEFEABDCA
204#define EPR_MAGIC_BAND_ID 0xFEC21ABD
205#define EPR_MAGIC_RECORD 0x7BABACAE
206#define EPR_MAGIC_FIELD 0xBA0BABBA
207#define EPR_MAGIC_RASTER 0x0BABA0EB
208#define EPR_MAGIC_FLAG_DEF 0xCABA11AD
209
210#define TRUE 1
211#define FALSE 0
212
213#define EPR_PRODUCT_ID_STRLEN 48
214
215
216/*************************************************************************/
217/******************************** STRUCTURES *****************************/
218/*************************************************************************/
219
227 struct EPR_ProductId
228{
233 EPR_Magic magic;
234
238 char* file_path;
239
244 FILE* istream;
245
249 uint tot_size;
250
254 uint scene_width;
255
259 uint scene_height;
260
269 char id_string[EPR_PRODUCT_ID_STRLEN + 1];
270
274 EPR_SRecord* mph_record;
275
279 EPR_SRecord* sph_record;
280
285 EPR_SPtrArray* dsd_array;
286
296 EPR_SPtrArray* record_info_cache;
297
304 EPR_SPtrArray* param_table;
305
309 EPR_SPtrArray* dataset_ids;
310
314 EPR_SPtrArray* band_ids;
315
319 int meris_iodd_version;
320};
321
322
323
324
337 struct EPR_DatasetId
338{
343 EPR_Magic magic;
344
348 EPR_SProductId* product_id;
349
353 char* dsd_name;
354
358 const EPR_SDSD* dsd;
359
363 char* dataset_name;
364
368 const struct RecordDescriptor* record_descriptor;
369
373 EPR_SRecordInfo* record_info;
374
375
379 char* description;
380};
381
382
390 struct EPR_DSD
391{
396 EPR_Magic magic;
397
401 int index;
402
406 char* ds_name;
407
411 char* ds_type;
412
416 char* filename;
417
421 uint ds_offset;
422
426 uint ds_size;
427
431 uint num_dsr;
432
436 uint dsr_size;
437};
438
439
447 struct EPR_Record
448{
453 EPR_Magic magic;
454
458 EPR_SRecordInfo* info;
459
465 uint num_fields;
466
471 EPR_SField** fields;
472};
473
481 struct EPR_Field
482{
487 EPR_Magic magic;
488
493 EPR_SFieldInfo* info;
494
515 void* elems;
516};
517
523 struct EPR_Raster
524{
529 EPR_Magic magic;
530
535 EPR_EDataTypeId data_type;
536
540 uint elem_size;
541
545 uint source_width;
546
550 uint source_height;
551
555 uint source_step_x;
556
560 uint source_step_y;
561
566 uint raster_width;
567
572 uint raster_height;
573
578 void* buffer;
579};
580
581
596 struct EPR_DatasetRef
597{
598 EPR_SDatasetId* dataset_id;
599 int field_index; /* -1 if not used */
600 int elem_index; /* -1 if not used */
601};
602
607 struct EPR_FlagDef
608{
613 EPR_Magic magic;
614
618 char* name;
619
623 uint bit_mask;
624
628 char* description;
629};
630
631
643 struct EPR_BandId
644{
649 EPR_Magic magic;
650
654 EPR_SProductId* product_id;
655
660 char* band_name;
661
665 int spectr_band_index;
666
673 EPR_SDatasetRef dataset_ref;
674
684 EPR_ESampleModel sample_model;
685
693 EPR_EDataTypeId data_type;
694
703 EPR_EScalingMethod scaling_method;
704
714 float scaling_offset;
715
726 float scaling_factor;
727
731 char* bm_expr;
732
738 EPR_SPtrArray* flag_coding;
739
743 char* unit;
744
748 char* description;
749
755 epr_boolean lines_mirrored;
756};
757
764 struct EPR_Time
765{
766 int days;
767 uint seconds;
768 uint microseconds;
769};
770
771
772
773/*************************************************************************/
774/********************************* FUNCTIONS *****************************/
775/*************************************************************************/
776
777/*
778 * ============================ (1) Initialisation ==========================
779 */
780
801 int epr_init_api(EPR_ELogLevel log_level,
802 EPR_FLogHandler log_handler,
803 EPR_FErrHandler err_handler);
804
805
812 void epr_close_api(void);
816/*
817 * ============================ (2) Logging ============================
818 */
819
835 int epr_set_log_level(EPR_ELogLevel log_level);
836
846 void epr_set_log_handler(EPR_FLogHandler log_handler);
847
856 void epr_log_message(EPR_ELogLevel log_level, const char* log_message);
857
860/*
861 * ========================= (3) Error Handling ==========================
862 */
863
875 void epr_set_err_handler(EPR_FErrHandler err_handler);
876
883 EPR_EErrCode epr_get_last_err_code(void);
884
891 const char* epr_get_last_err_message(void);
892
898 void epr_clear_err(void);
899
902/*
903 * ========================== (4) Input / Output ============================
904 */
905
911/*
912 * ======================= (4.1) Product File Access ==========================
913 */
914
933 EPR_SProductId* epr_open_product(const char* product_file_path);
934
942 int epr_close_product(EPR_SProductId* product_id);
947/*
948 * ================= (4.2) Writing to a file or standard output =================
949 */
950
977 void epr_print_record(const EPR_SRecord* record, FILE* ostream);
978 void epr_print_field(const EPR_SField* field, FILE* ostream);
979 void epr_print_element(const EPR_SRecord* record, uint field_index, uint element_index, FILE* ostream);
980 void epr_dump_record(const EPR_SRecord* record);
981 void epr_dump_field(const EPR_SField* field);
982 void epr_dump_element(const EPR_SRecord* record, uint field_index, uint element_index);
985/*
986 * ======================= (5) Basic Data Access =========================
987 */
988
1001 uint epr_get_scene_width(const EPR_SProductId* product_id);
1002
1010 uint epr_get_scene_height(const EPR_SProductId* product_id);
1011
1014/*
1015 * ============================ (5.1) Dataset ==============================
1016 */
1017
1030 uint epr_get_num_datasets(EPR_SProductId* product_id);
1031
1040 EPR_SDatasetId* epr_get_dataset_id_at(EPR_SProductId* product_id, uint index);
1041
1049 EPR_SDatasetId* epr_get_dataset_id(EPR_SProductId* product_id, const char* dataset_name);
1050
1057 const char* epr_get_dataset_name(EPR_SDatasetId* dataset_id);
1058
1065 const char* epr_get_dsd_name(const EPR_SDatasetId* dataset_id);
1066
1073 EPR_SRecord* epr_get_mph(const EPR_SProductId* product_id);
1074
1081 EPR_SRecord* epr_get_sph(const EPR_SProductId* product_id);
1082
1089 const EPR_SDSD* epr_get_dsd(const EPR_SDatasetId* dataset_id);
1090
1097 uint epr_get_num_records(const EPR_SDatasetId* dataset_id);
1098
1099
1100 uint epr_get_num_dsds(const EPR_SProductId* product_id);
1101 EPR_SDSD* epr_get_dsd_at(const EPR_SProductId* product_id, uint dsd_index);
1102
1105/*
1106 * ================================= (5.2) Records ============================
1107 */
1108
1123 EPR_SRecord* epr_create_record(EPR_SDatasetId* dataset_id);
1124
1143 EPR_SRecord* epr_read_record(EPR_SDatasetId* dataset_id,
1144 uint record_index,
1145 EPR_SRecord* record);
1146
1154 void epr_free_record(EPR_SRecord* record);
1155
1158/*
1159 * =========================== (5.3) Field Access =============================
1160 */
1161
1178 const EPR_SField* epr_get_field(const EPR_SRecord* record, const char* field_name);
1179
1186 uint epr_get_num_fields(const EPR_SRecord* record);
1187
1196 const EPR_SField* epr_get_field_at(const EPR_SRecord* record, uint field_index);
1197
1204 const char* epr_get_field_unit(const EPR_SField* field);
1205
1213 const char* epr_get_field_description(const EPR_SField* field);
1214
1222 uint epr_get_field_num_elems(const EPR_SField* field);
1223
1231 const char* epr_get_field_name(const EPR_SField* field);
1232
1240 EPR_EDataTypeId epr_get_field_type(const EPR_SField* field);
1241
1244/*
1245 * ========================= (5.4) Single Element Access =========================
1246 */
1247
1263 char epr_get_field_elem_as_char(const EPR_SField* field, uint elem_index);
1264 uchar epr_get_field_elem_as_uchar(const EPR_SField* field, uint elem_index);
1265 short epr_get_field_elem_as_short(const EPR_SField* field, uint elem_index);
1266 ushort epr_get_field_elem_as_ushort(const EPR_SField* field, uint elem_index);
1267 int epr_get_field_elem_as_int(const EPR_SField* field, uint elem_index);
1268 uint epr_get_field_elem_as_uint(const EPR_SField* field, uint elem_index);
1269 float epr_get_field_elem_as_float(const EPR_SField* field, uint elem_index);
1270 double epr_get_field_elem_as_double(const EPR_SField* field, uint elem_index);
1271 const EPR_STime* epr_get_field_elem_as_mjd(const EPR_SField* field);
1272 const char* epr_get_field_elem_as_str(const EPR_SField* field);
1275/*
1276 * =========================== (5.5) Array Element Access =============================
1277 */
1278
1291 const char* epr_get_field_elems_char(const EPR_SField* field);
1292 const uchar* epr_get_field_elems_uchar(const EPR_SField* field);
1293 const short* epr_get_field_elems_short(const EPR_SField* field);
1294 const ushort* epr_get_field_elems_ushort(const EPR_SField* field);
1295 const int* epr_get_field_elems_int(const EPR_SField* field);
1296 const uint* epr_get_field_elems_uint(const EPR_SField* field);
1297 const float* epr_get_field_elems_float(const EPR_SField* field);
1298 const double* epr_get_field_elems_double(const EPR_SField* field);
1317 uint epr_copy_field_elems_as_ints(const EPR_SField* field, int* buffer, uint num_elems);
1318 uint epr_copy_field_elems_as_uints(const EPR_SField* field, uint* buffer, uint num_elems);
1319 uint epr_copy_field_elems_as_floats(const EPR_SField* field, float* buffer, uint num_elems);
1320 uint epr_copy_field_elems_as_doubles(const EPR_SField* field, double* buffer, uint num_elems);
1325/*
1326 * ======================== (6) Geophysical Data Access =========================
1327 */
1328
1336/*
1337 * ================================== (6.1) Raster ===============================
1338 */
1339
1380 EPR_SRaster* epr_create_compatible_raster(EPR_SBandId* band_id,
1381 uint source_width,
1382 uint source_height,
1383 uint source_step_x,
1384 uint source_step_y);
1385
1398 EPR_SRaster* epr_create_raster(EPR_EDataTypeId data_type,
1399 uint source_width,
1400 uint source_height,
1401 uint source_step_x,
1402 uint source_step_y);
1403
1404
1415 EPR_SRaster* epr_create_bitmask_raster(uint source_width,
1416 uint source_height,
1417 uint source_step_x,
1418 uint source_step_y);
1419
1437 int epr_read_band_raster(EPR_SBandId* band_id,
1438 int offset_x,
1439 int offset_y,
1440 EPR_SRaster* raster);
1441
1442
1446 uint epr_get_raster_elem_size(const EPR_SRaster* raster);
1447
1451 void* epr_get_raster_elem_addr(const EPR_SRaster* raster, uint offset);
1452
1456 void* epr_get_raster_pixel_addr(const EPR_SRaster* raster, uint x, uint y);
1457
1461 void* epr_get_raster_line_addr(const EPR_SRaster* raster, uint y);
1462
1463
1471 uint epr_get_raster_width(EPR_SRaster* raster);
1472
1480 uint epr_get_raster_height(EPR_SRaster* raster);
1481
1482
1483
1490 uint epr_get_num_bands(EPR_SProductId* product_id);
1491
1500 EPR_SBandId* epr_get_band_id_at(EPR_SProductId* product_id, uint index);
1501
1509 EPR_SBandId* epr_get_band_id(EPR_SProductId* product_id, const char* band_name);
1510
1517 const char* epr_get_band_name(EPR_SBandId* band_id);
1518
1524 void epr_free_raster(EPR_SRaster* raster);
1525
1528/*
1529 * ============================ (6.2) Single Pixel Access ========================
1530 */
1531
1548 uint epr_get_pixel_as_uint(const EPR_SRaster* raster, int x, int y);
1549 int epr_get_pixel_as_int(const EPR_SRaster* raster, int x, int y);
1550 float epr_get_pixel_as_float(const EPR_SRaster* raster, int x, int y);
1551 double epr_get_pixel_as_double(const EPR_SRaster* raster, int x, int y);
1554/*
1555 * ================================= (7) Bitmasks ==========================
1556 */
1557
1583 int epr_read_bitmask_raster(EPR_SProductId* product_id,
1584 const char* bm_expr,
1585 int offset_x,
1586 int offset_y,
1587 EPR_SRaster* raster);
1588
1591/*
1592 * ================================= (8) Utility functions ==========================
1593 */
1594
1603 uint epr_get_data_type_size(EPR_EDataTypeId data_type_id);
1604
1608 const char* epr_data_type_id_to_str(EPR_EDataTypeId data_type_id);
1609
1612#ifdef __cplusplus
1613} /* extern "C" */
1614#endif
1615#endif /* #ifndef EPR_API_H_INCL */
epr_get_field_elem_as_double
double epr_get_field_elem_as_double(const EPR_SField *field, uint elem_index)
epr_get_field_elems_float
const float * epr_get_field_elems_float(const EPR_SField *field)
epr_copy_field_elems_as_doubles
uint epr_copy_field_elems_as_doubles(const EPR_SField *field, double *buffer, uint num_elems)
EPR_SBitmaskTerm
struct EPR_BitmaskTerm EPR_SBitmaskTerm
Definition epr_api.h:187
EPR_LogLevel
EPR_LogLevel
The EPR_LogLevel enumeration lists possible log levels for the ENVISAT product reader API.
Definition epr_api.h:130
epr_get_field_elems_ushort
const ushort * epr_get_field_elems_ushort(const EPR_SField *field)
epr_copy_field_elems_as_uints
uint epr_copy_field_elems_as_uints(const EPR_SField *field, uint *buffer, uint num_elems)
EPR_ESampleModel
enum EPR_SampleModel EPR_ESampleModel
Definition epr_api.h:172
EPR_SampleModel
EPR_SampleModel
Definition epr_api.h:138
epr_get_field_elem_as_str
const char * epr_get_field_elem_as_str(const EPR_SField *field)
epr_get_field_elem_as_mjd
const EPR_STime * epr_get_field_elem_as_mjd(const EPR_SField *field)
epr_get_field_elem_as_int
int epr_get_field_elem_as_int(const EPR_SField *field, uint elem_index)
epr_copy_field_elems_as_floats
uint epr_copy_field_elems_as_floats(const EPR_SField *field, float *buffer, uint num_elems)
EPR_EErrCode
enum EPR_ErrCode EPR_EErrCode
Definition epr_api.h:170
epr_copy_field_elems_as_ints
uint epr_copy_field_elems_as_ints(const EPR_SField *field, int *buffer, uint num_elems)
epr_get_field_elems_double
const double * epr_get_field_elems_double(const EPR_SField *field)
uchar
unsigned char uchar
Definition epr_api.h:194
EPR_EDataTypeId
enum EPR_DataTypeId EPR_EDataTypeId
Definition epr_api.h:169
ulong
unsigned long ulong
Definition epr_api.h:197
EPR_FErrHandler
void(* EPR_FErrHandler)(EPR_EErrCode err_code, const char *err_message)
Definition epr_api.h:189
epr_get_field_elem_as_short
short epr_get_field_elem_as_short(const EPR_SField *field, uint elem_index)
epr_get_field_elem_as_uchar
uchar epr_get_field_elem_as_uchar(const EPR_SField *field, uint elem_index)
EPR_SFieldInfo
struct EPR_FieldInfo EPR_SFieldInfo
Definition epr_api.h:180
EPR_ErrCode
EPR_ErrCode
The EPR_ErrCode enumeration lists all possible error codes for the ENVISAT product reader API.
Definition epr_api.h:79
uint
unsigned int uint
Definition epr_api.h:196
EPR_SFlagSet
struct EPR_FlagSet EPR_SFlagSet
Definition epr_api.h:188
epr_get_field_elems_uchar
const uchar * epr_get_field_elems_uchar(const EPR_SField *field)
EPR_ScalingMethod
EPR_ScalingMethod
Definition epr_api.h:147
epr_get_field_elems_short
const short * epr_get_field_elems_short(const EPR_SField *field)
EPR_Magic
int EPR_Magic
Definition epr_api.h:200
EPR_ELogLevel
enum EPR_LogLevel EPR_ELogLevel
Definition epr_api.h:171
epr_get_field_elem_as_ushort
ushort epr_get_field_elem_as_ushort(const EPR_SField *field, uint elem_index)
ushort
unsigned short ushort
Definition epr_api.h:195
EPR_FLogHandler
void(* EPR_FLogHandler)(EPR_ELogLevel log_level, const char *log_message)
Definition epr_api.h:190
epr_get_field_elems_int
const int * epr_get_field_elems_int(const EPR_SField *field)
epr_get_field_elems_uint
const uint * epr_get_field_elems_uint(const EPR_SField *field)
epr_get_field_elem_as_uint
uint epr_get_field_elem_as_uint(const EPR_SField *field, uint elem_index)
EPR_SParamElem
struct EPR_ParamElem EPR_SParamElem
Definition epr_api.h:184
epr_get_field_elem_as_float
float epr_get_field_elem_as_float(const EPR_SField *field, uint elem_index)
epr_get_field_elem_as_char
char epr_get_field_elem_as_char(const EPR_SField *field, uint elem_index)
epr_boolean
int epr_boolean
Definition epr_api.h:193
EPR_SRecordInfo
struct EPR_RecordInfo EPR_SRecordInfo
Definition epr_api.h:178
EPR_PRODUCT_ID_STRLEN
#define EPR_PRODUCT_ID_STRLEN
Definition epr_api.h:213
EPR_DataTypeId
EPR_DataTypeId
The EPR_DataTypeId enumeration lists all possible data types for field elements in ENVISAT dataset re...
Definition epr_api.h:46
EPR_EScalingMethod
enum EPR_ScalingMethod EPR_EScalingMethod
Definition epr_api.h:173
epr_get_field_elems_char
const char * epr_get_field_elems_char(const EPR_SField *field)
epr_read_bitmask_raster
int epr_read_bitmask_raster(EPR_SProductId *product_id, const char *bm_expr, int offset_x, int offset_y, EPR_SRaster *raster)
Calculates a bit-mask, composed of flags of the given product and combined as described in the given ...
epr_get_num_datasets
uint epr_get_num_datasets(EPR_SProductId *product_id)
Gets the number off all datasets contained in a product.
epr_get_dsd_name
const char * epr_get_dsd_name(const EPR_SDatasetId *dataset_id)
Gets the name of the dsd for the given dataset ID.
epr_get_sph
EPR_SRecord * epr_get_sph(const EPR_SProductId *product_id)
Gets the SPH record from the given product_id.
epr_get_dsd_at
EPR_SDSD * epr_get_dsd_at(const EPR_SProductId *product_id, uint dsd_index)
epr_get_dataset_name
const char * epr_get_dataset_name(EPR_SDatasetId *dataset_id)
Gets the name of the dataset for the given dataset ID.
epr_get_dataset_id_at
EPR_SDatasetId * epr_get_dataset_id_at(EPR_SProductId *product_id, uint index)
Gets the dataset_id at the specified position within the product.
epr_get_mph
EPR_SRecord * epr_get_mph(const EPR_SProductId *product_id)
Gets the MPH record from the given product_id.
epr_get_num_dsds
uint epr_get_num_dsds(const EPR_SProductId *product_id)
epr_get_dataset_id
EPR_SDatasetId * epr_get_dataset_id(EPR_SProductId *product_id, const char *dataset_name)
Gets the dataset_id coresponding to the specified dataset name.
epr_get_dsd
const EPR_SDSD * epr_get_dsd(const EPR_SDatasetId *dataset_id)
Gets the dataset descriptor (DSD) for the dataset specified by dataset_id.
epr_get_num_records
uint epr_get_num_records(const EPR_SDatasetId *dataset_id)
Gets the number of records of the dataset specified by dataset_id.
epr_get_scene_width
uint epr_get_scene_width(const EPR_SProductId *product_id)
Gets the product's scene width in pixels.
epr_get_scene_height
uint epr_get_scene_height(const EPR_SProductId *product_id)
Gets the product's scene height in pixels.
epr_clear_err
void epr_clear_err(void)
Clears the last error.
epr_get_last_err_code
EPR_EErrCode epr_get_last_err_code(void)
Gets the error code of the error that occured during the last API function call.
epr_set_err_handler
void epr_set_err_handler(EPR_FErrHandler err_handler)
Sets the error handler for the ENVISAT API.
epr_get_last_err_message
const char * epr_get_last_err_message(void)
Gets the error message of the error that occured during the last API function call.
epr_get_field_description
const char * epr_get_field_description(const EPR_SField *field)
Gets the description of the field.
epr_get_field_unit
const char * epr_get_field_unit(const EPR_SField *field)
Gets the unit of the field.
epr_get_field_name
const char * epr_get_field_name(const EPR_SField *field)
Gets the name of the field.
epr_get_field_at
const EPR_SField * epr_get_field_at(const EPR_SRecord *record, uint field_index)
Gets a field at the specified position within the record.
epr_get_num_fields
uint epr_get_num_fields(const EPR_SRecord *record)
Gets the number of fields contained in the given record.
epr_get_field_num_elems
uint epr_get_field_num_elems(const EPR_SField *field)
Gets the number of elements of the field.
epr_get_field_type
EPR_EDataTypeId epr_get_field_type(const EPR_SField *field)
Gets the type of the field.
epr_get_field
const EPR_SField * epr_get_field(const EPR_SRecord *record, const char *field_name)
Gets a field from the given record.
epr_init_api
int epr_init_api(EPR_ELogLevel log_level, EPR_FLogHandler log_handler, EPR_FErrHandler err_handler)
Initializes the ENVISAT product reader API.
epr_close_api
void epr_close_api(void)
Closes the ENVISAT product reader API by releasing all resources allocated by the API.
epr_log_message
void epr_log_message(EPR_ELogLevel log_level, const char *log_message)
A default implementation for a logging function to be passed into the epr_init() function.
epr_set_log_level
int epr_set_log_level(EPR_ELogLevel log_level)
Sets the log level for the ENVISAT API.
epr_set_log_handler
void epr_set_log_handler(EPR_FLogHandler log_handler)
Sets the log handler for the ENVISAT API.
epr_open_product
EPR_SProductId * epr_open_product(const char *product_file_path)
Opens the ENVISAT product file with the given file path, reads MPH, SPH and all DSDs,...
epr_close_product
int epr_close_product(EPR_SProductId *product_id)
Closes the ENVISAT product file determined by the given product identifier.
epr_create_bitmask_raster
EPR_SRaster * epr_create_bitmask_raster(uint source_width, uint source_height, uint source_step_x, uint source_step_y)
Creates a raster to be used for reading bitmasks.
epr_create_raster
EPR_SRaster * epr_create_raster(EPR_EDataTypeId data_type, uint source_width, uint source_height, uint source_step_x, uint source_step_y)
Creates a raster of the specified data type.
epr_read_band_raster
int epr_read_band_raster(EPR_SBandId *band_id, int offset_x, int offset_y, EPR_SRaster *raster)
Reads (geo-)physical values of the given band of the specified source-region.
epr_get_raster_elem_addr
void * epr_get_raster_elem_addr(const EPR_SRaster *raster, uint offset)
epr_get_band_name
const char * epr_get_band_name(EPR_SBandId *band_id)
Gets the name of the band for the given band ID.
epr_free_raster
void epr_free_raster(EPR_SRaster *raster)
Release the memory allocated through a raster.
epr_get_raster_line_addr
void * epr_get_raster_line_addr(const EPR_SRaster *raster, uint y)
epr_create_compatible_raster
EPR_SRaster * epr_create_compatible_raster(EPR_SBandId *band_id, uint source_width, uint source_height, uint source_step_x, uint source_step_y)
Creates a raster which is compatible with the data type contained in the band identified by band_id.
epr_get_num_bands
uint epr_get_num_bands(EPR_SProductId *product_id)
Gets the number of all bands contained in a product.
epr_get_raster_elem_size
uint epr_get_raster_elem_size(const EPR_SRaster *raster)
epr_get_raster_height
uint epr_get_raster_height(EPR_SRaster *raster)
Gets the raster's scene height in pixels.
epr_get_band_id
EPR_SBandId * epr_get_band_id(EPR_SProductId *product_id, const char *band_name)
Gets the band ID corresponding to the specified name.
epr_get_band_id_at
EPR_SBandId * epr_get_band_id_at(EPR_SProductId *product_id, uint index)
Gets the band ID at the specified position within the product.
epr_get_raster_width
uint epr_get_raster_width(EPR_SRaster *raster)
Gets the raster's scene width in pixels.
epr_get_raster_pixel_addr
void * epr_get_raster_pixel_addr(const EPR_SRaster *raster, uint x, uint y)
epr_create_record
EPR_SRecord * epr_create_record(EPR_SDatasetId *dataset_id)
Creates a new, empty record with a structure compatible with the dataset specified by dataset_id.
epr_free_record
void epr_free_record(EPR_SRecord *record)
Frees the memory allocated through the given record.
epr_read_record
EPR_SRecord * epr_read_record(EPR_SDatasetId *dataset_id, uint record_index, EPR_SRecord *record)
Reads a record of a dataset specified by dataset_id.
EPR_DatasetId::dsd
const EPR_SDSD * dsd
The dataset descriptor obtained from the current product.
Definition epr_api.h:358
EPR_FlagDef::bit_mask
uint bit_mask
The bit mask describing this flag.
Definition epr_api.h:623
EPR_DatasetId::dsd_name
char * dsd_name
The name as presented to the user in a dsd selection dialog.
Definition epr_api.h:353
EPR_DatasetId::description
char * description
A short description of the band's contents.
Definition epr_api.h:379
EPR_DSD::ds_name
char * ds_name
The dataset name.
Definition epr_api.h:406
EPR_Record::info
EPR_SRecordInfo * info
The corresponding record info for this record (a 'soft' pointer).
Definition epr_api.h:458
e_log_debug
@ e_log_debug
Definition epr_api.h:131
e_log_info
@ e_log_info
Definition epr_api.h:132
e_log_error
@ e_log_error
Definition epr_api.h:134
e_log_warning
@ e_log_warning
Definition epr_api.h:133
EPR_BandId::dataset_ref
EPR_SDatasetRef dataset_ref
The reference of the source dataset containing the raw data used to create the band's pixel values.
Definition epr_api.h:673
EPR_DSD::dsr_size
uint dsr_size
The size of dataset record for the given dataset name.
Definition epr_api.h:436
EPR_BandId::product_id
EPR_SProductId * product_id
The ID of the product to which this band belongs to.
Definition epr_api.h:654
e_smod_2OF2
@ e_smod_2OF2
Definition epr_api.h:141
e_smod_1OF2
@ e_smod_1OF2
Definition epr_api.h:140
e_smod_3TOI
@ e_smod_3TOI
Definition epr_api.h:142
e_smod_2TOF
@ e_smod_2TOF
Definition epr_api.h:143
e_smod_1OF1
@ e_smod_1OF1
Definition epr_api.h:139
epr_get_pixel_as_int
int epr_get_pixel_as_int(const EPR_SRaster *raster, int x, int y)
EPR_BandId::scaling_method
EPR_EScalingMethod scaling_method
The scaling method which must be applied to the raw source data in order to get the 'real' pixel valu...
Definition epr_api.h:703
EPR_BandId::data_type
EPR_EDataTypeId data_type
The data type of the band's pixel values.
Definition epr_api.h:693
EPR_Raster::raster_width
uint raster_width
The width of the raster in pixel.
Definition epr_api.h:566
EPR_Raster::buffer
void * buffer
The elements of this raster.
Definition epr_api.h:578
EPR_ProductId::band_ids
EPR_SPtrArray * band_ids
Contains and array of all band IDs for the product (type EPR_SBandId*)
Definition epr_api.h:314
EPR_ProductId::istream
FILE * istream
The input stream as returned by the ANSI C fopen function for the given file path.
Definition epr_api.h:244
EPR_DatasetId::product_id
EPR_SProductId * product_id
The ID of the product to which this dataset belongs to.
Definition epr_api.h:348
EPR_ProductId::meris_iodd_version
int meris_iodd_version
For MERIS L1b and RR and FR to provide backward compatibility.
Definition epr_api.h:319
EPR_DSD::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:396
EPR_BandId::sample_model
EPR_ESampleModel sample_model
The sample model operation applied to the source dataset for getting the correct samples from the MDS...
Definition epr_api.h:684
EPR_DatasetRef::field_index
int field_index
Definition epr_api.h:599
EPR_ProductId::id_string
char id_string[EPR_PRODUCT_ID_STRLEN+1]
The product identifier string obtained from the MPH parameter 'PRODUCT'.
Definition epr_api.h:269
EPR_Raster::source_width
uint source_width
The width of the source .
Definition epr_api.h:545
EPR_ProductId::tot_size
uint tot_size
The total size in bytes of the product file.
Definition epr_api.h:249
EPR_DatasetId::record_descriptor
const struct RecordDescriptor * record_descriptor
The record descriptor found in the DDDB for this dataset.
Definition epr_api.h:368
EPR_Raster::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:529
EPR_DatasetId::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:343
EPR_Raster::data_type
EPR_EDataTypeId data_type
The data type of the band's pixel values.
Definition epr_api.h:535
EPR_Raster::source_step_y
uint source_step_y
The sub-sampling for the along-track direction in pixel.
Definition epr_api.h:560
EPR_ProductId::scene_height
uint scene_height
The total height of product's scene raster in pixels.
Definition epr_api.h:259
EPR_BandId::description
char * description
A short description of the band's contents.
Definition epr_api.h:748
EPR_DSD::ds_size
uint ds_size
The size of dataset-information in dataset product file.
Definition epr_api.h:426
EPR_BandId::spectr_band_index
int spectr_band_index
The (zero-based) spectral band index.
Definition epr_api.h:665
epr_get_pixel_as_double
double epr_get_pixel_as_double(const EPR_SRaster *raster, int x, int y)
EPR_Record::fields
EPR_SField ** fields
The record fields.
Definition epr_api.h:471
EPR_DatasetRef::dataset_id
EPR_SDatasetId * dataset_id
Definition epr_api.h:598
EPR_ProductId::file_path
char * file_path
The file's path including the file name.
Definition epr_api.h:238
EPR_Field::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:487
EPR_Record::num_fields
uint num_fields
The number of fields contained in this record.
Definition epr_api.h:465
EPR_DatasetRef::elem_index
int elem_index
Definition epr_api.h:600
EPR_ProductId::scene_width
uint scene_width
The total width of product's scene raster in pixels.
Definition epr_api.h:254
EPR_ProductId::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:233
EPR_BandId::lines_mirrored
epr_boolean lines_mirrored
If true (=1) lines will be mirrored (flipped) after read into a raster in order to ensure a pixel ord...
Definition epr_api.h:755
EPR_BandId::scaling_factor
float scaling_factor
The scaling factor.
Definition epr_api.h:726
EPR_ProductId::record_info_cache
EPR_SPtrArray * record_info_cache
Cache for record infos.
Definition epr_api.h:296
EPR_DSD::index
int index
The index of this DSD (zero-based)
Definition epr_api.h:401
EPR_DatasetId::record_info
EPR_SRecordInfo * record_info
The record info which describes a record of this dataset.
Definition epr_api.h:373
EPR_BandId::scaling_offset
float scaling_offset
The scaling offset.
Definition epr_api.h:714
e_err_file_not_found
@ e_err_file_not_found
Definition epr_api.h:93
e_err_unknown_endian_order
@ e_err_unknown_endian_order
Definition epr_api.h:114
e_err_file_read_error
@ e_err_file_read_error
Definition epr_api.h:95
e_err_invalid_band_name
@ e_err_invalid_band_name
Definition epr_api.h:110
e_err_file_close_failed
@ e_err_file_close_failed
Definition epr_api.h:98
e_err_illegal_data_type
@ e_err_illegal_data_type
Definition epr_api.h:90
e_err_invalid_product_name
@ e_err_invalid_product_name
Definition epr_api.h:109
e_err_invalid_product_id
@ e_err_invalid_product_id
Definition epr_api.h:102
e_err_invalid_keyword_name
@ e_err_invalid_keyword_name
Definition epr_api.h:113
e_err_invalid_field_name
@ e_err_invalid_field_name
Definition epr_api.h:107
e_err_file_access_denied
@ e_err_file_access_denied
Definition epr_api.h:94
e_err_invalid_data_format
@ e_err_invalid_data_format
Definition epr_api.h:111
e_err_file_open_failed
@ e_err_file_open_failed
Definition epr_api.h:97
e_err_invalid_band
@ e_err_invalid_band
Definition epr_api.h:104
e_err_index_out_of_range
@ e_err_index_out_of_range
Definition epr_api.h:88
e_err_invalid_dataset_name
@ e_err_invalid_dataset_name
Definition epr_api.h:106
e_err_invalid_record
@ e_err_invalid_record
Definition epr_api.h:103
e_err_null_pointer
@ e_err_null_pointer
Definition epr_api.h:84
e_err_invalid_ddbb_format
@ e_err_invalid_ddbb_format
Definition epr_api.h:121
e_err_illegal_arg
@ e_err_illegal_arg
Definition epr_api.h:85
e_err_file_write_error
@ e_err_file_write_error
Definition epr_api.h:96
e_err_invalid_value
@ e_err_invalid_value
Definition epr_api.h:112
e_err_none
@ e_err_none
Definition epr_api.h:81
e_err_illegal_conversion
@ e_err_illegal_conversion
Definition epr_api.h:89
e_err_flag_not_found
@ e_err_flag_not_found
Definition epr_api.h:117
e_err_out_of_memory
@ e_err_out_of_memory
Definition epr_api.h:87
e_err_api_not_initialized
@ e_err_api_not_initialized
Definition epr_api.h:101
e_err_invalid_raster
@ e_err_invalid_raster
Definition epr_api.h:105
e_err_illegal_state
@ e_err_illegal_state
Definition epr_api.h:86
e_err_invalid_record_name
@ e_err_invalid_record_name
Definition epr_api.h:108
EPR_Raster::source_step_x
uint source_step_x
The sub-sampling for the across-track direction in pixel.
Definition epr_api.h:555
EPR_FlagDef::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:613
e_smid_non
@ e_smid_non
Definition epr_api.h:148
e_smid_lin
@ e_smid_lin
Definition epr_api.h:149
e_smid_log
@ e_smid_log
Definition epr_api.h:150
EPR_BandId::band_name
char * band_name
The name as presented to the user in a band selection dialog (also known as spectral subset)
Definition epr_api.h:660
EPR_BandId::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:649
EPR_ProductId::sph_record
EPR_SRecord * sph_record
The record representing the specific product header (SPH).
Definition epr_api.h:279
EPR_FlagDef::description
char * description
The flag description.
Definition epr_api.h:628
EPR_DSD::ds_offset
uint ds_offset
The offset of dataset-information the product file.
Definition epr_api.h:421
EPR_BandId::flag_coding
EPR_SPtrArray * flag_coding
The flag coding is a list of EPR_SFlag instances.
Definition epr_api.h:738
EPR_ProductId::param_table
EPR_SPtrArray * param_table
A table containing dynamic field info parameters.
Definition epr_api.h:304
EPR_Field::elems
void * elems
The elements of this field.
Definition epr_api.h:515
EPR_ProductId::mph_record
EPR_SRecord * mph_record
The record representing the main product header (MPH).
Definition epr_api.h:274
EPR_FlagDef::name
char * name
The flag name.
Definition epr_api.h:618
EPR_Field::info
EPR_SFieldInfo * info
The corresponding field info for this field.
Definition epr_api.h:493
EPR_DSD::num_dsr
uint num_dsr
The number of dataset records for the given dataset name.
Definition epr_api.h:431
EPR_Raster::elem_size
uint elem_size
The size in byte of a single element (sample) of this raster's buffer.
Definition epr_api.h:540
EPR_Time::microseconds
uint microseconds
Definition epr_api.h:768
EPR_BandId::unit
char * unit
The geophysical unit for the band's pixel values.
Definition epr_api.h:743
EPR_Raster::source_height
uint source_height
The height of the source.
Definition epr_api.h:550
EPR_Time::days
int days
Definition epr_api.h:766
EPR_DSD::ds_type
char * ds_type
The dataset type descriptor.
Definition epr_api.h:411
EPR_Raster::raster_height
uint raster_height
The height of the raster in pixel.
Definition epr_api.h:572
EPR_Time::seconds
uint seconds
Definition epr_api.h:767
epr_get_pixel_as_float
float epr_get_pixel_as_float(const EPR_SRaster *raster, int x, int y)
EPR_ProductId::dsd_array
EPR_SPtrArray * dsd_array
An array containing all (!) DSDs read from the product's specific product header (SPH).
Definition epr_api.h:285
EPR_DatasetId::dataset_name
char * dataset_name
The name as presented to the user in a dataset selection dialog.
Definition epr_api.h:363
EPR_ProductId::dataset_ids
EPR_SPtrArray * dataset_ids
Contains and array of all dataset IDs for the product (type EPR_SDatasetId*)
Definition epr_api.h:309
EPR_BandId::bm_expr
char * bm_expr
A bit-mask expression used to filter valid pixels.
Definition epr_api.h:731
EPR_Record::magic
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:453
epr_get_pixel_as_uint
uint epr_get_pixel_as_uint(const EPR_SRaster *raster, int x, int y)
This group of functions is for getting the values of the elements of a raster (i.e.
e_tid_time
@ e_tid_time
A time (MJD) structure, C type is EPR_Time
Definition epr_api.h:70
e_tid_string
@ e_tid_string
A zero-terminated ASCII string, C type is char*
Definition epr_api.h:66
e_tid_uchar
@ e_tid_uchar
An array of unsigned 8-bit integers, C type is uchar*
Definition epr_api.h:50
e_tid_unknown
@ e_tid_unknown
The ID for unknown types.
Definition epr_api.h:48
e_tid_int
@ e_tid_int
An array of signed 32-bit integers, C type is int*
Definition epr_api.h:60
e_tid_char
@ e_tid_char
An array of signed 8-bit integers, C type is char*
Definition epr_api.h:52
e_tid_float
@ e_tid_float
An array of 32-bit floating point numbers, C type is float*
Definition epr_api.h:62
e_tid_short
@ e_tid_short
An array of signed 16-bit integers, C type is short*
Definition epr_api.h:56
e_tid_ushort
@ e_tid_ushort
An array of unsigned 16-bit integers, C type is ushort*
Definition epr_api.h:54
e_tid_uint
@ e_tid_uint
An array of unsigned 32-bit integers, C type is uint*
Definition epr_api.h:58
e_tid_double
@ e_tid_double
An array of 64-bit floating point numbers, C type is double*
Definition epr_api.h:64
e_tid_spare
@ e_tid_spare
An array of unsigned character, C type is uchar*
Definition epr_api.h:68
EPR_DSD::filename
char * filename
The filename in the DDDB with the description of this dataset.
Definition epr_api.h:416
epr_data_type_id_to_str
const char * epr_data_type_id_to_str(EPR_EDataTypeId data_type_id)
Gets the 'C' data type string for the given data type.
epr_get_data_type_size
uint epr_get_data_type_size(EPR_EDataTypeId data_type_id)
Gets the size in bytes for an element of the given data type.
epr_dump_record
void epr_dump_record(const EPR_SRecord *record)
epr_dump_field
void epr_dump_field(const EPR_SField *field)
epr_dump_element
void epr_dump_element(const EPR_SRecord *record, uint field_index, uint element_index)
epr_print_element
void epr_print_element(const EPR_SRecord *record, uint field_index, uint element_index, FILE *ostream)
epr_print_field
void epr_print_field(const EPR_SField *field, FILE *ostream)
epr_print_record
void epr_print_record(const EPR_SRecord *record, FILE *ostream)
EPR_BandId
The EPR_BandId structure contains information about a band within an ENVISAT product file which has b...
Definition epr_api.h:644
EPR_DSD
The EPR_DSD structure contains information about the propertier of a dataset properties and its locat...
Definition epr_api.h:391
EPR_DatasetId
The EPR_DatasetId structure contains information about a dataset within an ENVISAT product file which...
Definition epr_api.h:338
EPR_DatasetRef
The EPR_DatasetRef structure represents the information from dddb with the reference to data name (i...
Definition epr_api.h:597
EPR_Field
Represents a field within a record.
Definition epr_api.h:482
EPR_FlagDef
Represents a flag-field within a flag-record.
Definition epr_api.h:608
EPR_ProductId
The EPR_ProductId structure contains information about an ENVISAT product file which has been opened ...
Definition epr_api.h:228
EPR_Raster
Represents a raster in which data will be stored.
Definition epr_api.h:524
EPR_Record
The EPR_Record structure represents a record instance read from an ENVISAT dataset.
Definition epr_api.h:448
EPR_Time
Represents a binary time value field in ENVISAT records.
Definition epr_api.h:765