Commit 74b90b02 authored by Mathias Peters's avatar Mathias Peters
Browse files

Fixed bugs.

parent da02b2c1
......@@ -676,8 +676,8 @@ class AtmCorr(object):
# FIXME calculation of center wavelengths within SRF() used not the GMS algorithm
# SRF instance must be created for all bands and the previous proc level
GMS_identifier_fullScene = self.inObjs[0].GMS_identifier
GMS_identifier_fullScene['Subsystem'] = ''
GMS_identifier_fullScene['proc_level'] = proc_chain[proc_chain.index(self.inObjs[0].proc_level) - 1]
GMS_identifier_fullScene.subsystem = ''
GMS_identifier_fullScene.proc_level = proc_chain[proc_chain.index(self.inObjs[0].proc_level) - 1]
return SRF(GMS_identifier_fullScene, wvl_unit='nanometers', format_bandnames=True)
......
......@@ -312,7 +312,7 @@ def get_path_ac_options(GMS_id):
"""
GMSid_ac = GMS_id
GMSid_ac['Subsystem'] = ''
GMSid_ac.subsystem = ''
sensorcode = get_GMS_sensorcode(GMSid_ac)
ac_options_file_dic = {
......
......@@ -1755,11 +1755,7 @@ class GMS_object(object):
warnings.warn('Not properly closed logger at GMS_obj.logger pointing to %s.' % v.path_logfile)
dict2write[k] = 'not set'
elif isinstance(v, GMS_identifier):
if v.logger is not None and hasattr(v.logger, 'handlers') and v.logger.handlers[:]:
warnings.warn("Not properly closed logger at %s['logger'] pointing to %s."
% (k, dict2write[k]['logger'].path_logfile))
v.logger.close()
v.logger = 'not set'
dict2write[k] = v.to_odict(include_logger=False)
elif isinstance(v, collections.OrderedDict) or isinstance(v, dict):
dict2write[k] = dict2write[k].copy()
if 'logger' in v:
......@@ -2217,7 +2213,7 @@ class GMS_object(object):
del self.accuracy_layers
class GMS_identifier(OrderedDict):
class GMS_identifier(object):
def __init__(self, image_type, satellite, sensor, subsystem, proc_level, dataset_ID, logger=None):
# type: (str, str, str, str, str, int, logging.Logger) -> None
self.image_type = image_type
......@@ -2228,9 +2224,18 @@ class GMS_identifier(OrderedDict):
self.dataset_ID = dataset_ID
self.logger = logger
super().__init__(zip(
['image_type', 'Satellite', 'Sensor', 'Subsystem', 'proc_level', 'dataset_ID', 'logger'],
[image_type, satellite, sensor, subsystem, proc_level, dataset_ID, logger]))
# super().__init__(zip(
# ['image_type', 'Satellite', 'Sensor', 'Subsystem', 'proc_level', 'dataset_ID', 'logger'],
# [image_type, satellite, sensor, subsystem, proc_level, dataset_ID, logger]))
def to_odict(self, include_logger=True):
return OrderedDict(zip(
['image_type', 'Satellite', 'Sensor', 'Subsystem', 'proc_level', 'dataset_ID', 'logger'],
[self.image_type, self.satellite, self.sensor, self.subsystem, self.proc_level, self.dataset_ID,
self.logger]))
def __repr__(self):
return repr(self.to_odict())
def __getstate__(self):
"""Defines how the attributes of MetaObj instances are pickled."""
......
......@@ -1966,7 +1966,7 @@ def get_LayerBandsAssignment(GMS_id, nBands=None, sort_by_cwl=None, no_thermal=N
if GMS_id.proc_level in ['L2B', 'L2C']:
# handle different number of bands after spectral homogenization to target sensor
if GMS_id['dataset_ID'] == CFG.datasetid_spectral_ref:
if GMS_id.dataset_ID == CFG.datasetid_spectral_ref:
pass # return normal LBA from above
elif CFG.datasetid_spectral_ref is not None:
......@@ -1977,7 +1977,7 @@ def get_LayerBandsAssignment(GMS_id, nBands=None, sort_by_cwl=None, no_thermal=N
from ..model.gms_object import GMS_identifier
tgt_sat, tgt_sen = datasetid_to_sat_sen(CFG.datasetid_spectral_ref)
tgt_GMSid = GMS_identifier(image_type='RSD', satellite=tgt_sat, sensor=tgt_sen, subsystem='',
proc_level='L2A', dataset_ID='', logger=None)
proc_level='L2A', dataset_ID=None, logger=None)
try:
tgt_sen_LBA = get_bands_after_AC(tgt_GMSid)
......
Markdown is supported
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