Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fill Invalid Regions w/ Zero #419

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = []
Expand Down
Loading