Skip to content
Snippets Groups Projects
Commit e09fb6db authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added/revised parameters related to AC mode and ACwater.

parent 0ad0686b
No related branches found
No related tags found
1 merge request!15Added/revised parameters related to AC mode and ACwater.
Pipeline #24466 failed
......@@ -27,6 +27,7 @@
import os
from os.path import expanduser
import psutil
from pkgutil import get_loader
from datetime import date
from multiprocessing import cpu_count
from threading import Thread
......@@ -70,6 +71,11 @@ class _EnPTBaseAlgorithm(QgsProcessingAlgorithm):
P_enable_vnir_swir_coreg = 'enable_vnir_swir_coreg'
P_path_reference_image = 'path_reference_image'
P_enable_ac = 'enable_ac'
P_mode_ac = 'mode_ac'
P_polymer_root = 'polymer_root'
P_threads = 'threads'
P_blocksize = 'blocksize'
P_auto_download_ecmwf = 'auto_download_ecmwf'
P_scale_factor_boa_ref = 'scale_factor_boa_ref'
P_run_smile_P = 'run_smile_P'
P_run_deadpix_P = 'run_deadpix_P'
......@@ -102,6 +108,15 @@ class _EnPTBaseAlgorithm(QgsProcessingAlgorithm):
def createInstance(self, *args, **kwargs):
return type(self)()
@staticmethod
def _get_default_polymer_root():
try:
path_polymer = os.path.abspath(
os.path.join(os.path.dirname(get_loader("polymer").path), os.pardir))
except:
path_polymer = ''
return path_polymer
@staticmethod
def _get_default_output_dir():
userhomedir = expanduser('~')
......@@ -280,12 +295,56 @@ class _EnPTBaseAlgorithm(QgsProcessingAlgorithm):
description='Enable atmospheric correction using SICOR algorithm',
defaultValue=True))
self.addParameter(QgsProcessingParameterNumber(
self.addParameter(
QgsProcessingParameterEnum(
name=self.P_mode_ac,
description="Atmospheric correction mode",
options=['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 not 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*/'],
defaultValue=2),
advanced=True)
self.addParameter(
QgsProcessingParameterFile(
name=self.P_polymer_root,
description='Polymer root directory (that contains the subdirectory for ancillary data)',
behavior=QgsProcessingParameterFile.Folder,
defaultValue=self._get_default_polymer_root()),
advanced=True)
self.addParameter(
QgsProcessingParameterNumber(
name=self.P_threads,
description='Number of threads for multiprocessing'
"('0: no threads', '-1: automatic', '>0: number of threads')",
type=QgsProcessingParameterNumber.Integer,
defaultValue=-1),
advanced=True)
self.addParameter(
QgsProcessingParameterNumber(
name=self.P_blocksize,
description='Block size for multiprocessing',
type=QgsProcessingParameterNumber.Integer,
defaultValue=100),
advanced=True)
self.addParameter(
QgsProcessingParameterBoolean(
name=self.P_auto_download_ecmwf,
description='Automatically download ECMWF data for atmospheric correction',
defaultValue=False),
advanced=True)
self.addParameter(
QgsProcessingParameterNumber(
name=self.P_scale_factor_boa_ref,
description='Scale factor to be applied to BOA reflectance result',
type=QgsProcessingParameterNumber.Integer,
defaultValue=10000,
optional=True),
defaultValue=10000),
advanced=True)
self.addParameter(
......
......@@ -78,6 +78,7 @@ class EnPTAlgorithm(_EnPTBaseAlgorithm):
# replace Enum parameters with corresponding strings
for n, opts in [
('output_format', {0: 'GTiff', 1: 'ENVI'}),
('mode_ac', {0: 'land', 1: 'water', 2: 'combined'}),
('deadpix_P_algorithm', {0: 'spectral', 1: 'spatial'}),
('deadpix_P_interp_spectral', {0: 'linear', 1: 'bilinear', 2: 'cubic', 3: 'spline'}),
('deadpix_P_interp_spatial', {0: 'linear', 1: 'bilinear', 2: 'cubic', 3: 'spline'}),
......
......@@ -173,6 +173,7 @@ class ExternalEnPTAlgorithm(_EnPTBaseAlgorithm):
# replace Enum parameters with corresponding strings
for n, opts in [
('output_format', {0: 'GTiff', 1: 'ENVI'}),
('mode_ac', {0: 'land', 1: 'water', 2: 'combined'}),
('deadpix_P_algorithm', {0: 'spectral', 1: 'spatial'}),
('deadpix_P_interp_spectral', {0: 'linear', 1: 'bilinear', 2: 'cubic', 3: 'spline'}),
('deadpix_P_interp_spatial', {0: 'linear', 1: 'bilinear', 2: 'cubic', 3: 'spline'}),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment