mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "645a76b0e8e3f565b8fe7f5fced7970d9d23cc41" and "6b14ed7efe2c7dd779ea0fe8191d2649390abdca" have entirely different histories.
645a76b0e8
...
6b14ed7efe
|
|
@ -503,16 +503,10 @@ class BoundaryCondition(SQLSubModel):
|
|||
new_0 = self._types[0](data[0].replace(",", "."))
|
||||
new_1 = self._types[1](data[1].replace(",", "."))
|
||||
|
||||
return Data(
|
||||
new_0, new_1,
|
||||
status=self._status
|
||||
)
|
||||
return Data(new_0, new_1)
|
||||
|
||||
def add(self, index: int):
|
||||
value = Data(
|
||||
self._default_0, self._default_1,
|
||||
status=self._status
|
||||
)
|
||||
value = Data(self._default_0, self._default_1)
|
||||
self._data.insert(index, value)
|
||||
self.modified()
|
||||
return value
|
||||
|
|
|
|||
|
|
@ -462,10 +462,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
"name": point[3],
|
||||
}
|
||||
|
||||
pt = PointXYZ(
|
||||
id=-1, **named_args, profile=self,
|
||||
status=self._status
|
||||
)
|
||||
pt = PointXYZ(id=-1, **named_args, profile=self, status=self._status)
|
||||
self._points.append(pt)
|
||||
|
||||
self.modified()
|
||||
|
|
@ -527,10 +524,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
point_xyz = PointXYZ(
|
||||
x=0., y=0., z=0., profile=self,
|
||||
status=self._status
|
||||
)
|
||||
point_xyz = PointXYZ(x=0., y=0., z=0., profile=self, status=self._status)
|
||||
self.points.append(point_xyz)
|
||||
|
||||
self.modified()
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Graph(SQLSubModel):
|
|||
def _enable_edges(self):
|
||||
"""Return a generator"""
|
||||
return filter(
|
||||
lambda e: e.is_enable() and not e.is_deleted(),
|
||||
lambda e: e.is_enable(),
|
||||
self.edges()
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -250,12 +250,7 @@ class Mage(CommandLineSolver):
|
|||
|
||||
# Generate sediment additional data if available
|
||||
sediment = ""
|
||||
if profile.sl is None:
|
||||
return
|
||||
|
||||
if profile.sl.is_deleted():
|
||||
return
|
||||
|
||||
if profile.sl is not None:
|
||||
if not any(filter(lambda f: ".GRA" in f, files)):
|
||||
files.append(self._gra_file)
|
||||
|
||||
|
|
@ -283,12 +278,7 @@ class Mage(CommandLineSolver):
|
|||
# Generate sediment additional data if available
|
||||
sediment = ""
|
||||
prev = point.z
|
||||
if point.sl is None:
|
||||
return
|
||||
|
||||
if point.sl.is_deleted():
|
||||
return
|
||||
|
||||
if point.sl is not None:
|
||||
# Number of layers
|
||||
nl = len(point.sl)
|
||||
sediment = f"{nl:>3}"
|
||||
|
|
@ -321,9 +311,6 @@ class Mage(CommandLineSolver):
|
|||
if bound.node is None:
|
||||
continue
|
||||
|
||||
if bound.is_deleted():
|
||||
continue
|
||||
|
||||
name = self.get_node_name(bound.node)
|
||||
f.write(f"* {bound.node.name} ({name}) {bound.bctype}\n")
|
||||
f.write(f"${name}\n")
|
||||
|
|
@ -396,9 +383,6 @@ class Mage(CommandLineSolver):
|
|||
if lateral.edge is None:
|
||||
return
|
||||
|
||||
if lateral.is_deleted():
|
||||
return
|
||||
|
||||
edges = study.river.enable_edges()
|
||||
if lateral.edge not in edges:
|
||||
return
|
||||
|
|
@ -421,9 +405,6 @@ class Mage(CommandLineSolver):
|
|||
f.write(f"*{header[0]:>9}|{header[1]:>10}\n")
|
||||
|
||||
for d in lateral.data:
|
||||
if d.is_deleted():
|
||||
continue
|
||||
|
||||
if lateral.lctype in ["EV"]:
|
||||
f.write(f"{d[0]:10.3f}{-d[1]:10.3f}\n")
|
||||
else:
|
||||
|
|
@ -449,9 +430,6 @@ class Mage(CommandLineSolver):
|
|||
if friction.begin_strickler is None:
|
||||
continue
|
||||
|
||||
if friction.is_deleted():
|
||||
continue
|
||||
|
||||
num = f"{id:>3}"
|
||||
brk = f"{friction.begin_rk:>10.3f}"
|
||||
erk = f"{friction.end_rk:>10.3f}"
|
||||
|
|
@ -488,9 +466,6 @@ class Mage(CommandLineSolver):
|
|||
id = 1
|
||||
for reach in reachs:
|
||||
cond = study.river.initial_conditions.get(reach)
|
||||
if cond.is_deleted():
|
||||
continue
|
||||
|
||||
data = cond.data
|
||||
if len(data) == 0:
|
||||
continue
|
||||
|
|
@ -499,9 +474,6 @@ class Mage(CommandLineSolver):
|
|||
|
||||
id_sec = 1
|
||||
for d in data:
|
||||
if d.is_deleted():
|
||||
continue
|
||||
|
||||
IR = f"{id}"
|
||||
IS = f"{id_sec}"
|
||||
discharge = f"{d['discharge']:>10.5f}"
|
||||
|
|
@ -518,7 +490,6 @@ class Mage(CommandLineSolver):
|
|||
|
||||
if has_ini:
|
||||
files.append(f"{name}.INI")
|
||||
|
||||
return files
|
||||
|
||||
def _export_CAS(self, study, repertory, qlog, name="0"):
|
||||
|
|
@ -535,7 +506,7 @@ class Mage(CommandLineSolver):
|
|||
files.append(f"{name}.CAS")
|
||||
|
||||
for reservoir in reservoirs:
|
||||
if reservoir.node is None or reservoir.is_deleted():
|
||||
if reservoir.node is None:
|
||||
continue
|
||||
|
||||
reservoir.sort()
|
||||
|
|
@ -590,9 +561,6 @@ class Mage(CommandLineSolver):
|
|||
if hs.input_section is None:
|
||||
continue
|
||||
|
||||
if hs.is_deleted():
|
||||
continue
|
||||
|
||||
f.write(
|
||||
'* ouvrage au pk ' +
|
||||
f"{float(hs.input_section.rk):>12.1f}" + ' ' +
|
||||
|
|
@ -605,12 +573,7 @@ class Mage(CommandLineSolver):
|
|||
|
||||
def _export_SIN_bhs(self, study, sin_dict, hs, f):
|
||||
for bhs in hs.basic_structures:
|
||||
if not bhs.enabled:
|
||||
continue
|
||||
|
||||
if bhs.is_deleted():
|
||||
continue
|
||||
|
||||
if bhs.enabled:
|
||||
reach_id = study.river.get_edge_id(hs.input_reach) + 1
|
||||
param_str = ' '.join(
|
||||
[
|
||||
|
|
@ -704,15 +667,12 @@ class Mage(CommandLineSolver):
|
|||
if hs.input_reach is None:
|
||||
continue
|
||||
|
||||
if not hs.input_reach.is_enable() or hs.input_reach.is_deleted():
|
||||
if not hs.input_reach.is_enable():
|
||||
continue
|
||||
|
||||
if not hs.enabled:
|
||||
continue
|
||||
|
||||
if hs.is_deleted():
|
||||
continue
|
||||
|
||||
for bhs in hs.basic_structures:
|
||||
if bhs.enabled:
|
||||
logger.info(bhs._type)
|
||||
|
|
|
|||
Loading…
Reference in New Issue