Fixed validation error. Added support of rescaling metadata

pull/1063/head
teslov 2021-10-05 11:37:26 +03:00
rodzic e5f0ec9710
commit 3dcc7045bf
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -123,16 +123,16 @@ class Metadata(TaskNestedView):
if formula == '': formula = None
if bands == '': bands = None
if defined_range == '': defined_range = None
try:
expr, hrange = lookup_formula(formula, bands)
new_range = tuple(map(float, defined_range.split(",")[:2]))
if defined_range is not None:
new_range = tuple(map(float, defined_range.split(",")[:2]))
#Validate rescaling range
if new_range[0] < hrange[0] or new_range[1] > hrange[1]:
if hrange is not None and (new_range[0] < hrange[0] or new_range[1] > hrange[1]):
pass
else:
hrange = new_range
except ValueError as e:
raise exceptions.ValidationError(str(e))
pmin, pmax = 2.0, 98.0