📄 epr_api.h
字号:
* @return the field or <code>NULL</code> if an error occured. */const EPR_SField* epr_get_field(const EPR_SRecord* record, const char* field_name);/** * Gets the number of fields contained in the given record. * * @param record the record to be analysed, must not be <code>NULL</code> * @return the fields number or <code>0</code> if an error occured. */uint epr_get_num_fields(const EPR_SRecord* record);/** * Gets a field at the specified position within the record. * * @param record the record from the field shall be returned, * must not be <code>NULL</code> * @param field_index the zero-based index (position within record) of the field * @return the field or <code>NULL</code> if an error occured. */const EPR_SField* epr_get_field_at(const EPR_SRecord* record, uint field_index);/** * Gets the unit of the field. * * @param field the field from which the unit shall be returned, must not be <code>NULL</code> * @return the field unit or <code>NULL</code> if an error occured. */const char* epr_get_field_unit(const EPR_SField* field);/** * Gets the description of the field. * * @param field field from which the description shall be returned, must not be <code>NULL</code> * * @return the field description or <code>NULL</code> if an error occured. */const char* epr_get_field_description(const EPR_SField* field);/** * Gets the number of elements of the field. * * @param field field to be analysed, must not be <code>NULL</code> * * @return the number of elements of the field or <code>0</code> if an error occured. */uint epr_get_field_num_elems(const EPR_SField* field);/** * Gets the name of the field. * * @param field field to be analysed, must not be <code>NULL</code> * * @return the field name or <code>NULL</code> if an error occured. */const char* epr_get_field_name(const EPR_SField* field);/** * Gets the type of the field. * * @param field field to be analysed, must not be <code>NULL</code> * * @return the field type or <code>0</code> if an error occured. */EPR_EDataTypeId epr_get_field_type(const EPR_SField* field);/* * ========================= (5.4) Single Element Access ========================= *//** * This group of functions is for getting the elements of a field as a typed value. * <br> Typed value means that the returned variable is of a certain variable type, * e.g. such as short or float. * <br> The type is located in the field info. See epr_get_field_type. * <br> One field must have one type only. * * @param field the field, must not be <code>NULL</code> * @param elem_index the zero-based index of element to be returned, must not be negative. * * @return the typed value from given field *//*@{*/ char epr_get_field_elem_as_char(const EPR_SField* field, uint elem_index);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);const EPR_STime* epr_get_field_elem_as_mjd(const EPR_SField* field);const char* epr_get_field_elem_as_str(const EPR_SField* field);/*@}*//* * =========================== (5.5) Array Element Access ============================= *//** * This group of functions is for getting an array of field elements * of a certain data type. * <p>If the given field is not of the expected type, the functions * return <code>NULL</code>. * * @param field the field, must not be <code>NULL</code> * @return the data array of the expected type or <code>NULL</code> * if the field is of a different type *//*@{*/ const char* epr_get_field_elems_char(const EPR_SField* field);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_long(const EPR_SField* field);const ulong* epr_get_field_elems_ulong(const EPR_SField* field);const float* epr_get_field_elems_float(const EPR_SField* field);const double* epr_get_field_elems_double(const EPR_SField* field);/*@}*//** * 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. * <p>If the actual field data type is not selected type, the function automatically * performs the conversion. * * @param field the field from which to copy the elements * @param buffer the buffer in which to copy the data * @param num_elems the number of elements in the given buffer * @return the actual number of elements copied *//*@{*/uint epr_copy_field_elems_as_doubles(const EPR_SField* field, double* buffer, uint num_elems);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);/*@}*//* * ======================== (6) Geophysical Data Access ========================= * * ================================== (6.1) Raster =============================== *//** * Creates a raster which is compatible with the data type contained in the band * identified by band_id. The created raster is used to read the data in it * (see epr_read_band_raster). * <p> * The raster is defined on the grid of the product, from which the data are read. Spatial * subsets and undersampling are possible) through the parameter of the function. * <p> * The concept of defining the raster is such: A certain portion of the ENVISAT product * will be read into the raster. This is called the source. The complete ENVISAT product can be * much greater than the source. One can move the raster over the complete ENVISAT product and * read in turn different parts - always of the size of the source - of it into the raster. * The source is specified by the parameter source_height and source_width. * <p> * A typical example is a processing in blocks. Lets say, a block * has 64x32 pixel. Then, my source has a width of 64 pixel and a height of 32 pixel. Another * example is a processing of complete image lines. Then, my source has a widths of the complete * product (for example 1121 for a MERIS RR product), and a height of 1). One can loop over all blocks * read into the raster and process it. * <p> * In addition, it is possible to defined a subsampling step for a raster. This means, that the * source is not read 1:1 into the raster, but that only every 2nd or 3rd pixel is read. This step * can be set differently for the across track (source_step_x) and along track (source_step_y) directions. * * @param band_id the band identifier. The raster will be compatible with the data type * of that band; must not be <code>NULL</code> * @param source_width the width (across track dimension) of the source to be read into the raster. See text above. * @param source_height the height (along track dimension) of the source to be read into the raster. See text above. * @param source_step_x the subsampling step across track of the source when reading into the raster. See text above. * @param source_step_y the subsampling step along track of the source when reading into the raster. See text above. * * @return the new raster instance * or <code>NULL</code> if an error occured. */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 of the specified data type. This function can be used to create any type of raster, * e.g. for later use as a bit-mask. * * @param data_type the type of the data to stored in the raster, must not be <code>NULL</code> * @param source_width the width (across track dimension) of the source to be read into the raster. See description of epr_create_compatible_raster. * @param source_height the height (along track dimension) of the source to be read into the raster. See description of epr_create_compatible_raster. * @param source_step_x the subsampling step across track of the source when reading into the raster. See description of epr_create_compatible_raster. * @param source_step_y the subsampling step along track of the source when reading into the raster. See description of epr_create_compatible_raster. * @return the new raster instance * or <code>NULL</code> if an error occured. */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 to be used for reading bitmasks. The raster returned always is of type <code>byte</code>. * * @param source_width the width (across track dimension) of the source to be read into the raster. See description of epr_create_compatible_raster. * @param source_height the height (along track dimension) of the source to be read into the raster. See description of epr_create_compatible_raster. * @param source_step_x the subsampling step across track of the source when reading into the raster. See description of epr_create_compatible_raster. * @param source_step_y the subsampling step along track of the source when reading into the raster. See description of epr_create_compatible_raster. * @return the new raster instance * or <code>NULL</code> if an error occured. */EPR_SRaster* epr_create_bitmask_raster(uint source_width, uint source_height, uint source_step_x, uint source_step_y);/** * Reads (geo-)physical values of the given band of the specified source-region. * <p> The source-region is a defined part of the whole ENVISAT product image, which shall be read into * a raster. In this routine the co-ordinates are specified, where the source-region to be read starts. * The dimension of the region and the sub-sampling are attributes of the raster into which the data are * read. * * @param band_id the identified of the band to be read into the raster. * @param offset_x across-track source co-ordinate in pixel co-ordinates (zero-based) of the upper right corner of the source-region * @param offset_y along-track source co-ordinate in pixel co-ordinates (zero-based) of the upper right corner of the source-region * @param raster the identifier to given raster information and raster buffer * * @return zero for success, and error code otherwise * * @see epr_create_compatible_raster * @see epr_create_rater */int epr_read_band_raster(EPR_SBandId* band_id, int offset_x, int offset_y, EPR_SRaster* raster);/** * Gets the raster's scene width in pixels. * * @param raster the raster identifier, must not be <code>NULL</code> * @return the raster's total scene width in pixels, or <code>0</code> * if an error occured. */ulong epr_get_raster_width(EPR_SRaster* raster);/** * Gets the raster's scene height in pixels. * * @param raster the product identifier, must not be <code>NULL</code> * @return the raster's total scene height in pixels, or <code>0</code> * if an error occured. */ulong epr_get_raster_height(EPR_SRaster* raster);/** * Gets the number of all bands contained in a product. * * @param product_id the source product ID, must not be <code>NULL</code> * @return the number off all bands */uint epr_get_num_bands(EPR_SProductId* product_id);/** * Gets the band ID at the specified position within the product. * * @param product_id the source product ID, must not be <code>NULL</code> * @param index the index identifying the position of the band, starting with 0, * must not be negative * @return the requested band ID, or <code>NULL</code> if not found */EPR_SBandId* epr_get_band_id_at(EPR_SProductId* product_id, uint index);/** * Gets the band ID corresponding to the specified name. * * @param product_id the source product ID, must not be <code>NULL</code> * @param band_name the name of the band, must not be <code>NULL</code> * @return the requested band ID, or <code>NULL</code> if not found */EPR_SBandId* epr_get_band_id(EPR_SProductId* product_id, const char* band_name);/** * Gets the name of the band for the given band ID. * * @param band_id the band identifier, must not be <code>NULL</code> * @return the name of the band. */const char* epr_get_band_name(EPR_SBandId* band_id);/** * Release the memory allocated through a raster. * * @param raster the raster to be released. */void epr_free_raster(EPR_SRaster* raster);/* * ============================ (6.2) Single Pixel Access ======================== *//** * This group of functions is for getting the values of the elements of a raster * (i.e. pixel) in a type-safe way. <br> * * @param raster the raster which contains the pixel, must not be <code>NULL</code> * @param x the (zero-based) X co-ordinate of the pixel * @param y the (zero-based) Y co-ordinate of the pixel * * @return the typed value at the given co-ordinate. *//*@{*/ ulong epr_get_pixel_as_ulong(const EPR_SRaster* raster, int x, int y);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);/*@}*//* * ================================= (7) Bitmasks ========================== *//** * Calculates a bit-mask, composed of flags of the given product and combined as described in the * given bit-mask expression, for the a certain dimension and sub-sampling as defined in the * given raster. * <p> * * * @param product_id Identifier of the ENVISAT product for which the bit-mask shall be created. * This is used by the function to retreive the needed flags. * @param bm_expr A string holding the logical expression for the defintion of the bit-mask. * In a bit-mask expression, any number of the flag-names (found in the DDDB) can * be composed with "(", ")", "NOT", "AND", "OR". Valid bit-mask expression are for example: <br> * "flags.LAND OR flags.CLOUD" or "NOT flags.WATER AND flags.TURBID_S". * @param offset_x across-track co-ordinate in pixel co-ordinates (zero-based) of the upper right corner of the source-region * @param offset_y along-track co-ordinate in pixel co-ordinates (zero-based) of the upper right corner of the source-region * @param raster the raster for the bit-mask. The data type of the raster must be either e_tid_uchar or e_tid_char. * * @return zero for success, an error code otherwise * * @see create_band_raster */int epr_read_bitmask_raster(EPR_SProductId* product_id, const char* bm_expr, int offset_x, int offset_y, EPR_SRaster* raster);#ifdef __cplusplus} /* extern "C" */#endif#endif /* #ifndef EPR_API_H_INCL */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -