Usage

Usage of the Python API

Run the whole pipeline at once

To run the whole EnPT processing pipeline via the Python API:

from enpt.execution.controller import EnPT_Controller

config_minimal = dict(
    path_l1b_enmap_image='/path/ENMAP*L1B*.zip',
    path_dem='/path/to/overlapping/DEM.bsq'
)
CTR = EnPT_Controller(**config_minimal)
CTR.run_all_processors()

Further configuration parameters are documented here. Note that the class EnPTConfig takes the same keyword arguments like the EnPT_Controller class.

You can also pass a JSON-File with your EnPT configuration to the EnPT_Controller class. This allows you to easily copy and reuse configuration files. A template with all possible options and defaults can be found in enpt/options/options_default.json.

The corresponding Python call looks like this:

from enpt.execution.controller import EnPT_Controller
from enpt.options.config import EnPTConfig

CFG = EnPTConfig(json_config='/path/to/your/config_file.json')
CTR = EnPT_Controller(config=CFG)
CTR.run_all_processors()

Run each processor module separately

To run the different processor modules separately, follow the instructions below. Note, that the processors are built on each other, so the order must be unchanged.

  1. To get an instance of EnPT_Controller:

    CTR = EnPT_Controller(**your_config_parameters)  # config parameters are described above
    
  2. Read the EnMAP Level-1B data into memory, convert DNs to radiance and compute coordiante layers:

    CTR.read_L1B_data()
    

    Get the in-memory Python object representing the Level-1 dataset (NOTE: the attributes and methods of this Python object are documented here):

    L1_obj = CTR.L1_obj
    
  3. To correct dead pixels:

    CTR.L1_obj.correct_dead_pixels()
    
  4. reflectance conversion

    To run the atmospheric correction using SICOR:

    CTR.run_atmospheric_correction()
    

    To run convert top-of-atmosphere radiance to top-of-atmosphere reflectance (as an alternative to atmospheric correction):

    CTR.run_toaRad2toaRef()
    
  5. To compute spatial misregistration with respect to a user-provided reference dataset (NOTE: This feature is yet implemented):

    CTR.run_geometry_processor()
    
  6. To run the orthorectification:

    self.run_orthorectification()
    

    From now on, you may get the in-memory EnMAP Level-2 Python object (attributes and methods are documented here):

    L2_obj = CTR.L2_obj
    
  7. To write the EnMAP Level-2 data to disk:

    L2_obj = CTR.write_output()
    

Command line utilities

enpt

At the command line, EnPT provides the enpt command:

EnMAP Processing Tool console argument parser.

usage: enpt [-h] [--version] [-jc [JSON_CONFIG]] [--CPUs CPUS]
            [-im PATH_L1B_ENMAP_IMAGE] [-imgap PATH_L1B_ENMAP_IMAGE_GAPFILL]
            [-dem PATH_DEM] [-dummyfmt [IS_DUMMY_DATAFORMAT]]
            [-ele AVERAGE_ELEVATION] [-od OUTPUT_DIR] [-of OUTPUT_FORMAT]
            [-ointlv OUTPUT_INTERLEAVE] [-ond OUTPUT_NODATA_VALUE]
            [-wd WORKING_DIR] [-nla N_LINES_TO_APPEND] [-dbb DROP_BAD_BANDS]
            [-dpb [DISABLE_PROGRESS_BARS]]
            [--path_earthSunDist PATH_EARTHSUNDIST]
            [--path_solar_irr PATH_SOLAR_IRR]
            [--scale_factor_toa_ref SCALE_FACTOR_TOA_REF]
            [--enable_keystone_correction [ENABLE_KEYSTONE_CORRECTION]]
            [--enable_vnir_swir_coreg [ENABLE_VNIR_SWIR_COREG]]
            [--path_reference_image PATH_REFERENCE_IMAGE]
            [--polymer_root POLYMER_ROOT] [--enable_ac [ENABLE_AC]]
            [--mode_ac [MODE_AC]]
            [--polymer_additional_results [POLYMER_ADDITIONAL_RESULTS]]
            [--auto_download_ecmwf [AUTO_DOWNLOAD_ECMWF]]
            [--scale_factor_boa_ref SCALE_FACTOR_BOA_REF] [--threads THREADS]
            [--blocksize BLOCKSIZE] [--run_smile_P [RUN_SMILE_P]]
            [--run_deadpix_P [RUN_DEADPIX_P]]
            [--deadpix_P_algorithm DEADPIX_P_ALGORITHM]
            [--deadpix_P_interp_spectral DEADPIX_P_INTERP_SPECTRAL]
            [--deadpix_P_interp_spatial DEADPIX_P_INTERP_SPATIAL]
            [--ortho_resampAlg ORTHO_RESAMPALG]
            [--vswir_overlap_algorithm VSWIR_OVERLAP_ALGORITHM]
            [-tgtprj TARGET_PROJECTION_TYPE] [-tgtepsg TARGET_EPSG]
            [-tgtgrid TARGET_COORD_GRID TARGET_COORD_GRID TARGET_COORD_GRID TARGET_COORD_GRID]

Named Arguments

--version

show program’s version number and exit

-jc, --json_config

file path of a JSON file containing options. See here for an example: https://git.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/EnPT/blob/main/enpt/options/options_default.json

--CPUs

number of CPU cores to be used for processing (default: “None” -> use all available)

-im, --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.)

-imgap, --path_l1b_enmap_image_gapfill

input path of an adjacent EnMAP L1B image to be used for gap-filling (zip-archive or root directory)

-dem, --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)

-dummyfmt, --is_dummy_dataformat

Set to true in case of the preliminary, GFZ-internal dataformat as used for the Alpine test dataset. (default: False. Note: This will be removed in future.)

Default: False

-ele, --average_elevation

average elevation in meters above sea level; may be provided if no DEM is available; ignored if DEM is given

Default: 0

-od, --output_dir

output directory where processed data and log files are saved

-of, --output_format

file format of all raster output files (‘GTiff’: GeoTIFF, ‘ENVI’: ENVI BSQ; default: ‘ENVI’)

Default: “GTiff”

-ointlv, --output_interleave

raster data interleaving type (‘band’, ‘line’, ‘pixel’; default: ‘pixel’)

Default: “pixel”

-ond, --output_nodata_value

output no-data/background value (should be within the integer 16-bit range)

Default: -32768

-wd, --working_dir

directory to be used for temporary files

-nla, --n_lines_to_append

number of lines to be added to the main image [if None, use the whole imgap]. Requires –imgap to be set

-dbb, --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

Default: True

-dpb, --disable_progress_bars

whether to disable all progress bars during processing

Default: False

--path_earthSunDist

input path of the earth sun distance model

--path_solar_irr

input path of the solar irradiance model

--scale_factor_toa_ref

scale factor to be applied to TOA reflectance result

--enable_keystone_correction

Enable keystone correction

Default: False

--enable_vnir_swir_coreg

Enable VNIR/SWIR co-registration

Default: False

--path_reference_image

Reference image for co-registration.

--polymer_root

Polymer root directory (that contains the subdirectory for ancillary data)

--enable_ac

Enable atmospheric correction using SICOR algorithm (default: True). If False, the L2A output contains top-of-atmosphere reflectance

Default: True

--mode_ac

3 modes to determine which atmospheric correction is applied at which surfaces (default: land): (‘land’, water’, ‘combined’)

--polymer_additional_results

Enable the generation of additional results when running ACwater/POLYMER (default: True)

Default: True

--auto_download_ecmwf

Automatically download ECMWF AUX data when running Polymer atmospheric correction for water surfaces

Default: True

--scale_factor_boa_ref

Scale factor to be applied to BOA reflectance result

Default: 10000

--threads

Number of threads in ACwater Polymer: 0 for single thread; < 0 for as many as there are CPUs; and > 0 gives the number of threads

Default: -1

--blocksize

Block size in ACwater Polymer

Default: 100

--run_smile_P

Enable extra smile detection and correction (provider smile coefficients are ignored)

Default: False

--run_deadpix_P

Enable dead pixel correction

Default: False

--deadpix_P_algorithm

Algorithm for dead pixel correction (‘spectral’ or ‘spatial’)

Default: “spatial”

--deadpix_P_interp_spectral

Spectral interpolation algorithm to be used during dead pixel correction (‘linear’, ‘quadratic’, ‘cubic’)

Default: “linear”

--deadpix_P_interp_spatial

Spatial interpolation algorithm to be used during dead pixel correction (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’)

Default: “linear”

--ortho_resampAlg

Ortho-rectification resampling algorithm (‘nearest’, ‘bilinear’, ‘gauss’, ‘cubic’, ‘cubic_spline’, ‘lanczos’, ‘average’, ‘mode’, ‘max’, ‘min’, ‘med’, ‘q1’, ‘q3’)

Default: “bilinear”

--vswir_overlap_algorithm

Algorithm specifying how to deal with the spectral bands in the VNIR/SWIR spectral overlap region (‘order_by_wvl’, ‘average’, ‘vnir_only’, ‘swir_only’)

Default: “swir_only”

-tgtprj, --target_projection_type

Projection type of the raster output files (‘UTM’, ‘Geographic’) (default: ‘UTM’)

Default: “UTM”

-tgtepsg, --target_epsg

Custom EPSG code of the target projection (overrides target_projection_type)

-tgtgrid, --target_coord_grid

Custom target coordinate grid where is output is resampled to ([x0, x1, y0, y1], e.g., [0, 30, 0, 30])

use ‘>>> enpt -h’ for detailed documentation and usage hints.


QGIS GUI

There is a separate graphical user interface (GUI) for EnPT than can be installed as an EnMAP-Box application in QGIS. To install it in QGIS, please refer to the separate repository enpt_enmapboxapp.

Here is screenshot of the current version:

img/screenshot_enpt_enmapboxapp_v0.6.0.png