Commit 366baa73 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

IC: Fix `generate_growing_constante_height` method.

No related merge requests found
Pipeline #56424 passed with stages
in 57 seconds
Showing with 35 additions and 36 deletions
+35 -36
......@@ -367,53 +367,52 @@ class InitialConditions(SQLSubModel):
key=lambda p: p.kp
)
def generate_growing_constante_height(self, height: float, compute_discharge: bool):
def generate_growing_constante_height(self, height: float,
compute_discharge: bool):
profiles = self._reach.reach.profiles.copy()
self._sort_by_z_and_kp(profiles)
previous_elevation = -99999.99
if compute_discharge:
incline = self._reach.reach.get_incline_median_mean()
logger.debug(f"incline = {incline}")
self._data = []
for profile in profiles:
width = profile.width_approximation()
strickler = 25
discharge = (
((width * 0.8)
* strickler
* (height ** (5/3))
* (abs(incline) ** (0.5)))
)
data_discharge = {}
if not compute_discharge:
for data in self._data:
data_discharge[data["kp"]] = data["discharge"]
elevation = max(
profile.z_min() + height,
previous_elevation
)
incline = self._reach.reach.get_incline_median_mean()
logger.debug(f"incline = {incline}")
self._data = []
for profile in profiles:
width = profile.width_approximation()
strickler = 25
logger.debug(f"({profile.kp}):")
logger.debug(f" width = {width}")
logger.debug(f" strickler = {strickler}")
logger.debug(f" discharge = {discharge}")
if not compute_discharge:
discharge = data_discharge[profile.kp]
else:
discharge = (
((width * 0.8)
* strickler
* (height ** (5/3))
* (abs(incline) ** (0.5)))
)
new = Data(reach=self._reach, status=self._status)
new["kp"] = profile.kp
new["discharge"] = discharge
elevation = max(
profile.z_min() + height,
previous_elevation
)
new["elevation"] = elevation
logger.debug(f"({profile.kp}):")
logger.debug(f" width = {width}")
logger.debug(f" strickler = {strickler}")
logger.debug(f" discharge = {discharge}")
self._data.append(new)
else:
for data, profile in zip(self._data, profiles):
new = Data(reach=self._reach, status=self._status)
new["kp"] = profile.kp
new["discharge"] = discharge
elevation = max(
profile.z_min() + height,
previous_elevation
)
data["elevation"] = elevation
previous_elevation = elevation
new["elevation"] = elevation
self._data.append(new)
self._generate_resort_data(profiles)
......
Supports Markdown
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