Commit 055db05f authored by Niklas Bohn's avatar Niklas Bohn
Browse files

Merge branch 'bugfix/Issue#90' into 'master'

Bugfix/issue#90

See merge request !83
parents 9e139c09 06bc362e
......@@ -8,12 +8,12 @@ History
New features:
* 'make lint' now directly prints errors instead of only logging them to logfiles.
* Replaced deprecated gdal imports to fix
"DeprecationWarning: gdal.py was placed in a namespace, it is now available as osgeo.gdal".
Bugfixes:
* Pinned gdal to version<=3.1.2 to avoid import error.
* Fixed bug in empirical line function, which caused one single remaining unprocessed segmentation label.
* Replaced deprecated gdal imports to fix "DeprecationWarning: gdal.py was placed in a namespace, it is now available as osgeo.gdal".
* Updated cerberus schema for SicorValidator to avoid missing path warning in case of LUT file.
0.16.0 (2021-02-23)
......
......@@ -303,22 +303,3 @@ def interpol_lut_c(lut1, lut2, xnodes, nm_nodes, ndim, x_cell, vtest, intp_wvl):
f_int = np.sum(weights * lut_cell, axis=1)
return f_int
def download_LUT(path_LUT_default):
"""
Download LUT file from remote GIT repository.
:param path_LUT_default: directory where to store the LUT file
:return: directory of downloaded LUT file
"""
fname = "https://git.gfz-potsdam.de/EnMAP/sicor/-/raw/master/sicor/AC/data/EnMAP_LUT_MOD5_formatted_1nm"
urllib.request.urlretrieve(fname, path_LUT_default)
if os.path.isfile(path_LUT_default):
fn_table = path_LUT_default
else:
raise FileNotFoundError('Download of LUT file failed. Please download it manually from'
'https://git.gfz-potsdam.de/EnMAP/sicor and store it at /sicor/AC/data/'
'directory. Otherwise, the AC will not work.')
return fn_table
......@@ -2,7 +2,7 @@ import os
from os.path import dirname, isfile, splitext, join
import numpy as np
from osgeo import gdal
from gdalconst import GA_ReadOnly
from osgeo.gdalconst import GA_ReadOnly
import logging
import inspect
import sys
......
......@@ -46,12 +46,13 @@ def _processing_dict():
# noinspection PyClassHasNoInit
class SicorrValidator(Validator):
class SicorValidator(Validator):
def _validate_existing_path(self, existing_path, field, value):
""" Test whether a given sting points an existing path
"""
Test whether a string is provided for a given options dictionary key.
The rule's arguments are validated against this schema:
{'type': 'boolean'}
{'type': 'string'}
"""
if existing_path is True and path.isdir(value) is False:
warnings.warn("Path '%s' should exist." % value)
......@@ -113,7 +114,7 @@ def get_options(target, validation=True):
options["processing"] = _processing_dict()
if validation is True:
vv = SicorrValidator(allow_unknown=True, schema=sicor_enmap_schema)
vv = SicorValidator(allow_unknown=True, schema=sicor_enmap_schema)
if vv.validate(document=options) is False:
raise ValueError("Options is malformed: %s" % str(vv.errors))
......
......@@ -35,8 +35,7 @@ sicor_enmap_schema = {
},
"fn_LUT": {
"type": "string",
"required": True,
"existing_path": True
"required": True
},
"cpu": {
"type": "integer",
......
......@@ -12,16 +12,15 @@ from time import time
from uuid import uuid1
from xml.etree.ElementTree import QName
import xml.etree.ElementTree
from osgeo import gdal
from osgeo import gdal, osr
import glymur
import iso8601
import matplotlib.pyplot as plt
import numpy as np
import osr
import pandas as pd
import pyproj
from PIL import Image
from gdalconst import GA_ReadOnly
from osgeo.gdalconst import GA_ReadOnly
from geoarray import GeoArray
from psutil import virtual_memory
......
......@@ -57,7 +57,7 @@ class LessThanFilter(logging.Filter):
self.max_level = exclusive_maximum
def filter(self, record):
"""Filter funtion.
"""Filter function.
NOTE: Returns True if logging level of the given record is below the maximum log level.
......
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