31#include "epr_ptrarray.h"
33#define EPR_PRODUCT_API_NAME_STR "ENVISAT Product Reader API"
34#define EPR_PRODUCT_API_VERSION_STR "2.3"
157struct EPR_RecordInfo;
160struct EPR_ProductInfo;
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
213#define EPR_PRODUCT_ID_STRLEN 48
1384 uint source_step_y);
1402 uint source_step_y);
1418 uint source_step_y);
1584 const char* bm_expr,
double epr_get_field_elem_as_double(const EPR_SField *field, uint elem_index)
const float * epr_get_field_elems_float(const EPR_SField *field)
uint epr_copy_field_elems_as_doubles(const EPR_SField *field, double *buffer, uint num_elems)
struct EPR_BitmaskTerm EPR_SBitmaskTerm
Definition epr_api.h:187
EPR_LogLevel
The EPR_LogLevel enumeration lists possible log levels for the ENVISAT product reader API.
Definition epr_api.h:130
const ushort * epr_get_field_elems_ushort(const EPR_SField *field)
uint epr_copy_field_elems_as_uints(const EPR_SField *field, uint *buffer, uint num_elems)
enum EPR_SampleModel EPR_ESampleModel
Definition epr_api.h:172
EPR_SampleModel
Definition epr_api.h:138
const char * epr_get_field_elem_as_str(const EPR_SField *field)
const EPR_STime * epr_get_field_elem_as_mjd(const EPR_SField *field)
int epr_get_field_elem_as_int(const EPR_SField *field, uint elem_index)
uint epr_copy_field_elems_as_floats(const EPR_SField *field, float *buffer, uint num_elems)
enum EPR_ErrCode EPR_EErrCode
Definition epr_api.h:170
uint epr_copy_field_elems_as_ints(const EPR_SField *field, int *buffer, uint num_elems)
const double * epr_get_field_elems_double(const EPR_SField *field)
unsigned char uchar
Definition epr_api.h:194
enum EPR_DataTypeId EPR_EDataTypeId
Definition epr_api.h:169
unsigned long ulong
Definition epr_api.h:197
void(* EPR_FErrHandler)(EPR_EErrCode err_code, const char *err_message)
Definition epr_api.h:189
short epr_get_field_elem_as_short(const EPR_SField *field, uint elem_index)
uchar epr_get_field_elem_as_uchar(const EPR_SField *field, uint elem_index)
struct EPR_FieldInfo EPR_SFieldInfo
Definition epr_api.h:180
EPR_ErrCode
The EPR_ErrCode enumeration lists all possible error codes for the ENVISAT product reader API.
Definition epr_api.h:79
unsigned int uint
Definition epr_api.h:196
struct EPR_FlagSet EPR_SFlagSet
Definition epr_api.h:188
const uchar * epr_get_field_elems_uchar(const EPR_SField *field)
EPR_ScalingMethod
Definition epr_api.h:147
const short * epr_get_field_elems_short(const EPR_SField *field)
int EPR_Magic
Definition epr_api.h:200
enum EPR_LogLevel EPR_ELogLevel
Definition epr_api.h:171
ushort epr_get_field_elem_as_ushort(const EPR_SField *field, uint elem_index)
unsigned short ushort
Definition epr_api.h:195
void(* EPR_FLogHandler)(EPR_ELogLevel log_level, const char *log_message)
Definition epr_api.h:190
const int * epr_get_field_elems_int(const EPR_SField *field)
const uint * epr_get_field_elems_uint(const EPR_SField *field)
uint epr_get_field_elem_as_uint(const EPR_SField *field, uint elem_index)
struct EPR_ParamElem EPR_SParamElem
Definition epr_api.h:184
float epr_get_field_elem_as_float(const EPR_SField *field, uint elem_index)
char epr_get_field_elem_as_char(const EPR_SField *field, uint elem_index)
int epr_boolean
Definition epr_api.h:193
struct EPR_RecordInfo EPR_SRecordInfo
Definition epr_api.h:178
#define EPR_PRODUCT_ID_STRLEN
Definition epr_api.h:213
EPR_DataTypeId
The EPR_DataTypeId enumeration lists all possible data types for field elements in ENVISAT dataset re...
Definition epr_api.h:46
enum EPR_ScalingMethod EPR_EScalingMethod
Definition epr_api.h:173
const char * epr_get_field_elems_char(const EPR_SField *field)
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 ...
uint epr_get_num_datasets(EPR_SProductId *product_id)
Gets the number off all datasets contained in a product.
const char * epr_get_dsd_name(const EPR_SDatasetId *dataset_id)
Gets the name of the dsd for the given dataset ID.
EPR_SRecord * epr_get_sph(const EPR_SProductId *product_id)
Gets the SPH record from the given product_id.
EPR_SDSD * epr_get_dsd_at(const EPR_SProductId *product_id, uint dsd_index)
const char * epr_get_dataset_name(EPR_SDatasetId *dataset_id)
Gets the name of the dataset for the given dataset ID.
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_SRecord * epr_get_mph(const EPR_SProductId *product_id)
Gets the MPH record from the given product_id.
uint epr_get_num_dsds(const EPR_SProductId *product_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.
const EPR_SDSD * epr_get_dsd(const EPR_SDatasetId *dataset_id)
Gets the dataset descriptor (DSD) for the dataset specified by dataset_id.
uint epr_get_num_records(const EPR_SDatasetId *dataset_id)
Gets the number of records of the dataset specified by dataset_id.
uint epr_get_scene_width(const EPR_SProductId *product_id)
Gets the product's scene width in pixels.
uint epr_get_scene_height(const EPR_SProductId *product_id)
Gets the product's scene height in pixels.
void epr_clear_err(void)
Clears the last error.
EPR_EErrCode epr_get_last_err_code(void)
Gets the error code of the error that occured during the last API function call.
void epr_set_err_handler(EPR_FErrHandler err_handler)
Sets the error handler for the ENVISAT API.
const char * epr_get_last_err_message(void)
Gets the error message of the error that occured during the last API function call.
const char * epr_get_field_description(const EPR_SField *field)
Gets the description of the field.
const char * epr_get_field_unit(const EPR_SField *field)
Gets the unit of the field.
const char * epr_get_field_name(const EPR_SField *field)
Gets the name of the field.
const EPR_SField * epr_get_field_at(const EPR_SRecord *record, uint field_index)
Gets a field at the specified position within the record.
uint epr_get_num_fields(const EPR_SRecord *record)
Gets the number of fields contained in the given record.
uint epr_get_field_num_elems(const EPR_SField *field)
Gets the number of elements of the field.
EPR_EDataTypeId epr_get_field_type(const EPR_SField *field)
Gets the type of the field.
const EPR_SField * epr_get_field(const EPR_SRecord *record, const char *field_name)
Gets a field from the given record.
int epr_init_api(EPR_ELogLevel log_level, EPR_FLogHandler log_handler, EPR_FErrHandler err_handler)
Initializes the ENVISAT product reader API.
void epr_close_api(void)
Closes the ENVISAT product reader API by releasing all resources allocated by the API.
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.
int epr_set_log_level(EPR_ELogLevel log_level)
Sets the log level for the ENVISAT API.
void epr_set_log_handler(EPR_FLogHandler log_handler)
Sets the log handler for the ENVISAT API.
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,...
int epr_close_product(EPR_SProductId *product_id)
Closes the ENVISAT product file determined by the given product identifier.
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_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.
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.
void * epr_get_raster_elem_addr(const EPR_SRaster *raster, uint offset)
const char * epr_get_band_name(EPR_SBandId *band_id)
Gets the name of the band for the given band ID.
void epr_free_raster(EPR_SRaster *raster)
Release the memory allocated through a raster.
void * epr_get_raster_line_addr(const EPR_SRaster *raster, uint y)
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.
uint epr_get_num_bands(EPR_SProductId *product_id)
Gets the number of all bands contained in a product.
uint epr_get_raster_elem_size(const EPR_SRaster *raster)
uint epr_get_raster_height(EPR_SRaster *raster)
Gets the raster's scene height in pixels.
EPR_SBandId * epr_get_band_id(EPR_SProductId *product_id, const char *band_name)
Gets the band ID corresponding to the specified name.
EPR_SBandId * epr_get_band_id_at(EPR_SProductId *product_id, uint index)
Gets the band ID at the specified position within the product.
uint epr_get_raster_width(EPR_SRaster *raster)
Gets the raster's scene width in pixels.
void * epr_get_raster_pixel_addr(const EPR_SRaster *raster, uint x, uint y)
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.
void epr_free_record(EPR_SRecord *record)
Frees the memory allocated through the given 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.
const EPR_SDSD * dsd
The dataset descriptor obtained from the current product.
Definition epr_api.h:358
uint bit_mask
The bit mask describing this flag.
Definition epr_api.h:623
char * dsd_name
The name as presented to the user in a dsd selection dialog.
Definition epr_api.h:353
char * description
A short description of the band's contents.
Definition epr_api.h:379
char * ds_name
The dataset name.
Definition epr_api.h:406
EPR_SRecordInfo * info
The corresponding record info for this record (a 'soft' pointer).
Definition epr_api.h:458
@ e_log_debug
Definition epr_api.h:131
@ e_log_info
Definition epr_api.h:132
@ e_log_error
Definition epr_api.h:134
@ e_log_warning
Definition epr_api.h:133
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
uint dsr_size
The size of dataset record for the given dataset name.
Definition epr_api.h:436
EPR_SProductId * product_id
The ID of the product to which this band belongs to.
Definition epr_api.h:654
@ e_smod_2OF2
Definition epr_api.h:141
@ e_smod_1OF2
Definition epr_api.h:140
@ e_smod_3TOI
Definition epr_api.h:142
@ e_smod_2TOF
Definition epr_api.h:143
@ e_smod_1OF1
Definition epr_api.h:139
int epr_get_pixel_as_int(const EPR_SRaster *raster, int x, int y)
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_EDataTypeId data_type
The data type of the band's pixel values.
Definition epr_api.h:693
uint raster_width
The width of the raster in pixel.
Definition epr_api.h:566
void * buffer
The elements of this raster.
Definition epr_api.h:578
EPR_SPtrArray * band_ids
Contains and array of all band IDs for the product (type EPR_SBandId*)
Definition epr_api.h:314
FILE * istream
The input stream as returned by the ANSI C fopen function for the given file path.
Definition epr_api.h:244
EPR_SProductId * product_id
The ID of the product to which this dataset belongs to.
Definition epr_api.h:348
int meris_iodd_version
For MERIS L1b and RR and FR to provide backward compatibility.
Definition epr_api.h:319
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:396
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
int field_index
Definition epr_api.h:599
char id_string[EPR_PRODUCT_ID_STRLEN+1]
The product identifier string obtained from the MPH parameter 'PRODUCT'.
Definition epr_api.h:269
uint source_width
The width of the source .
Definition epr_api.h:545
uint tot_size
The total size in bytes of the product file.
Definition epr_api.h:249
const struct RecordDescriptor * record_descriptor
The record descriptor found in the DDDB for this dataset.
Definition epr_api.h:368
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:529
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:343
EPR_EDataTypeId data_type
The data type of the band's pixel values.
Definition epr_api.h:535
uint source_step_y
The sub-sampling for the along-track direction in pixel.
Definition epr_api.h:560
uint scene_height
The total height of product's scene raster in pixels.
Definition epr_api.h:259
char * description
A short description of the band's contents.
Definition epr_api.h:748
uint ds_size
The size of dataset-information in dataset product file.
Definition epr_api.h:426
int spectr_band_index
The (zero-based) spectral band index.
Definition epr_api.h:665
double epr_get_pixel_as_double(const EPR_SRaster *raster, int x, int y)
EPR_SField ** fields
The record fields.
Definition epr_api.h:471
EPR_SDatasetId * dataset_id
Definition epr_api.h:598
char * file_path
The file's path including the file name.
Definition epr_api.h:238
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:487
uint num_fields
The number of fields contained in this record.
Definition epr_api.h:465
int elem_index
Definition epr_api.h:600
uint scene_width
The total width of product's scene raster in pixels.
Definition epr_api.h:254
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:233
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
float scaling_factor
The scaling factor.
Definition epr_api.h:726
EPR_SPtrArray * record_info_cache
Cache for record infos.
Definition epr_api.h:296
int index
The index of this DSD (zero-based)
Definition epr_api.h:401
EPR_SRecordInfo * record_info
The record info which describes a record of this dataset.
Definition epr_api.h:373
float scaling_offset
The scaling offset.
Definition epr_api.h:714
@ e_err_file_not_found
Definition epr_api.h:93
@ e_err_unknown_endian_order
Definition epr_api.h:114
@ e_err_file_read_error
Definition epr_api.h:95
@ e_err_invalid_band_name
Definition epr_api.h:110
@ e_err_file_close_failed
Definition epr_api.h:98
@ e_err_illegal_data_type
Definition epr_api.h:90
@ e_err_invalid_product_name
Definition epr_api.h:109
@ e_err_invalid_product_id
Definition epr_api.h:102
@ e_err_invalid_keyword_name
Definition epr_api.h:113
@ e_err_invalid_field_name
Definition epr_api.h:107
@ e_err_file_access_denied
Definition epr_api.h:94
@ e_err_invalid_data_format
Definition epr_api.h:111
@ e_err_file_open_failed
Definition epr_api.h:97
@ e_err_invalid_band
Definition epr_api.h:104
@ e_err_index_out_of_range
Definition epr_api.h:88
@ e_err_invalid_dataset_name
Definition epr_api.h:106
@ e_err_invalid_record
Definition epr_api.h:103
@ e_err_null_pointer
Definition epr_api.h:84
@ e_err_invalid_ddbb_format
Definition epr_api.h:121
@ e_err_illegal_arg
Definition epr_api.h:85
@ e_err_file_write_error
Definition epr_api.h:96
@ e_err_invalid_value
Definition epr_api.h:112
@ e_err_none
Definition epr_api.h:81
@ e_err_illegal_conversion
Definition epr_api.h:89
@ e_err_flag_not_found
Definition epr_api.h:117
@ e_err_out_of_memory
Definition epr_api.h:87
@ e_err_api_not_initialized
Definition epr_api.h:101
@ e_err_invalid_raster
Definition epr_api.h:105
@ e_err_illegal_state
Definition epr_api.h:86
@ e_err_invalid_record_name
Definition epr_api.h:108
uint source_step_x
The sub-sampling for the across-track direction in pixel.
Definition epr_api.h:555
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:613
@ e_smid_non
Definition epr_api.h:148
@ e_smid_lin
Definition epr_api.h:149
@ e_smid_log
Definition epr_api.h:150
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_Magic magic
The magic number for this structure.
Definition epr_api.h:649
EPR_SRecord * sph_record
The record representing the specific product header (SPH).
Definition epr_api.h:279
char * description
The flag description.
Definition epr_api.h:628
uint ds_offset
The offset of dataset-information the product file.
Definition epr_api.h:421
EPR_SPtrArray * flag_coding
The flag coding is a list of EPR_SFlag instances.
Definition epr_api.h:738
EPR_SPtrArray * param_table
A table containing dynamic field info parameters.
Definition epr_api.h:304
void * elems
The elements of this field.
Definition epr_api.h:515
EPR_SRecord * mph_record
The record representing the main product header (MPH).
Definition epr_api.h:274
char * name
The flag name.
Definition epr_api.h:618
EPR_SFieldInfo * info
The corresponding field info for this field.
Definition epr_api.h:493
uint num_dsr
The number of dataset records for the given dataset name.
Definition epr_api.h:431
uint elem_size
The size in byte of a single element (sample) of this raster's buffer.
Definition epr_api.h:540
uint microseconds
Definition epr_api.h:768
char * unit
The geophysical unit for the band's pixel values.
Definition epr_api.h:743
uint source_height
The height of the source.
Definition epr_api.h:550
int days
Definition epr_api.h:766
char * ds_type
The dataset type descriptor.
Definition epr_api.h:411
uint raster_height
The height of the raster in pixel.
Definition epr_api.h:572
uint seconds
Definition epr_api.h:767
float epr_get_pixel_as_float(const EPR_SRaster *raster, int x, int y)
EPR_SPtrArray * dsd_array
An array containing all (!) DSDs read from the product's specific product header (SPH).
Definition epr_api.h:285
char * dataset_name
The name as presented to the user in a dataset selection dialog.
Definition epr_api.h:363
EPR_SPtrArray * dataset_ids
Contains and array of all dataset IDs for the product (type EPR_SDatasetId*)
Definition epr_api.h:309
char * bm_expr
A bit-mask expression used to filter valid pixels.
Definition epr_api.h:731
EPR_Magic magic
The magic number for this structure.
Definition epr_api.h:453
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
A time (MJD) structure, C type is EPR_Time
Definition epr_api.h:70
@ e_tid_string
A zero-terminated ASCII string, C type is char*
Definition epr_api.h:66
@ e_tid_uchar
An array of unsigned 8-bit integers, C type is uchar*
Definition epr_api.h:50
@ e_tid_unknown
The ID for unknown types.
Definition epr_api.h:48
@ e_tid_int
An array of signed 32-bit integers, C type is int*
Definition epr_api.h:60
@ e_tid_char
An array of signed 8-bit integers, C type is char*
Definition epr_api.h:52
@ e_tid_float
An array of 32-bit floating point numbers, C type is float*
Definition epr_api.h:62
@ e_tid_short
An array of signed 16-bit integers, C type is short*
Definition epr_api.h:56
@ e_tid_ushort
An array of unsigned 16-bit integers, C type is ushort*
Definition epr_api.h:54
@ e_tid_uint
An array of unsigned 32-bit integers, C type is uint*
Definition epr_api.h:58
@ e_tid_double
An array of 64-bit floating point numbers, C type is double*
Definition epr_api.h:64
@ e_tid_spare
An array of unsigned character, C type is uchar*
Definition epr_api.h:68
char * filename
The filename in the DDDB with the description of this dataset.
Definition epr_api.h:416
const char * epr_data_type_id_to_str(EPR_EDataTypeId data_type_id)
Gets the 'C' data type string for the given data type.
uint epr_get_data_type_size(EPR_EDataTypeId data_type_id)
Gets the size in bytes for an element of the given data type.
void epr_dump_record(const EPR_SRecord *record)
void epr_dump_field(const EPR_SField *field)
void epr_dump_element(const EPR_SRecord *record, uint field_index, uint element_index)
void epr_print_element(const EPR_SRecord *record, uint field_index, uint element_index, FILE *ostream)
void epr_print_field(const EPR_SField *field, FILE *ostream)
void epr_print_record(const EPR_SRecord *record, FILE *ostream)
The EPR_BandId structure contains information about a band within an ENVISAT product file which has b...
Definition epr_api.h:644
The EPR_DSD structure contains information about the propertier of a dataset properties and its locat...
Definition epr_api.h:391
The EPR_DatasetId structure contains information about a dataset within an ENVISAT product file which...
Definition epr_api.h:338
The EPR_DatasetRef structure represents the information from dddb with the reference to data name (i...
Definition epr_api.h:597
Represents a field within a record.
Definition epr_api.h:482
Represents a flag-field within a flag-record.
Definition epr_api.h:608
The EPR_ProductId structure contains information about an ENVISAT product file which has been opened ...
Definition epr_api.h:228
Represents a raster in which data will be stored.
Definition epr_api.h:524
The EPR_Record structure represents a record instance read from an ENVISAT dataset.
Definition epr_api.h:448
Represents a binary time value field in ENVISAT records.
Definition epr_api.h:765