preprocessor package
Subpackages
- preprocessor.steps package
- preprocessor.transfer package
Submodules
preprocessor.archive module
- preprocessor.archive.filter_filenames(filenames: List[str], glob: str, case: bool = False) List[str] [source]
- preprocessor.archive.is_tarfile(archive_file) bool [source]
Helper to detect whether a path or a file object is referencing a valid TAR file.
- preprocessor.archive.open_tarfile(archive_file: str | bytes) TarFile [source]
Open a TAR file from either a path or a file object.
- preprocessor.archive.unpack_files(archive_path, target_dir: str, glob=None, case=None, filenames=None, recursive=False) List[str] [source]
Unpacks the contents of the specified ZIP or TAR archive to the given target directory. Optionally, only a given list of filenames will be extracted. When a glob is passed, all filenames (either given or from the archive) will be filtered and only the matching files will be extracted.
preprocessor.cli module
preprocessor.config module
preprocessor.daemon module
preprocessor.metadata module
- preprocessor.metadata.extract_footprint(metadata_files, footprint_extractor: str = '//gml:target/eop:Footprint/gml:multiExtentOf\n/gml:MultiSurface/gml:surfaceMembers/gml:Polygon')[source]
- preprocessor.metadata.extract_metadata_for_stac(metadata_files: Dict[str, str], product_type: str, product_level: str | None)[source]
Temporary function extracting necessary metadata to create a minimal STAC item. For now the xpaths are hardcoded here
preprocessor.preprocess module
- preprocessor.preprocess.custom_postprocessor(source_dir, target_dir, preprocess_config, path, data_file_globs: List[str] = [], args=None, kwargs=None)[source]
Preprocessing step for a custom preprocessing.
- preprocessor.preprocess.custom_preprocessor(source_dir, target_dir, preprocess_config, path, data_file_globs: List[str] = [], args=None, kwargs=None)[source]
Preprocessing step for a custom preprocessing.
- preprocessor.preprocess.preprocess_browse(config: dict, browse_type: str, browse_report: dict, browse: dict, use_dir: str | None = None)[source]
preprocessor.preprocessor_fix_core_dimap_image_ref module
- preprocessor.preprocessor_fix_core_dimap_image_ref.attempt_to_create_hdr(source_dir, target_dir, preprocess_config, output: str = 'imagery.hdr')[source]
preprocessor.preprocessor_iceye_helpers module
preprocessor.stac module
- class preprocessor.stac.HrefSortableAsset(href: str, title: str | None = None, description: str | None = None, media_type: str | None = None, roles: List[str] | None = None, extra_fields: Dict[str, Any] | None = None)[source]
Bases:
Asset
Helper function enabling sorting Assets by href.
- description: str | None
A description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.
- extra_fields: Dict[str, Any]
Optional, additional fields for this asset. This is used by extensions as a way to serialize and deserialize properties on asset object JSON.
- href: str
Link to the asset object. Relative and absolute links are both allowed.
- media_type: str | None
Optional description of the media type. Registered Media Types are preferred. See
MediaType
for common media types.
- owner: Item | Collection | None
The
Item
orCollection
that this asset belongs to, orNone
if it has no owner.
- roles: List[str] | None
Optional, Semantic roles (i.e. thumbnail, overview, data, metadata) of the asset.
- title: str | None
Optional displayed title for clients and users.
- class preprocessor.stac.STATS_APPROX(value)[source]
Bases:
IntEnum
An enumeration.
- APPROX_OK = 1
- APPROX_OVERVIEW = 2
- NO_APROX = 0
- preprocessor.stac.create_simple_stac_item(preprocessor_config: dict, root_config: dict, upload_files: Dict[str, str], extra_files: Dict[str, str], product_type: str, product_level: str | None)[source]
Temporary method creating a minimal STAC item from information about products uploaded and metadata files uploaded. Accepts: ‘upload_files’ dictionary of upload_files (images), where key is local path and value is remote path. ‘extra_files’ dictionary of extra_files (sidecar or metadata), where key is local path and value is remote path. Assuming metadata file to read and create a STAC info from is first to pick by iterator.
- preprocessor.stac.create_stac_asset(local_path: str, remote_path: str, root_config: Dict[str, Any], asset_config: Dict[str, Any], name: str = '', aggregator: Dict = {}, is_image: bool = False, compute_statistics: bool = False, approx: STATS_APPROX = STATS_APPROX.APPROX_OK, force_histogram_min_value: float | None = None, force_histogram_max_value: float | None = None)[source]
Helper function creating a STAC asset and filling it with image/metadata properties based on config.
preprocessor.util module
- class preprocessor.util.Timer[source]
Bases:
object
Helper timer class to allow logging of timing values
- property elapsed
- preprocessor.util.apply_gdal_config_options(preprocessor_config)[source]
Applies config specific gdal configuration options for a given preprocessing step Returning original values to allow switching them back after preprocessing done.
- preprocessor.util.convert_unit(size_in_bytes, unit='B')[source]
Convert the size from bytes to other units like KB, MB, GB, TB
- preprocessor.util.get_all_data_files(source_dir, preprocessor_config, data_file_globs=[])[source]
Based on ‘data_file_globs’ configuration, gets all unique data file paths from folder matching any of the globs
- preprocessor.util.get_size_in_bytes(file_path, unit)[source]
Get size of file at given path in bytes