mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
SL: Apply new PamhyrPlot features.
This commit is contained in:
1 parent
d1d63c8c29
commit
9302d1fabc
9 files changed
+106
-132
No files matched your search
@@ -16,6 +16,8 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from functools import reduce
|
||||
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
@@ -362,3 +364,29 @@ class SedimentLayer(SQLSubModel):
|
||||
lst[index], lst[prev] = lst[prev], lst[index]
|
||||
|
||||
self._status.modified()
|
||||
|
||||
def compute_height_from_bottom(self, bottom_elevation: list):
|
||||
sl_height = self.height()
|
||||
|
||||
sl_height_by_profile = []
|
||||
for i in range(len(sl_height)):
|
||||
cur_profile = []
|
||||
for _ in bottom_elevation:
|
||||
cur_profile.append(sl_height[i])
|
||||
|
||||
sl_height_by_profile.append(cur_profile)
|
||||
|
||||
z_sl = reduce(
|
||||
lambda acc, current_sl: acc + [
|
||||
list(
|
||||
map(
|
||||
lambda cur_sl_h, prev_sl_h: prev_sl_h - cur_sl_h,
|
||||
current_sl, acc[-1]
|
||||
)
|
||||
)
|
||||
],
|
||||
sl_height_by_profile,
|
||||
[bottom_elevation]
|
||||
)
|
||||
|
||||
return z_sl
|
||||
Reference in new issue
Block a user