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