Commit 4ba8eb8e authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Removed deprecated code, added documentation.

parent 3a26d7c4
Pipeline #2963 passed with stages
in 17 minutes and 4 seconds
...@@ -389,7 +389,14 @@ def pickle_SRF_DB(L1A_Instances, dir_out): ...@@ -389,7 +389,14 @@ def pickle_SRF_DB(L1A_Instances, dir_out):
def Solar_Irradiance_reader(resol_nm=None, wvl_min_nm=None, wvl_max_nm=None): def Solar_Irradiance_reader(resol_nm=None, wvl_min_nm=None, wvl_max_nm=None):
sol_irr = np.loadtxt(CFG.path_solar_irr, skiprows=1) # col0 = Wavelength[nm]; col1 = Solar Irradiance [W/m2/µm] """Read the solar irradiance file and return an array of irradiances.
:param resol_nm: spectral resolution for returned irradiances [nanometers]
:param wvl_min_nm: minimum wavelength of returned irradiances [nanometers]
:param wvl_max_nm: maximum wavelength of returned irradiances [nanometers]
:return:
"""
sol_irr = np.loadtxt(CFG.path_solar_irr, skiprows=1)
if resol_nm is not None and isinstance(resol_nm, (float, int)): if resol_nm is not None and isinstance(resol_nm, (float, int)):
wvl_min = (np.min(sol_irr[:, 0]) if wvl_min_nm is None else wvl_min_nm) wvl_min = (np.min(sol_irr[:, 0]) if wvl_min_nm is None else wvl_min_nm)
wvl_max = (np.max(sol_irr[:, 0]) if wvl_max_nm is None else wvl_max_nm) wvl_max = (np.max(sol_irr[:, 0]) if wvl_max_nm is None else wvl_max_nm)
......
...@@ -110,24 +110,6 @@ class GMS_logger(logging.Logger): ...@@ -110,24 +110,6 @@ class GMS_logger(logging.Logger):
self.addHandler(consoleHandler_out) self.addHandler(consoleHandler_out)
self.addHandler(consoleHandler_err) self.addHandler(consoleHandler_err)
# if append:
# logfileHandler = logging.FileHandler(path_logfile, mode='a')
# else:
# logfileHandler = logging.FileHandler(path_logfile, mode='w')
# logfileHandler.setFormatter(formatter)
# logfileHandler.setLevel(logging.CRITICAL)
# consoleHandler_out = logging.StreamHandler()
# consoleHandler_out.setFormatter(formatter)
# consoleHandler_out.setLevel(logging.CRITICAL)
# # logger.setLevel(logging.DEBUG)
# if CPUs == 1:
# if not logger.handlers:
# logger.addHandler(logfileHandler)
# logger.addHandler(consoleHandler_out)
# else:
# logger.addHandler(logfileHandler)
# logger.addHandler(consoleHandler_out)
def __getstate__(self): def __getstate__(self):
self.close() self.close()
return self.__dict__ return self.__dict__
...@@ -212,11 +194,27 @@ def shutdown_loggers(): ...@@ -212,11 +194,27 @@ def shutdown_loggers():
class LessThanFilter(logging.Filter): class LessThanFilter(logging.Filter):
# http://stackoverflow.com/questions/2302315/how-can-info-and-debug-logging-message-be-sent-to-stdout-and-higher-level-messag """Filter class to filter log messages by a maximum log level.
Based on http://stackoverflow.com/questions/2302315/
how-can-info-and-debug-logging-message-be-sent-to-stdout-and-higher-level-messag
"""
def __init__(self, exclusive_maximum, name=""): def __init__(self, exclusive_maximum, name=""):
"""Get an instance of LessThanFilter.
:param exclusive_maximum: maximum log level, e.g., logger.WARNING
:param name:
"""
super(LessThanFilter, self).__init__(name) super(LessThanFilter, self).__init__(name)
self.max_level = exclusive_maximum self.max_level = exclusive_maximum
def filter(self, record): def filter(self, record):
"""Filter funtion.
NOTE: Returns True if logging level of the given record is below the maximum log level.
:param record:
:return: bool
"""
# non-zero return means we log this message # non-zero return means we log this message
return True if record.levelno < self.max_level else False return True if record.levelno < self.max_level else False
...@@ -23,7 +23,7 @@ requirements = [ ...@@ -23,7 +23,7 @@ requirements = [
# spectral<0.16 has some problems with writing signed integer 8bit data # spectral<0.16 has some problems with writing signed integer 8bit data
# fmask # conda install -c conda-forge python-fmask # fmask # conda install -c conda-forge python-fmask
# 'pyhdf', # conda install --yes -c conda-forge pyhdf # 'pyhdf', # conda install --yes -c conda-forge pyhdf
# 'sicor', # pip install git+https://gitext.gfz-potsdam.de/hollstei/sicor.git # 'sicor', # pip install git+https://gitext.gfz-potsdam.de/EnMAP/sicor.git
] ]
setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here
test_requirements = requirements + ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose'] test_requirements = requirements + ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose']
......
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