mirror of https://gitlab.com/pamhyr/pamhyr2
Import INI files: tolerate rounded RK values from INI files
parent
3458a5df9f
commit
707577521f
|
|
@ -440,7 +440,6 @@ class InitialConditions(SQLSubModel):
|
||||||
|
|
||||||
def new_from_data(self, rk, discharge, elevation):
|
def new_from_data(self, rk, discharge, elevation):
|
||||||
n = Data(reach=self._reach, status=self._status)
|
n = Data(reach=self._reach, status=self._status)
|
||||||
|
|
||||||
# Values read from Mage INI files are strings, whereas profile RK
|
# Values read from Mage INI files are strings, whereas profile RK
|
||||||
# values are stored as floats. Normalize the imported value before
|
# values are stored as floats. Normalize the imported value before
|
||||||
# looking up its associated profile.
|
# looking up its associated profile.
|
||||||
|
|
@ -448,7 +447,9 @@ class InitialConditions(SQLSubModel):
|
||||||
|
|
||||||
section = reduce(
|
section = reduce(
|
||||||
lambda acc, s: (
|
lambda acc, s: (
|
||||||
s if isclose(s.rk, rk, rel_tol=1e-9, abs_tol=1e-9)
|
# Mage INI files store RK values with two decimal places.
|
||||||
|
# Allow for the rounding introduced by that format.
|
||||||
|
s if isclose(s.rk, rk, rel_tol=0.0, abs_tol=0.0051)
|
||||||
else acc
|
else acc
|
||||||
),
|
),
|
||||||
self._reach.reach.profiles,
|
self._reach.reach.profiles,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue