ENVISAT Product Reader API for C

Main Page   Data Structures   File List   Data Fields   Globals   Overview

API Overview


Logging   |  Error handling   |  Input / Output   |  Basic data access   |  Geophysical data access   |  Bit masks


Initialisation
Type
Name
Parameter
Description
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   Closes the ENVISAT product reader API by releasing all resources allocated by the API.


Logging

Type
Name
Parameter
Description
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.
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.


Error handling

Type
Name
Parameter
Description
void epr_set_err_handler EPR_FErrHandler err_handler Sets the error handler for the ENVISAT API.
EPR_EErrCode  epr_get_last_err_code   Sets the error code of the error that occured during the last API function call.
const char * epr_get_last_err_message   Sets the error message of the error that occured during the last API function call.
void epr_clear_err   Clears the last error.

TOP

Input / Output

Type
Name
Parameter
Description
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,organized the table with parameter of line length and tie points number;returns a file identifier for product.
int  epr_close_product EPR_SProductId *product_id Closes the ENVISAT product file determined by the given file identifier.

putting out an object to some file or standard output device

void epr_print_record const EPR_SRecord* record, FILE* istream            This group of functions is for writing an object to a file or standard output.
void epr_print_field  const EPR_SField* field, FILE* istream   
void epr_print_element const EPR_SRecord* record, uint field_index, uint element_index, FILE* istream)
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    

TOP

Basic data access

Type
Name
Parameter
Description
EPR_SDatasetId *  epr_get_dataset_id EPR_SProductId *product_id,
const char *dataset_name
Obtains a dataset ID from an ENVISAT product file.
uint epr_get_num_datasets EPR_SProductId* product_id Gets the number off all datasets contained in a product.
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_SDatasetId* epr_get_dataset_id EPR_SProductId* product_id,
const char* dataset_name
Gets the dataset_id coresponding to the specified dataset name.
const char* epr_get_dataset_name  EPR_SDatasetId* dataset_id Gets the name of the dataset for the given dataset ID.
EPR_SRecord *  epr_get_mph const EPR_SProductId* product_id Gets the MPH record from the given product.
EPR_SRecord *  epr_get_sph const EPR_SProductId *product_id Gets the SPH record from teh given product.
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_dsds const EPR_SDatasetId* dataset_id Gets the number off all dataset descriptions (dsd) contained in a product.
EPR_SDSD* epr_get_dsd_at const EPR_SDatasetId* dataset_id,
uint dsd_index
Gets the dsd at the specified position within the product.
uint  epr_get_num_records const EPR_DatasetID *dataset_id Gets the number of records of the dataset specified by dataset_id.
EPR_SRecord *  epr_create_record const EPR_SDatasetId *dataset_id Creates a new record for the dataset given by the specified dataset identifier.
EPR_SRecord *  epr_read_record EPR_SDatasetId *dataset_id, uint record_index, EPR_SRecord *record Reads a full record an ENVISAT product file.
void epr_free_record EPR_SRecord *record Frees the memory allocated through the given record.
uint epr_get_num_fields const EPR_SRecord* record Gets the number of fields contained in the given record.
const EPR_SField *  epr_get_field const EPR_SRecord *record, const char *field_name Gets a full field from the given record.
const EPR_SField * epr_get_field_at const EPR_SRecord *record, uint field_index Gets a field by index from the record.
const char * epr_get_field_unit const EPR_SField *field Gets the field unit.
const char * epr_get_field_description const EPR_SField *field Gets the field description.
uint epr_get_field_num_elems const EPR_SField *field Gets the field element number.
const char * epr_get_field_name const EPR_SField *field Gets the field name.
EPR_EDataTypeId epr_get_field_type const EPR_SField *field Gets the field type.

getting the field element as a typed value

char epr_get_field_elem_as_char const EPR_SField* field, uint elem_index This group of functions is for getting the elements of a field as a typed value. Typed value means that the returned variable is of a certain variable type, e.g. such as short or float. The type is located in the field info. See epr_get_field_type.One field must have one type only
uchar epr_get_field_elem_as_uchar const EPR_SField* field, uint elem_index
short epr_get_field_elem_as_short const EPR_SField* field, uint elem_index
ushort epr_get_field_elem_as_ushort const EPR_SField* field, uint elem_index
long epr_get_field_elem_as_long const EPR_SField* field, uint elem_index
ulong epr_get_field_elem_as_ulong const EPR_SField* field, uint elem_index
float epr_get_field_elem_as_float const EPR_SField* field, uint elem_index
double epr_get_field_elem_as_double const EPR_SField* field, uint elem_index
EPR_STime* epr_get_field_elem_as_mjd const EPR_SField* field
const char* epr_get_field_elem_as_str const EPR_SField* field

getting the array of field elements

uint epr_copy_field_elems_as_doubles const EPR_SField* field, double* buffer,
uint num_elems
This group of functions is for copying the data of the given field into the given buffer of elements by selected type. The actual number of elements copied is the minimum of the given number of elements (the buffer's size) and the actual number of elements contained in the field.
If the actual field data type is not selected type, the function automatically performs the conversion.
uint epr_copy_field_elems_as_floats const EPR_SField* field, float* buffer,
uint num_elems
uint epr_copy_field_elems_as_longs const EPR_SField* field, long* buffer,
uint num_elems
uint epr_copy_field_elems_as_ulongs const EPR_SField* field, ulong* buffer,
uint num_elems

interpreting the array of field elements

const char*  epr_get_field_elems_char const EPR_SField* field This group of functions is for interpreting an array of field elements as a typed values. Typed value means that the returned variable  is of a certain variable type, e.g. such as short or float. The type is located in the field info. See epr_get_field_type. One field must have one type only.
const uchar* epr_get_field_elems_uchar const EPR_SField* field
const short* epr_get_field_elems_short const EPR_SField* field
const ushort* epr_get_field_elems_ushort const EPR_SField* field
const long*  epr_get_field_elems_longs const EPR_SField* field
const ulong* epr_get_field_elems_ulong const EPR_SField* field
const float* epr_get_field_elems_floats const EPR_SField* field
const double* epr_get_field_elems_double const EPR_SField* field

TOP

Geophysical data access

Type
Name
Parameter
Description
EPR_SBandId *  epr_create_band_id EPR_SProductId *product_id, const char *band_name Obtains a band ID from an ENVISAT product file.
void  epr_free_band_id EPR_SBandId *band_id Release the memory allocated through a band ID.
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 the raster for the given sizes epr_create_compatible_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 the raster for the given sizes.
int  epr_read_band_raster EPR_SBandId *band_id, int offset_x, int offset_y, EPR_SRaster *raster Reads the pixels of the given band for the given region and and with the given sub-sampling.
void  epr_free_raster EPR_SRaster *raster Release the memory allocated through a raster.
uint  epr_get_num_bands EPR_SProductId* product_id Gets the number off all bands contained in a product.
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_SBandId*   epr_get_band_id EPR_SProductId* product_id, const char* band_name Gets the band_id corresponding to the specified name.
char*  epr_get_band_name EPR_SBandId* band_id Gets the name of the band for the given dataset ID.

getting the pixel elements as a typed values

ulong epr_get_pixel_as_ulong 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. pixel) in a type-safe way.
long  epr_get_pixel_as_long  const EPR_SRaster* raster, int x, int y
float epr_get_pixel_as_float const EPR_SRaster* raster, int x, int y
double epr_get_pixel_as_double const EPR_SRaster* raster, int x, int y


Bit masks

Type
Name
Parameter
Description
int  epr_read_bitmask_raster EPR_SProductId *product_id, const char *bm_expr, int offset_x, int offset_y, EPR_SRaster *raster Reads bit-mask pixels of the given product for the given bit-mask expression for the given region and and with the given sub-sampling.
const uint  epr_get_dataset_offset EPR_SDatasetId *dataset_id Gets the dataset offset.
const char *  epr_get_dataset_name const EPR_SRecord *record Gets a dataset name from the record.
EPR_SRecord *  epr_read_mph EPR_SProductId *product_id Reads the full main product header (MPH) of the ENVISAT product file given by the given product identifier.
EPR_SRecord *  epr_read_sph EPR_SProductId *product_id Reads the full specific product header (SPH) of the ENVISAT product file given by the given product identifier.
EPR_SRecord *  epr_read_dsd EPR_SProductId *product_id, uint dsd_index Reads the dataset descriptor (DSD) record with the given index from the ENVISAT product file given by the given product identifier.
uint  epr_get_records_number const EPR_SDatasetId *dataset_id Gets the record number by the given dataset.

TOP