mirror of https://gitlab.com/pamhyr/pamhyr2
IC: Fix `generate_growing_constante_height` method.
parent
453a2084e7
commit
366baa737a
|
|
@ -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
|
||||
data_discharge = {}
|
||||
if not compute_discharge:
|
||||
for data in self._data:
|
||||
data_discharge[data["kp"]] = data["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
|
||||
|
||||
if not compute_discharge:
|
||||
discharge = data_discharge[profile.kp]
|
||||
else:
|
||||
discharge = (
|
||||
((width * 0.8)
|
||||
* strickler
|
||||
* (height ** (5/3))
|
||||
* (abs(incline) ** (0.5)))
|
||||
)
|
||||
((width * 0.8)
|
||||
* strickler
|
||||
* (height ** (5/3))
|
||||
* (abs(incline) ** (0.5)))
|
||||
)
|
||||
|
||||
elevation = max(
|
||||
profile.z_min() + height,
|
||||
previous_elevation
|
||||
)
|
||||
elevation = max(
|
||||
profile.z_min() + height,
|
||||
previous_elevation
|
||||
)
|
||||
|
||||
logger.debug(f"({profile.kp}):")
|
||||
logger.debug(f" width = {width}")
|
||||
logger.debug(f" strickler = {strickler}")
|
||||
logger.debug(f" discharge = {discharge}")
|
||||
logger.debug(f"({profile.kp}):")
|
||||
logger.debug(f" width = {width}")
|
||||
logger.debug(f" strickler = {strickler}")
|
||||
logger.debug(f" discharge = {discharge}")
|
||||
|
||||
new = Data(reach=self._reach, status=self._status)
|
||||
new["kp"] = profile.kp
|
||||
new["discharge"] = discharge
|
||||
new = Data(reach=self._reach, status=self._status)
|
||||
new["kp"] = profile.kp
|
||||
new["discharge"] = discharge
|
||||
|
||||
new["elevation"] = elevation
|
||||
new["elevation"] = elevation
|
||||
|
||||
self._data.append(new)
|
||||
else:
|
||||
for data, profile in zip(self._data, profiles):
|
||||
|
||||
elevation = max(
|
||||
profile.z_min() + height,
|
||||
previous_elevation
|
||||
)
|
||||
data["elevation"] = elevation
|
||||
previous_elevation = elevation
|
||||
self._data.append(new)
|
||||
|
||||
self._generate_resort_data(profiles)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue