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

Added warning for NaNs #264

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ ENV/

# setuptools-scm will bundled that in the sdist but we don't want it tracked
xbitinfo/_version.py

# macos folder visualisation
.DS_Store
4 changes: 4 additions & 0 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ def get_bitinformation( # noqa: C901
info_per_bit = {}
pbar = tqdm(ds.data_vars)
for var in pbar:
# Check for non-finite values
if np.any(ds[var].isnull()):
warning_message = f"Warning: Variable {var} in the dataset contains non-finite values (NaNs or infs). Unexpected results may occur."
logging.warning(warning_message)
pbar.set_description(f"Processing var: {var} for dim: {dim}")
if implementation == "julia":
info_per_bit_var = _jl_get_bitinformation(ds, var, axis, dim, kwargs)
Expand Down
Loading