From f11cdd3bf7be7face515fcc988506b749bd1d774 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 1 Feb 2023 18:24:21 -0800 Subject: [PATCH] ADIOS2: Support NULL-Blocks (Chunks) Add support to read back ADIOS2 data sets that contain empty blocks (NULL chunks). This is something to handle carefully and needed for a work-arounds in WarpX BTD. --- .../data_reader/io_reader/utilities.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py b/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py index 7a7360c2..96fd9aee 100644 --- a/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py +++ b/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py @@ -66,6 +66,15 @@ def get_data(series, record_component, i_slice=None, pos_slice=None, data = np.full(record_component.shape, np.nan, record_component.dtype) for chunk in chunks: chunk_slice = chunk_to_slice(chunk) + + # skip empty slices + # https://github.com/ornladios/ADIOS2 + volume = 1 + for csl in chunk_slice: + volume *= csl.stop - csl.start + if volume == 0: + continue + # read only valid region x = record_component[chunk_slice] series.flush() @@ -98,6 +107,15 @@ def get_data(series, record_component, i_slice=None, pos_slice=None, s_valid = list(s) # same as s but reduced to valid regions in chunk s_target = [] # starts and stops in sliced array chunk_slice = chunk_to_slice(chunk) + + # skip empty slices + # https://github.com/ornladios/ADIOS2 + volume = 1 + for csl in chunk_slice: + volume *= csl.stop - csl.start + if volume == 0: + continue + # read only valid region for d, slice_d in enumerate(s): start = chunk_slice[d].start