mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
load boundary conditions from file
This commit is contained in:
1 parent
7c4c772f43
commit
b582e133a1
6 files changed
+110
-16
No files matched your search
@@ -211,3 +211,23 @@ class TableModel(PamhyrTableModel):
|
||||
)
|
||||
self.layoutAboutToBeChanged.emit()
|
||||
self.update()
|
||||
|
||||
def read_from_file(self, file_name, bctype):
|
||||
|
||||
logger.debug(f"Import initial conditions from {file_name}")
|
||||
data0 = []
|
||||
data1 = []
|
||||
if bctype == "ZD":
|
||||
mult = 1
|
||||
else:
|
||||
mult = 60
|
||||
with open(file_name, encoding="utf-8") as ini_file:
|
||||
for line in ini_file:
|
||||
if not (line.startswith("#") or
|
||||
line.startswith("*") or
|
||||
line.startswith("$")):
|
||||
line = line.split()
|
||||
data0.append(float(line[0]) * mult)
|
||||
data1.append(line[1])
|
||||
|
||||
self.replace_data(data0, data1)
|
||||
Reference in new issue
Block a user