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 8c5c04f..81b5114 100644 --- a/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py +++ b/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/utilities.py @@ -59,15 +59,14 @@ def get_data(series, record_component, i_slice=None, pos_slice=None, # ADIOS2: Actual chunks, all other: one chunk chunks = record_component.available_chunks() - # mask invalid regions with NaN: fill value - # note: NaN is only defined for floating point types - NaN_value = np.nan if np.issubdtype(record_component.dtype, np.floating) or np.issubdtype(record_component.dtype, np.complexfloating) else 0 + # mask invalid regions with 0: fill value + fill_value = 0 # read whole data set if pos_slice is None: - # mask invalid regions with NaN + # mask invalid regions with zero # note: full_like triggers a full read, thus we avoid it #340 - data = np.full(record_component.shape, NaN_value, record_component.dtype) + data = np.full(record_component.shape, fill_value, record_component.dtype) for chunk in chunks: chunk_slice = chunk_to_slice(chunk) @@ -94,8 +93,8 @@ def get_data(series, record_component, i_slice=None, pos_slice=None, for dir_index in pos_slice_sorted: # remove indices in list del slice_shape[dir_index] - # mask invalid regions with NaN - data = np.full(slice_shape, NaN_value, dtype=record_component.dtype) + # mask invalid regions with zero + data = np.full(slice_shape, fill_value, dtype=record_component.dtype) # build requested ND slice with respect to full data s = []