enpt_enmapboxapp package

Submodules

enpt_enmapboxapp._enpt_alg_base module

This module provides the base class for EnPTAlgorithm and ExternalEnPTAlgorithm.

class enpt_enmapboxapp._enpt_alg_base._EnPTBaseAlgorithm[source]

Bases: QgsProcessingAlgorithm

P_CPUs = 'CPUs'
P_OUTPUT_FOLDER = 'outfolder'
P_OUTPUT_RASTER = 'outraster'
P_auto_download_ecmwf = 'auto_download_ecmwf'
P_average_elevation = 'average_elevation'
P_blocksize = 'blocksize'
P_deadpix_P_algorithm = 'deadpix_P_algorithm'
P_deadpix_P_interp_spatial = 'deadpix_P_interp_spatial'
P_deadpix_P_interp_spectral = 'deadpix_P_interp_spectral'
P_disable_progress_bars = 'disable_progress_bars'
P_drop_bad_bands = 'drop_bad_bands'
P_enable_ac = 'enable_ac'
P_enable_keystone_correction = 'enable_keystone_correction'
P_enable_vnir_swir_coreg = 'enable_vnir_swir_coreg'
P_json_config = 'json_config'
P_mode_ac = 'mode_ac'
P_n_lines_to_append = 'n_lines_to_append'
P_ortho_resampAlg = 'ortho_resampAlg'
P_output_dir = 'output_dir'
P_output_format = 'output_format'
P_output_interleave = 'output_interleave'
P_output_nodata_value = 'output_nodata_value'
P_path_dem = 'path_dem'
P_path_earthSunDist = 'path_earthSunDist'
P_path_l1b_enmap_image = 'path_l1b_enmap_image'
P_path_l1b_enmap_image_gapfill = 'path_l1b_enmap_image_gapfill'
P_path_reference_image = 'path_reference_image'
P_path_solar_irr = 'path_solar_irr'
P_polymer_additional_results = 'polymer_additional_results'
P_polymer_root = 'polymer_root'
P_run_deadpix_P = 'run_deadpix_P'
P_run_smile_P = 'run_smile_P'
P_scale_factor_boa_ref = 'scale_factor_boa_ref'
P_scale_factor_toa_ref = 'scale_factor_toa_ref'
P_target_epsg = 'target_epsg'
P_target_projection_type = 'target_projection_type'
P_threads = 'threads'
P_vswir_overlap_algorithm = 'vswir_overlap_algorithm'
P_working_dir = 'working_dir'
static _get_default_output_dir()[source]
static _get_default_polymer_root()[source]
static _get_preprocessed_parameters(parameters)[source]
_handle_results(parameters: dict, feedback, exitcode: int) dict[source]
static _run_cmd(cmd, qgis_feedback=None, **kwargs)[source]

Execute external command and get its stdout, exitcode and stderr.

Code based on: https://stackoverflow.com/a/31867499

Parameters:

cmd – a normal shell command including parameters

addParameter(param, *args, advanced=False, **kwargs)[source]

Add a parameter to the QgsProcessingAlgorithm.

This overrides the parent method to make it accept an ‘advanced’ parameter.

Parameters:
  • param – the parameter to be added

  • args – arguments to be passed to the parent method

  • advanced – whether the parameter should be flagged as ‘advanced’

  • kwargs – keyword arguments to be passed to the parent method

createInstance(self) QgsProcessingAlgorithm | None[source]

Creates a new instance of the algorithm class.

This method should return a ‘pristine’ instance of the algorithm class.

displayName(self) str[source]

Returns the translated algorithm name, which should be used for any user-visible display of the algorithm name.

Algorithm display names should be short, e.g. ideally no more than 3 or 4 words. The name should use sentence case (e.g. “Raster layer statistics”, not “Raster Layer Statistics”).

See also

name()

See also

shortDescription()

group(self) str[source]

Returns the name of the group this algorithm belongs to. This string should be localised.

See also

groupId()

See also

tags()

groupId(self) str[source]

Returns the unique ID of the group this algorithm belongs to. This string should be fixed for the algorithm, and must not be localised. The group id should be unique within each provider. Group id should contain lowercase alphanumeric characters only and no spaces or other formatting characters.

See also

group()

helpString(self) str[source]

Returns a localised help string for the algorithm. Algorithm subclasses should implement either helpString() or helpUrl().

See also

helpUrl()

Deprecated since version Unused,: will be removed in QGIS 4.0

static helpUrl(self) str[source]

Returns a url pointing to the algorithm’s help page.

See also

helpString()

initAlgorithm(self, configuration: Dict[str, Any] = {})[source]

Initializes the algorithm using the specified configuration.

This should be called directly after creating algorithms and before retrieving any parameterDefinitions() or outputDefinitions().

Subclasses should use their implementations to add all required input parameter and output definitions (which can be dynamically adjusted according to configuration).

Dynamic configuration can be used by algorithms which alter their behavior when used inside processing models. For instance, a “feature router” type algorithm which sends input features to one of any number of outputs sinks based on some preconfigured filter parameters can use the init method to create these outputs based on the specified configuration.

See also

addParameter()

See also

addOutput()

name(self) str[source]

Returns the algorithm name, used for identifying the algorithm. This string should be fixed for the algorithm, and must not be localised. The name should be unique within each provider. Names should contain lowercase alphanumeric characters only and no spaces or other formatting characters.

See also

displayName()

See also

group()

See also

tags()

static shortHelpString(*args, **kwargs)[source]

Display help string.

Example: ‘<p>Here comes the HTML documentation.</p>’ ‘<h3>With Headers…</h3>’ ‘<p>and Hyperlinks: <a href=”www.google.de”>Google</a></p>’

Parameters:
  • args

  • kwargs

enpt_enmapboxapp.enpt_algorithm module

This module provides the EnPTAlgorithm which is used in case EnPT is installed into QGIS Python environment.

class enpt_enmapboxapp.enpt_algorithm.EnPTAlgorithm[source]

Bases: _EnPTBaseAlgorithm

static _prepare_enpt_environment() dict[source]
processAlgorithm(self, parameters: Dict[str, Any], context: QgsProcessingContext, feedback: QgsProcessingFeedback | None) Dict[str, Any][source]

Runs the algorithm using the specified parameters. Algorithms should implement their custom processing logic here.

The context argument gives a temporary context with thread affinity matching the thread in which the algorithm is being run. This is a cut-back copy of the context passed to the prepareAlgorithm() and postProcessAlgorithm() steps, but it is generally safe for most algorithms to utilize this context for loading layers and creating sinks. Any loaded layers or sinks created within this temporary context will be transferred back to the main execution context upon successful completion of the processAlgorithm() step.

Algorithm progress should be reported using the supplied feedback object. Additionally, well-behaved algorithms should periodically check feedback to determine whether the algorithm should be canceled and exited early.

This method will not be called if the prepareAlgorithm() step failed (returned False).

Implementations of processAlgorithm can throw the QgsProcessingException exception to indicate that a fatal error occurred within the execution.

Returns:

A map of algorithm outputs. These may be output layer references, or calculated values such as statistical calculations. Unless the algorithm subclass overrides the postProcessAlgorithm() step this returned map will be used as the output for the algorithm.

See also

prepareAlgorithm()

See also

postProcessAlgorithm()

enpt_enmapboxapp.enpt_enmapboxapp module

This module provides a QGIS EnMAPBox GUI for the EnMAP processing tools (EnPT).

class enpt_enmapboxapp.enpt_enmapboxapp.EnPTEnMAPBoxApp(enmapBox, parent=None)[source]

Bases: EnMAPBoxApplication

The EnPT GUI class.

icon()[source]

Return the QIcon of EnPTEnMAPBoxApp.

Returns:

QIcon()

static is_enpt_internally_installed()[source]
menu(appMenu)[source]

Return a QMenu that will be added to the parent appMenu.

Parameters:

appMenu

Returns:

QMenu

processingAlgorithms()[source]

Return the QGIS Processing Framework GeoAlgorithms specified by your application.

Returns:

[list-of-GeoAlgorithms]

showAboutDialog()[source]
startGUI()[source]

Open the GUI.

enpt_enmapboxapp.enpt_external_algorithm module

This module provides the ExternalEnPTAlgorithm which is used in case EnPT is installed into separate environment.

class enpt_enmapboxapp.enpt_external_algorithm.ExternalEnPTAlgorithm[source]

Bases: _EnPTBaseAlgorithm

P_conda_root = 'conda_root'
static _get_default_conda_root()[source]
static _is_enpt_environment_present(conda_rootdir)[source]
static _locate_EnPT_Conda_environment(user_root)[source]
static _locate_enpt_run_script(conda_rootdir=None)[source]
static _prepare_enpt_environment() dict[source]
initAlgorithm(self, configuration: Dict[str, Any] = {})[source]

Initializes the algorithm using the specified configuration.

This should be called directly after creating algorithms and before retrieving any parameterDefinitions() or outputDefinitions().

Subclasses should use their implementations to add all required input parameter and output definitions (which can be dynamically adjusted according to configuration).

Dynamic configuration can be used by algorithms which alter their behavior when used inside processing models. For instance, a “feature router” type algorithm which sends input features to one of any number of outputs sinks based on some preconfigured filter parameters can use the init method to create these outputs based on the specified configuration.

See also

addParameter()

See also

addOutput()

processAlgorithm(self, parameters: Dict[str, Any], context: QgsProcessingContext, feedback: QgsProcessingFeedback | None) Dict[str, Any][source]

Runs the algorithm using the specified parameters. Algorithms should implement their custom processing logic here.

The context argument gives a temporary context with thread affinity matching the thread in which the algorithm is being run. This is a cut-back copy of the context passed to the prepareAlgorithm() and postProcessAlgorithm() steps, but it is generally safe for most algorithms to utilize this context for loading layers and creating sinks. Any loaded layers or sinks created within this temporary context will be transferred back to the main execution context upon successful completion of the processAlgorithm() step.

Algorithm progress should be reported using the supplied feedback object. Additionally, well-behaved algorithms should periodically check feedback to determine whether the algorithm should be canceled and exited early.

This method will not be called if the prepareAlgorithm() step failed (returned False).

Implementations of processAlgorithm can throw the QgsProcessingException exception to indicate that a fatal error occurred within the execution.

Returns:

A map of algorithm outputs. These may be output layer references, or calculated values such as statistical calculations. Unless the algorithm subclass overrides the postProcessAlgorithm() step this returned map will be used as the output for the algorithm.

See also

prepareAlgorithm()

See also

postProcessAlgorithm()

enpt_enmapboxapp.version module

enpt_enmapboxapp.version.check_minimal_enpt_version(enpt_version: str)[source]

Module contents

Top-level package for enpt_enmapboxapp.