Commit 29c305e6 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Implemented SICOR (not yet working).

parent 0572da24
Pipeline #2897 failed with stages
in 4 minutes and 32 seconds
......@@ -81,7 +81,7 @@ class EnPT_Controller(object):
def run_atmospheric_correction(self):
"""Run atmospheric correction only."""
pass
self.L1_obj.run_AC()
def write_output(self):
if self.cfg.output_dir:
......
......@@ -472,6 +472,11 @@ class EnMAPL1Product_SensorGeo(object):
if self.swir.detector_meta.unitcode != 'TOARad':
self.swir.DN2TOARadiance()
def run_AC(self):
from ..processors import AtmosphericCorrector
AC = AtmosphericCorrector(config=self.cfg)
AC.run_ac(self)
def save(self, outdir: str, suffix="") -> str:
"""Save this product to disk using almost the same format as for reading.
......
# -*- coding: utf-8 -*-
"""EnPT 'processors' module containing all EnPT processor sub-modules."""
from .radiometric_transform.radiometric_transform import Radiometric_Transformer
from .atmospheric_correction.atmospheric_correction import AtmosphericCorrector
__all__ = [
"Radiometric_Transformer",
"AtmosphericCorrector"
]
# -*- coding: utf-8 -*-
"""EnPT 'atmospheric correction module."""
from .atmospheric_correction import AtmosphericCorrector
__all__ = ['AtmosphericCorrector']
\ No newline at end of file
......@@ -3,3 +3,37 @@
Performs the atmospheric correction of EnMAP L1B data.
"""
from sicor.sicor_enmap import sicor_ac_enmap
from sicor.options import get_options as get_ac_options
from ...model.images import EnMAPL1Product_SensorGeo
from ...options.config import EnPTConfig
from ...utils.path_generator import get_path_ac_options
class AtmosphericCorrector(object):
"""Class for performing atmospheric correction of EnMAP L1 images using SICOR."""
def __init__(self, config: EnPTConfig=None):
"""Create an instance of AtmosphericCorrector."""
self.cfg = config
@property
def options(self):
path_opts = get_path_ac_options()
try:
return get_ac_options(path_opts)
except FileNotFoundError:
raise FileNotFoundError('Could not locate options file for atmospheric correction at %s.' % path_opts)
def run_ac(self, enmap_ImageL1: EnMAPL1Product_SensorGeo):
enmap_ImageL1.logger.info("Starting atmospheric correction for VNIR and SWIR detector. "
"Source radiometric unit code is '%s'." % enmap_ImageL1.meta.vnir.unitcode)
# run AC
enmap_l2a_sens_geo, state, fits = sicor_ac_enmap(enmap_l1b=enmap_ImageL1, options=self.options,
logger=enmap_ImageL1.logger, debug=True)
return enmap_l2a_sens_geo
# -*- coding: utf-8 -*-
"""EnPT 'radiometric transform' module containing eveything related to radiometric transformations."""
from .radiometric_transform import Radiometric_Transformer
__all__ = ['Radiometric_Transformer']
......@@ -48,3 +48,11 @@ class PathGenL1BProduct(object):
def _find_in_metaxml(self, expression):
return self.xml.findall(expression)[0].text.replace("\n", "").strip()
def get_path_ac_options() -> str:
"""Returns the path of the options json file needed for atmospheric correction."""
from sicor import options
path_ac = os.path.join(os.path.dirname(options.__file__), 'enmap_options.json')
return path_ac
......@@ -7,7 +7,7 @@ import tempfile
import zipfile
from datetime import datetime
from enpt.processors.radiometric_transform import Radiometric_Transformer
from enpt.processors import Radiometric_Transformer
from enpt.options.config import EnPTConfig
from . import config_for_testing
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment