Add extractor for turb rms
This commit is contained in:
+15
-3
@@ -109,6 +109,13 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
else:
|
||||
super(Plotter, self)._not_self_dep(name, dep, dep_arg, overwrite, **kwargs)
|
||||
|
||||
def _needs_computation(self, overwrite, plot_filename):
|
||||
return (
|
||||
self.pp_params.out.interactive
|
||||
or overwrite
|
||||
or not os.path.exists(plot_filename)
|
||||
)
|
||||
|
||||
def _process_rule(self, name, rule, arg, overwrite=False, **kwargs):
|
||||
if not arg is None:
|
||||
name_full = name + "_" + str(arg)
|
||||
@@ -158,7 +165,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
def _plot_rule(
|
||||
self, rule, save, arg, plot_filename, overwrite, open_figure=True, **kwargs
|
||||
):
|
||||
if overwrite or not os.path.exists(plot_filename):
|
||||
if self._needs_computation(overwrite, plot_filename):
|
||||
if open_figure:
|
||||
P.figure()
|
||||
rule.plot(save, arg, **kwargs)
|
||||
@@ -217,12 +224,17 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
prop_value = self.comp.get_nml(nml_key, run)
|
||||
if prop_name in self.value_convert:
|
||||
prop_value_str = self.value_convert[prop_name](prop_value)
|
||||
else:
|
||||
elif type(prop_value) in [int, float]:
|
||||
prop_value_str = "${:.6g}$".format(prop_value)
|
||||
else:
|
||||
prop_value_str = str(prop_value)
|
||||
return r"{} = {}".format(prop_label, prop_value_str)
|
||||
|
||||
if nml_key is None and label is None:
|
||||
label_run = r"{}".format(self.save.root._v_attrs.attrs[node.name].label)
|
||||
if "attrs" in self.save.root._v_attrs:
|
||||
label_run = r"{}".format(self.save.root._v_attrs.attrs[run].label)
|
||||
else:
|
||||
label_run = run
|
||||
elif not nml_key is None:
|
||||
if not type(nml_key) == list:
|
||||
nml_key = [nml_key]
|
||||
|
||||
Reference in New Issue
Block a user