[refactoring] and solve path_out bug
This commit is contained in:
+4
-4
@@ -52,7 +52,7 @@ class BaseProcessor:
|
||||
rules = {}
|
||||
solve_self_dep = True
|
||||
|
||||
def __init__(self, path, path_out=None, params=None, tag=None):
|
||||
def __init__(self, path, path_out=".", params=None, tag=None):
|
||||
if params is None:
|
||||
self.params = default_params()
|
||||
elif type(params) == str:
|
||||
@@ -60,15 +60,15 @@ class BaseProcessor:
|
||||
else:
|
||||
self.params = copy.deepcopy(params)
|
||||
|
||||
if tag is not None:
|
||||
self.params.out.tag = tag
|
||||
|
||||
# Determining output directory
|
||||
if path_out is None:
|
||||
self.path_out = path
|
||||
else:
|
||||
self.path_out = path_out
|
||||
|
||||
if tag is not None:
|
||||
self.params.out.tag = tag
|
||||
|
||||
def _log(self, string, status=""):
|
||||
if self.params.process.verbose:
|
||||
if len(status) > 0:
|
||||
|
||||
+9
-9
@@ -119,9 +119,9 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
def __init__(
|
||||
self,
|
||||
path,
|
||||
in_runs=None,
|
||||
in_nums=None,
|
||||
path_out=None,
|
||||
runs=None,
|
||||
nums=None,
|
||||
path_out=".",
|
||||
params=None,
|
||||
selector=None,
|
||||
tag=None,
|
||||
@@ -136,13 +136,13 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
----------
|
||||
|
||||
path : path to the main folder of the simulations (ex '~/simus/myproject')
|
||||
in_runs : list of the runs to consider (ex ['run1', 'run2'])
|
||||
in_nums : list or dict of the outputs numbers to consider (ex [3, 5]
|
||||
runs : list of the runs to consider (ex ['run1', 'run2'])
|
||||
nums : list or dict of the outputs numbers to consider (ex [3, 5]
|
||||
or {'run1' : [3, 5], 'run2' : [4, 6])
|
||||
path_out : Path where the plot will be saved. By default set to `path`
|
||||
params : Parameters for postprocessing. See params module.
|
||||
selector : Existing instance of RunSelector, that selects runs and outputs. If set, in_runs and
|
||||
in_nums will be ignored
|
||||
selector : Existing instance of RunSelector, that selects runs and outputs. If set, runs and
|
||||
nums will be ignored
|
||||
tag : string to add in the output and data files.
|
||||
kwargs : Keyword arguments for RunSelector.
|
||||
"""
|
||||
@@ -152,7 +152,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
# Select runs
|
||||
if selector is None:
|
||||
self.selector = RunSelector(
|
||||
path, in_runs, in_nums, self.params.input.nml_filename, **kwargs
|
||||
path, runs, nums, self.params.input.nml_filename, **kwargs
|
||||
)
|
||||
else:
|
||||
self.selector = selector
|
||||
@@ -167,7 +167,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
path,
|
||||
self.runs,
|
||||
self.nums,
|
||||
path_out,
|
||||
self.path_out,
|
||||
self.params,
|
||||
unit_time=unit_time,
|
||||
selector=self.selector,
|
||||
|
||||
@@ -283,9 +283,9 @@ class SnapshotProcessor(HDF5Container):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
path=None,
|
||||
path=".",
|
||||
num=None,
|
||||
path_out=None,
|
||||
path_out=".",
|
||||
params=None,
|
||||
tag=None,
|
||||
selector=None,
|
||||
|
||||
+5
-5
@@ -22,8 +22,8 @@ class StudyProcessor(Aggregator, HDF5Container):
|
||||
def __init__(
|
||||
self,
|
||||
path,
|
||||
in_runs,
|
||||
in_nums,
|
||||
runs,
|
||||
nums,
|
||||
path_out=None,
|
||||
params=default_params(),
|
||||
selector=None,
|
||||
@@ -43,12 +43,12 @@ class StudyProcessor(Aggregator, HDF5Container):
|
||||
else:
|
||||
tag_name = ""
|
||||
|
||||
self.filename = path_out + "/comp" + tag_name + ".h5"
|
||||
self.filename = self.path_out + "/comp" + tag_name + ".h5"
|
||||
|
||||
# Select runs
|
||||
if selector is None:
|
||||
selector = RunSelector(
|
||||
path, in_runs, in_nums, self.params.input.nml_filename, **kwargs
|
||||
path, runs, nums, self.params.input.nml_filename, **kwargs
|
||||
)
|
||||
|
||||
# Save infos
|
||||
@@ -62,7 +62,7 @@ class StudyProcessor(Aggregator, HDF5Container):
|
||||
|
||||
for run in self.runs:
|
||||
path_run = path + "/" + run
|
||||
path_out_run = path_out + "/" + run
|
||||
path_out_run = self.path_out + "/" + run
|
||||
self.snaps[run] = {}
|
||||
|
||||
for num in self.nums[run]:
|
||||
|
||||
Reference in New Issue
Block a user