mirror of https://gitlab.com/pamhyr/pamhyr2
debug windows paths
parent
af30fde81a
commit
3cd6d31731
|
|
@ -40,8 +40,9 @@ class Results(object):
|
|||
# Keep results creation date
|
||||
"creation_date": datetime.now(),
|
||||
}
|
||||
repertory_results = os.path.join(repertory, "resultats")
|
||||
filelist = [f for f in os.listdir(repertory_results) if os.path.isfile(os.path.join(repertory_results, f))]
|
||||
filelist = [f for f in os.listdir(self._repertory)
|
||||
if os.path.isfile(os.path.join(self._repertory, f))
|
||||
]
|
||||
self._pollutants_list = [f[0:-4] for f in filelist if f[-4:] == ".bin"]
|
||||
self._pollutants_list.insert(0, self._pollutants_list.pop(
|
||||
self._pollutants_list.index("total_sediment"))
|
||||
|
|
|
|||
|
|
@ -619,14 +619,15 @@ class AdisTSwc(AdisTS):
|
|||
@timer
|
||||
def read_bin(self, study, repertory, results, qlog=None, name="0"):
|
||||
|
||||
repertory_results = os.path.join(repertory, "resultats")
|
||||
filelist = [f for f in os.listdir(repertory_results) if os.path.isfile(os.path.join(repertory_results, f))]
|
||||
filelist = [f for f in os.listdir(repertory)
|
||||
if os.path.isfile(os.path.join(repertory, f))
|
||||
]
|
||||
files_bin_names = [f for f in filelist if f[-4:] == ".bin"]
|
||||
files_bin_names.insert(0, files_bin_names.pop(
|
||||
files_bin_names.index("total_sediment.bin"))
|
||||
)
|
||||
|
||||
ifilename = os.path.join(repertory_results, files_bin_names[0])
|
||||
ifilename = os.path.join(repertory, files_bin_names[0])
|
||||
|
||||
logger.info(f"read_bin: Start reading '{ifilename}' ...")
|
||||
|
||||
|
|
@ -723,7 +724,7 @@ class AdisTSwc(AdisTS):
|
|||
def ip_to_ri(r, i): return i - reach_offset[r]
|
||||
|
||||
path_files = map(lambda file: os.path.join(
|
||||
repertory_results, file), files_bin_names)
|
||||
repertory, file), files_bin_names)
|
||||
|
||||
data_tmp = {}
|
||||
|
||||
|
|
@ -831,8 +832,6 @@ class AdisTSwc(AdisTS):
|
|||
if name is None:
|
||||
name = study.name.replace(" ", "_")
|
||||
|
||||
print("adist ts results repertory: ", repertory)
|
||||
|
||||
results = super(AdisTSwc, self).results(study,
|
||||
repertory,
|
||||
qlog,
|
||||
|
|
@ -850,12 +849,20 @@ class AdisTSwc(AdisTS):
|
|||
|
||||
def rm_previous_results(self, study, repertory, qlog):
|
||||
|
||||
if "resultats" not in os.listdir(repertory):
|
||||
if "resultats" in os.listdir(repertory):
|
||||
repertory_results = os.path.join(repertory, "resultats")
|
||||
else:
|
||||
repertory_results = os.path.normpath(repertory)
|
||||
|
||||
if not os.path.isdir(repertory_results):
|
||||
return
|
||||
|
||||
repertory_results = os.path.join(repertory, "resultats")
|
||||
filelist = [f for f in os.listdir(repertory_results) if os.path.isfile(os.path.join(repertory_results, f))]
|
||||
filelist = [f for f in os.listdir(repertory_results)
|
||||
if os.path.isfile(os.path.join(repertory_results, f))
|
||||
]
|
||||
files_bin_names = [f for f in filelist if f[-4:] == ".bin"]
|
||||
if len(files_bin_names) < 1:
|
||||
return
|
||||
|
||||
for el in files_bin_names:
|
||||
os.remove(os.path.join(repertory_results, el))
|
||||
|
|
|
|||
|
|
@ -1581,13 +1581,21 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
if dialog.exec_():
|
||||
dir_path = dialog.selectedFiles()[0]
|
||||
dir_list = os.listdir(dir_path)
|
||||
if "resultats" in dir_list:
|
||||
dir_path = os.path.join(dir_path, "resultats")
|
||||
dir_list = os.listdir(dir_path)
|
||||
|
||||
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
||||
solver_name = dir_path.split("/")[-2]
|
||||
if len(bin_list) < 1:
|
||||
# TODO message
|
||||
return
|
||||
path = os.path.normpath(dir_path)
|
||||
solver_name = path.split(os.sep)[-2]
|
||||
solver_results = next(filter(lambda x: x.name == solver_name,
|
||||
self.conf.solvers))
|
||||
solver_results_adists = solver_results.results(
|
||||
self._study,
|
||||
repertory=dir_path[:-10], qlog=None) # self._output)
|
||||
repertory=dir_path, qlog=None) # self._output)
|
||||
logger.info(f"Select results: {dir_path}")
|
||||
if len(bin_list) >= 2 and ("total_sediment.bin" in bin_list):
|
||||
self.open_solver_results_adists(
|
||||
|
|
|
|||
|
|
@ -414,9 +414,15 @@ class SolverLogWindowAdisTS(PamhyrWindow):
|
|||
|
||||
def results(self):
|
||||
if self._results is None:
|
||||
dir_list = os.listdir(self._workdir)
|
||||
if "resultats" in dir_list:
|
||||
dir_path = os.path.join(self._workdir, "resultats")
|
||||
else:
|
||||
dir_path = self._workdir
|
||||
|
||||
def reading_fn():
|
||||
self._results = self._solver.results(
|
||||
self._study, self._workdir, qlog=self._output
|
||||
self._study, dir_path, qlog=self._output
|
||||
)
|
||||
|
||||
dlg = ReadingResultsDialog(reading_fn=reading_fn, parent=self)
|
||||
|
|
|
|||
Loading…
Reference in New Issue