mirror of https://gitlab.com/pamhyr/pamhyr2
debug
parent
bfa0f0fd9b
commit
91510a1755
|
|
@ -59,20 +59,3 @@ class CustomPlotTranslate(ResultsTranslate):
|
|||
self._dict['3-meter'] = self._dict["unit_height"]
|
||||
self._dict['4-dimensionless'] = self._dict["unit_froude"]
|
||||
self._dict['5-m2'] = self._dict["wet_area"]
|
||||
|
||||
# SubDict
|
||||
|
||||
self._sub_dict["values_x"] = {
|
||||
"rk": self._dict["rk"],
|
||||
"time": self._dict["time"],
|
||||
}
|
||||
self._sub_dict["values_y"] = {
|
||||
"elevation": self._dict["elevation"],
|
||||
"water_elevation": self._dict["water_elevation"],
|
||||
"discharge": self._dict["discharge"],
|
||||
"velocity": self._dict["velocity"],
|
||||
"depth": self._dict["max_depth"],
|
||||
"mean_depth": self._dict["mean_depth"],
|
||||
"froude": self._dict["froude"],
|
||||
"wet_area": self._dict["wet_area"],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -606,10 +606,25 @@ class ResultsWindow(PamhyrWindow):
|
|||
timestamps = sorted(self._results.get("timestamps"))
|
||||
if x == "rk":
|
||||
timestamp = self._get_current_timestamp()
|
||||
self._export_rk(timestamp, y, filename)
|
||||
val_dict = self._export_rk(timestamp, y, filename)
|
||||
elif x == "time":
|
||||
profile = self._get_current_profile()
|
||||
self._export_time(profile, y, filename)
|
||||
val_dict = self._export_time(profile, y, filename)
|
||||
|
||||
with open(filename, 'w', newline='') as csvfile:
|
||||
writer = csv.writer(csvfile, delimiter=',',
|
||||
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||
dict_x = self._trad.get_dict("values_x")
|
||||
dict_y = self._trad.get_dict("values_y")
|
||||
header = [dict_x[x]]
|
||||
for text in y:
|
||||
header.append(dict_y[text])
|
||||
writer.writerow(header)
|
||||
for row in range(len(val_dict[x])):
|
||||
line = [val_dict[x][row]]
|
||||
for var in y:
|
||||
line.append(val_dict[var][row])
|
||||
writer.writerow(line)
|
||||
|
||||
def export_all(self, reach, directory, timestamps):
|
||||
name = reach.name
|
||||
|
|
@ -651,8 +666,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
|
||||
def _export_rk(self, timestamp, y, filename):
|
||||
reach = self._results.river.reachs[self._get_current_reach()]
|
||||
rk = reach.geometry.get_rk()
|
||||
my_dict = {}
|
||||
my_dict["rk"] = reach.geometry.get_rk()
|
||||
if "elevation" in y:
|
||||
my_dict["elevation"] = reach.geometry.get_z_min()
|
||||
if "discharge" in y:
|
||||
|
|
@ -719,23 +734,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
)
|
||||
)
|
||||
|
||||
with open(filename, 'w', newline='') as csvfile:
|
||||
writer = csv.writer(csvfile, delimiter=',',
|
||||
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||
header = ["rk"] + y
|
||||
writer.writerow(header)
|
||||
for row in range(len(rk)):
|
||||
line = [rk[row]]
|
||||
for var in y:
|
||||
line.append(my_dict[var][row])
|
||||
writer.writerow(line)
|
||||
return my_dict
|
||||
|
||||
def _export_time(self, profile, y, filename):
|
||||
reach = self._results.river.reachs[self._get_current_reach()]
|
||||
profile = reach.profile(profile)
|
||||
ts = list(self._results.get("timestamps"))
|
||||
ts.sort()
|
||||
my_dict = {}
|
||||
my_dict["time"] = ts.sort()
|
||||
z = profile.get_key("Z")
|
||||
q = profile.get_key("Q")
|
||||
if "elevation" in y:
|
||||
|
|
@ -773,13 +779,4 @@ class ResultsWindow(PamhyrWindow):
|
|||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
|
||||
with open(filename, 'w', newline='') as csvfile:
|
||||
writer = csv.writer(csvfile, delimiter=',',
|
||||
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||
header = ["time"] + y
|
||||
writer.writerow(header)
|
||||
for row in range(len(ts)):
|
||||
line = [ts[row]]
|
||||
for var in y:
|
||||
line.append(my_dict[var][row])
|
||||
writer.writerow(line)
|
||||
return my_dict
|
||||
|
|
|
|||
|
|
@ -66,3 +66,19 @@ class ResultsTranslate(MainTranslate):
|
|||
"hydraulic_radius": self._dict["unit_hydraulic_radius"],
|
||||
"froude": self._dict["unit_froude"],
|
||||
}
|
||||
|
||||
self._sub_dict["values_x"] = {
|
||||
"rk": self._dict["unit_rk"],
|
||||
"time": self._dict["unit_time_s"],
|
||||
}
|
||||
|
||||
self._sub_dict["values_y"] = {
|
||||
"elevation": self._dict["unit_elevation"],
|
||||
"water_elevation": self._dict["unit_water_elevation"],
|
||||
"discharge": self._dict["unit_discharge"],
|
||||
"velocity": self._dict["unit_speed"],
|
||||
"depth": self._dict["unit_max_height"],
|
||||
"mean_depth": self._dict["unit_mean_height"],
|
||||
"froude": self._dict["unit_froude"],
|
||||
"wet_area": self._dict["unit_wet_area"],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@
|
|||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -73,6 +79,9 @@
|
|||
<property name="minimum">
|
||||
<double>-1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
|
|
|
|||
Loading…
Reference in New Issue