diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py
index 9238c1bc..b88f8f87 100644
--- a/src/View/Results/Window.py
+++ b/src/View/Results/Window.py
@@ -337,7 +337,8 @@ class ResultsWindow(PamhyrWindow):
"action_add": self._add_custom_plot,
"action_export": self._export,
# "action_export": self.export_current,
- "action_Geo_tiff": self.import_geotiff
+ "action_Geo_tiff": self.import_geotiff,
+ "action_import_data": self.import_data
}
self.find(QAction, "action_Geo_tiff").setEnabled(False)
self.find(QAction, "action_Geo_tiff").setVisible(False)
@@ -703,7 +704,7 @@ class ResultsWindow(PamhyrWindow):
select_file="AnyFile",
callback=lambda f: self.export_to(f[0], x, y, envelop, solver_id),
default_suffix=".csv",
- file_filter=["CSV (*.csv)"],
+ file_filter=[self._dict["file_csv"]],
)
def export_to(self, filename, x, y, envelop, solver_id):
@@ -1214,3 +1215,34 @@ class ResultsWindow(PamhyrWindow):
# self.canvas.axes.set_xlim(xlim)
# self.canvas.axes.set_ylim(ylim)
return
+
+ def import_data(self):
+
+ file_types = [
+ self._trad["file_csv"],
+ self._trad["file_all"],
+ ]
+
+ self.file_dialog(
+ select_file="Existing_file",
+ callback=lambda f: self.read_csv_file(f[0]),
+ default_suffix=".csv",
+ file_filter=file_types,
+ )
+
+ def read_csv_file(self, filename):
+ with open(filename, 'r', newline='') as f:
+ lines=f.readlines()
+ x = []
+ y = []
+ for line in lines:
+ if line[0] != "*" and line[0] != "#" and line[0] != "$":
+ row = line.split(" ")
+ print(row)
+ if len(row) > 1:
+ x.append(float(row[0]))
+ y.append(float(row[1]))
+ print(x)
+ print(y)
+ self.canvas_2.axes.scatter(x, y, marker="+")
+ self.plot_rkc.idle()
diff --git a/src/View/Results/translate.py b/src/View/Results/translate.py
index cd6f46d4..7a1e7e9b 100644
--- a/src/View/Results/translate.py
+++ b/src/View/Results/translate.py
@@ -56,6 +56,8 @@ class ResultsTranslate(MainTranslate):
self._dict["file_all"] = _translate("Results", "All files (*)")
self._dict["file_geotiff"] = _translate(
"Results", "GeoTIFF file (*.tiff *.tif)")
+ self._dict["file_csv"] = _translate(
+ "Results", "CSV file (*.csv)")
self._dict["ImageCoordinates"] = _translate(
"Results", "Image coordinates"
)
diff --git a/src/View/ui/Results.ui b/src/View/ui/Results.ui
index 3fcf700a..4e33b042 100644
--- a/src/View/ui/Results.ui
+++ b/src/View/ui/Results.ui
@@ -239,6 +239,7 @@
+
@@ -288,6 +289,18 @@
Import background image
+
+
+
+ ressources/import.pngressources/import.png
+
+
+ Import data
+
+
+ Import data from SCV file
+
+