few bug solving
This commit is contained in:
+13
-13
@@ -360,8 +360,11 @@ class SnapshotProcessor(HDF5Container):
|
||||
|
||||
# Create selector object
|
||||
if selector is None:
|
||||
dirpath = os.path.dirname(path)
|
||||
if dirpath == "":
|
||||
dirpath = "."
|
||||
selector = RunSelector(
|
||||
os.path.dirname(path),
|
||||
dirpath,
|
||||
self.run,
|
||||
self.num,
|
||||
self.params.input.nml_filename,
|
||||
@@ -452,9 +455,6 @@ class SnapshotProcessor(HDF5Container):
|
||||
if os.path.exists(part_filename):
|
||||
hydro_file = open(part_filename)
|
||||
part_file = open(f"{path}/output_{self.num:05}/part_file_descriptor.txt")
|
||||
has_grav = os.path.exists(
|
||||
f"{path}/output_{self.num:05}/grav_{self.num:05}.out00000"
|
||||
)
|
||||
plines = part_file.readlines()
|
||||
part_var = np.unique(
|
||||
list(map(lambda s: s.split(",")[1][1:].split("_")[0], plines[2:]))
|
||||
@@ -463,7 +463,7 @@ class SnapshotProcessor(HDF5Container):
|
||||
part_var = []
|
||||
|
||||
has_grav = os.path.exists(
|
||||
f"{path}/output_{self.num:05}/grav_{self.num:05}.out00000"
|
||||
f"{path}/output_{self.num:05}/grav_{self.num:05}.out00001"
|
||||
)
|
||||
|
||||
def is_available(available_vars, pymsesrc, var):
|
||||
@@ -684,12 +684,13 @@ class SnapshotProcessor(HDF5Container):
|
||||
if len(data[key] > 0):
|
||||
if f"/{group}/{key}" in hdf5 and overwrite:
|
||||
hdf5.remove_node(f"/{group}/{key}")
|
||||
hdf5.create_array(
|
||||
f"/{group}", key, data[key], "", createparents=True
|
||||
)
|
||||
unit = self._get_units(self.unit_key[key])
|
||||
hdf5.get_node(f"/{group}/{key}").unit = unit
|
||||
nb_written += 1
|
||||
elif f"/{group}/{key}" not in hdf5:
|
||||
hdf5.create_array(
|
||||
f"/{group}", key, data[key], "", createparents=True
|
||||
)
|
||||
unit = self._get_units(self.unit_key[key])
|
||||
hdf5.get_node(f"/{group}/{key}").unit = unit
|
||||
nb_written += 1
|
||||
else:
|
||||
self.logger.warning("Empty key")
|
||||
if "namelist" not in hdf5.root._v_attrs:
|
||||
@@ -747,7 +748,7 @@ class SnapshotProcessor(HDF5Container):
|
||||
self.cells = self.load_data(
|
||||
cells_src,
|
||||
filename,
|
||||
True,
|
||||
save,
|
||||
keys=keys,
|
||||
group="cells",
|
||||
)
|
||||
@@ -1648,7 +1649,6 @@ class SnapshotProcessor(HDF5Container):
|
||||
outfile = self.pspec_filename
|
||||
if overwrite_file or not os.path.exists(self.pspec_filename):
|
||||
pspec.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs)
|
||||
return np.array([self.pspec_filename])
|
||||
|
||||
def _write_particles(self):
|
||||
"""Ensure particles are written in the hdf5 file"""
|
||||
|
||||
Reference in New Issue
Block a user