enpt package
Subpackages
- enpt.execution package
- Submodules
- enpt.execution.controller module
EnPT_Controller
EnPT_Controller._cleanup()
EnPT_Controller._print_received_configuration()
EnPT_Controller._write_to_stdout_stderr()
EnPT_Controller.cleanup()
EnPT_Controller.extract_zip_archive()
EnPT_Controller.read_L1B_data()
EnPT_Controller.run_all_processors()
EnPT_Controller.run_atmospheric_correction()
EnPT_Controller.run_dem_processor()
EnPT_Controller.run_orthorectification()
EnPT_Controller.run_spatial_optimization()
EnPT_Controller.run_toaRad2toaRef()
EnPT_Controller.write_output()
- Module contents
- enpt.io package
- enpt.model package
- enpt.options package
- enpt.processors package
- Subpackages
- enpt.processors.atmospheric_correction package
- enpt.processors.cloud_screening package
- enpt.processors.dead_pixel_correction package
- enpt.processors.dem_preprocessing package
- enpt.processors.image_correction package
- enpt.processors.orthorectification package
- enpt.processors.radiometric_transform package
- enpt.processors.spatial_module package
- enpt.processors.spatial_optimization package
- enpt.processors.spatial_transform package
- Module contents
- Subpackages
- enpt.utils package
Submodules
enpt.cli module
EnPT console argument parser.
- enpt.cli._str2bool(v)[source]
Convert string parameter to bool.
From: https://stackoverflow.com/a/43357954/2952871
- Parameters
v –
- Returns
- enpt.cli.main(parsed_args: Namespace = None) int [source]
Run the argument parser and forward the arguments to the linked functions.
- Parameters
parsed_args – argparse.Namespace instance of already parsed arguments (allows to call main() from test_cli_parser.py while passing specific arguments)
- Returns
exitcode (0: all fine, >=1: failed)
- enpt.cli.parsedArgs_to_user_opts(cli_args: Namespace) dict [source]
Convert argparse Namespace object to dictionary of explicitly given parameters.
- NOTE: All options that have not been given explicitly (None values) are removed. Reason: EnPTConfig prefers
directly passed arguments against those that are passed withi a JSON config file. So, e.g., if CPUs=None (default), the ‘CPUs’ parameter given within a JSON config file would be overridden.
=> only override JSON configuration if parameters are explicitly given (e.g., CPUs is set to 10) => if json_opts are given: default options are overridden with the options in the JSON config.
- Parameters
cli_args – options as parsed by the argparse.ArgumentParser
- enpt.cli.run_job(config: EnPTConfig)[source]
enpt.version module
Module contents
EnMAP processing tool (EnPT) software package developed by GFZ.
- class enpt.EnPTConfig(json_config='', **user_opts)[source]
Bases:
object
Create a job configuration.
- Parameters
json_config – path to JSON file containing configuration parameters or a string in JSON format
- Key CPUs
number of CPU cores to be used for processing (default: “None” -> use all available)
- Key path_l1b_enmap_image
input path of the EnMAP L1B image to be processed (zip-archive or root directory; must be given if not contained in –json-config.)
- Key path_l1b_enmap_image_gapfill
input path of an adjacent EnMAP L1B image to be used for gap-filling (zip-archive or root directory)
- Key path_dem
input path of digital elevation model in map or sensor geometry; GDAL compatible file format (must cover the EnMAP L1B data completely if given in map geometry or must have the same pixel dimensions like the EnMAP L1B data if given in sensor geometry)
- Key average_elevation
average elevation in meters above sea level; may be provided if no DEM is available; ignored if DEM is given
- Key output_dir
output directory where processed data and log files are saved
- Key output_format
file format of all raster output files (‘GTiff’: GeoTIFF, ‘ENVI’: ENVI BSQ; default: ‘ENVI’)
- Key output_interleave
raster data interleaving type (default: ‘pixel’) - ‘band’: band-sequential (BSQ), - ‘line’: data interleaved-by-line (BIL; only usable for ENVI output format), - ‘pixel’ data interleaved-by-pixel (BIP)
- Key working_dir
directory to be used for temporary files
- Key n_lines_to_append
number of lines to be added to the main image [if None, use the whole imgap]. Requires ‘path_l1b_enmap_image_gapfill’ to be set.
- Key drop_bad_bands
if set to True (default), the water absorption bands between 1358 and 1453 nm as well as between 1814 and 1961 nm are excluded from processing and will not be contained in the L2A product
- Key disable_progress_bars
whether to disable all progress bars during processing
- Key path_earthSunDist
input path of the earth sun distance model
- Key path_solar_irr
input path of the solar irradiance model
- Key scale_factor_toa_ref
scale factor to be applied to TOA reflectance result
- Key enable_keystone_correction
Enable keystone correction
- Key enable_vnir_swir_coreg
Enable VNIR/SWIR co-registration
- Key enable_absolute_coreg
Enable the co-registration of the EnMAP image to the reference image given with ‘path_reference_image’
- Key path_reference_image
Reference image for co-registration.
- Key polymer root
Polymer root directory (that contains the subdirectory for ancillary data).
- Key enable_ac
Enable atmospheric correction using SICOR algorithm (default: True). If False, the L2A output contains top-of-atmosphere reflectance.
- Key mode_ac
3 modes to determine which atmospheric correction is applied at which surfaces (default: land): - ‘land’: SICOR (developed for land surfaces is applied to land AND water surfaces - ‘water’: POLYMER (developed for water surfaces) is applied to water only
(land surfaces are no included in the L2A product)
- ‘combined’: SICOR is applied to land and POLYMER is applied to water surfaces;
NOTE that this may result in edge effects, e.g., at coastlines
- Key polymer_additional_results
Enable the generation of additional results when running ACwater/POLYMER (default: True)
- Key auto_download_ecmwf
Automatically download ECMWF AUX data when running Polymer atmospheric correction for water surfaces
- Key scale_factor_boa_ref
Scale factor to be applied to BOA reflectance result
- Key threads
number of threads for multiprocessing of blocks (see bellow): - ‘threads = 0’: for single thread - ‘threads < 0’: for as many threads as there are CPUs - ‘threads > 0’: gives the number of threads
- Key blocksize
block size for multiprocessing
- Key run_smile_P
Enable extra smile detection and correction (provider smile coefficients are ignored)
- Key run_deadpix_P
Enable dead pixel correction
- Key deadpix_P_algorithm
Algorithm for dead pixel correction (‘spectral’ or ‘spatial’)
- Key deadpix_P_interp_spectral
- Spectral interpolation algorithm to be used during dead pixel correction
(‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’)
- Key deadpix_P_interp_spatial
- Spatial interpolation algorithm to be used during dead pixel correction
(‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’)
- Key ortho_resampAlg
Ortho-rectification resampling algorithm (‘nearest’, ‘bilinear’, ‘gauss’)
- Key target_projection_type
Projection type of the raster output files (‘UTM’, ‘Geographic’) (default: ‘UTM’)
- Key target_epsg
Custom EPSG code of the target projection (overrides target_projection_type)
- Key target_coord_grid
Custom target coordinate grid where the output is resampled to ([x0, x1, y0, y1], e.g., [0, 30, 0, 30])
- get_json_opts(validate=True)[source]
Get a dictionary of EnPT config parameters.
NOTE: Reads the default options from options_default.json and updates the values with those from database.
- save(path_outfile)[source]
Save the JobConfig instance to a JSON file in the same structure like the one in options_default.json.
- Parameters
path_outfile – path of the output JSON file
- class enpt.EnPT_Controller(config: EnPTConfig = None, **config_kwargs: dict)[source]
Bases:
object
Class of EnPT process controller.
Initialize the Process Controller.
- Parameters
config – an instance of the EnPTConfig class (overrides config_kwargs)
config_kwargs – configuration parameters to be passed to EnPTConfig class
- classmethod _cleanup(tempDir, warn_message)[source]
Clean up implicitly (not to be called directly).
- static _write_to_stdout_stderr()[source]
Write to STDOUT and STDERR to reveal Queue.name of these streams to enpt_enmapboxapp.
- extract_zip_archive(path_zipfile: str, subdir: str = '') str [source]
Extract the given EnMAP image zip archive and return the L1B image root directory path.
- Parameters
path_zipfile – /path/to/zipfile.zip
subdir – subdirectory name to be created within temporary directory
- Returns
/tmp/tmpk2qp0yri/rootdir/
- read_L1B_data() None [source]
Read the provider L1B data given in config and return an EnMAP image object.