Compare commits

..

No commits in common. "3e92a0c40dd212ea79fbe3114e6095d6cc45871f" and "012408d19e41852e0d718fb086b7e9e27590c439" have entirely different histories.

4 changed files with 10 additions and 34 deletions

View File

@ -537,10 +537,7 @@ class InitialConditions(SQLSubModel):
strickler = 25.0 strickler = 25.0
if not compute_discharge: if not compute_discharge:
if profile.rk in data_discharge: discharge = data_discharge[profile.rk]
discharge = data_discharge[profile.rk]
else:
discharge = 0.0
else: else:
discharge = ( discharge = (
# ((width * 0.8) # ((width * 0.8)
@ -608,10 +605,7 @@ class InitialConditions(SQLSubModel):
strickler = 25.0 strickler = 25.0
if not compute_height: if not compute_height:
if profile.rk in data_height: height = data_height[profile.rk]
height = data_height[profile.rk]
else:
height = 0.0
else: else:
if abs(incline) <= 0: if abs(incline) <= 0:
height = 0.0 height = 0.0
@ -662,10 +656,7 @@ class InitialConditions(SQLSubModel):
for profile in profiles: for profile in profiles:
if not compute_discharge: if not compute_discharge:
if profile.rk in data_discharge: d = data_discharge[profile.rk]
d = data_discharge[profile.rk]
else:
d = 0.0
else: else:
d = discharge d = discharge
elevation = interp(profile.rk, elevation = interp(profile.rk,

View File

@ -307,21 +307,6 @@ class Pollutants(SQLSubModel):
def data(self): def data(self):
return self._data return self._data
@data.setter
def data(self, data):
self._data = [PollutantCharacteristics(type=int(data[0]),
diametre=float(data[1]),
rho=float(data[2]),
porosity=float(data[3]),
cdc_riv=float(data[4]),
cdc_cas=float(data[5]),
apd=float(data[6]),
ac=float(data[7]),
bc=float(data[8]),
pollutant=self,
status=self._status
)]
@classmethod @classmethod
def _db_create(cls, execute, ext=""): def _db_create(cls, execute, ext=""):
execute(f""" execute(f"""
@ -412,7 +397,7 @@ class Pollutants(SQLSubModel):
data["pollutant"] = new_pollutant data["pollutant"] = new_pollutant
new_pollutant._data = PollutantCharacteristics._db_load( new_pollutant._data = PollutantCharacteristics._db_load(
execute, data=data execute, data.copy()
) )
loaded.add(pid) loaded.add(pid)
@ -436,7 +421,7 @@ class Pollutants(SQLSubModel):
f"AND scenario = {self._status.scenario_id}" f"AND scenario = {self._status.scenario_id}"
) )
execute( execute(
"DELETE FROM pollutants_characteristics " + f"DELETE FROM pollutants_characteristics " +
f"WHERE pollutant = {self.id} " + f"WHERE pollutant = {self.id} " +
f"AND scenario = {self._status.scenario_id}" f"AND scenario = {self._status.scenario_id}"
) )

View File

@ -260,7 +260,7 @@ class AdisTS(CommandLineSolver):
_nodes_views = set() _nodes_views = set()
def get_reach_name(self, reach): def get_reach_name(self, reach):
return f"Reach_{reach.pamhyr_id:>3}".replace(" ", "0") return f"Reach_{reach.id:>3}".replace(" ", "0")
def get_node_name(self, node): def get_node_name(self, node):
"""Generate a 3 char name for node """Generate a 3 char name for node
@ -271,7 +271,7 @@ class AdisTS(CommandLineSolver):
Returns: Returns:
A 3 char name string A 3 char name string
""" """
n = node.pamhyr_id n = node.id
# print("node name id: ", n) # print("node name id: ", n)
@ -401,9 +401,9 @@ class AdisTSwc(AdisTS):
) as f: ) as f:
for LC in POL_LC: for LC in POL_LC:
reach = next(filter( reach = next(filter(
lambda edge: edge.id == LC.edge, study.river.enable_edges() lambda edge: edge.id == LC.edge, study.river.edges()
)) # .name )) # .name
reach_name = self.get_reach_name(reach) reach_name = self.get_reach_name(self, reach)
f.write(f"${reach_name} {LC.begin_rk} {LC.end_rk}\n") f.write(f"${reach_name} {LC.begin_rk} {LC.end_rk}\n")
f.write(f"*temps |débit massique (kg/s)\n") f.write(f"*temps |débit massique (kg/s)\n")
f.write(f"*---------++++++++++\n") f.write(f"*---------++++++++++\n")

View File

@ -80,7 +80,7 @@ class AddCommand(QUndoCommand):
self._new = self._pollutants_lst.new( self._new = self._pollutants_lst.new(
self._pollutants_lst, self._index self._pollutants_lst, self._index
) )
self._new.data = [0, 0., 0., 0., 0., 0., 0., 0., 0.] self._new._data = [[0, 0., 0., 0., 0., 0., 0., 0., 0.]]
self._new_ic_adists = self._data.new(self._index, self._new.id) self._new_ic_adists = self._data.new(self._index, self._new.id)
else: else:
self._pollutants_lst.insert(self._index, self._new) self._pollutants_lst.insert(self._index, self._new)