Commit 5c2e54a6 authored by Henri Payno's avatar Henri Payno
Browse files

[dicth52nx] fix deprecation warning due to update_mode parameter

parent b2848a10
...@@ -403,13 +403,15 @@ def write_xas_proc( ...@@ -403,13 +403,15 @@ def write_xas_proc(
value, value,
h5file=h5_file, h5file=h5_file,
h5path=h5_path, h5path=h5_path,
overwrite_data=True, update_mode="replace",
mode="a", mode="a",
) )
else: else:
with HDF5File(h5_file, "a") as h5f: with HDF5File(h5_file, "a") as h5f:
nx_process = h5f.require_group(nx_process_path) nx_process = h5f.require_group(nx_process_path)
if attrs is None: if attrs is None:
if key_path in nx_process:
del nx_process[key_path]
try: try:
nx_process[key_path] = value nx_process[key_path] = value
except TypeError as e: except TypeError as e:
...@@ -452,6 +454,9 @@ def write_xas_proc( ...@@ -452,6 +454,9 @@ def write_xas_proc(
# to insure silx isplotting it we should have curve as a 1D object # to insure silx isplotting it we should have curve as a 1D object
# but by default we are handling a map of spectra. This is why we # but by default we are handling a map of spectra. This is why we
# need to duplicate data here # need to duplicate data here
if name in plot_group:
del plot_group[name]
if dataset_to_link.ndim == 1: if dataset_to_link.ndim == 1:
plot_group[name] = h5py.SoftLink(dataset_to_link.name) plot_group[name] = h5py.SoftLink(dataset_to_link.name)
elif dataset_to_link.ndim == 2: elif dataset_to_link.ndim == 2:
...@@ -538,7 +543,7 @@ def write_xas_proc( ...@@ -538,7 +543,7 @@ def write_xas_proc(
process.getConfiguration(), process.getConfiguration(),
h5file=h5_file, h5file=h5_file,
h5path=h5_path, h5path=h5_path,
overwrite_data=True, update_mode="add",
mode="a", mode="a",
) )
...@@ -614,7 +619,7 @@ def write_spectrum_saving_pt(h5_file, entry, obj, overwrite=True): ...@@ -614,7 +619,7 @@ def write_spectrum_saving_pt(h5_file, entry, obj, overwrite=True):
:param str obj_name: name of the object to store :param str obj_name: name of the object to store
:param str data_path: :param str data_path:
""" """
dicttoh5(obj, h5file=h5_file, h5path=entry, overwrite_data=True, mode="a") dicttoh5(obj, h5file=h5_file, h5path=entry, update_mode="replace", mode="a")
def get_xasproc(h5_file, entry): def get_xasproc(h5_file, entry):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment