Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 31, 2024
1 parent e0aa433 commit 63ed2a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,18 @@ def get_bitinformation( # noqa: C901


def _quantized_variable_is_scaled(ds: xr.DataArray, var: str) -> bool:
has_scale_or_offset = any(["add_offset" in ds[var].encoding, "scale_factor" in ds[var].encoding])
has_scale_or_offset = any(
["add_offset" in ds[var].encoding, "scale_factor" in ds[var].encoding]
)

if not has_scale_or_offset:
return False

loaded_dtype = ds[var].dtype
storage_dtype = ds[var].encoding.get("dtype", None)
assert storage_dtype is not None, f"Variable {var} is likely quantized, but does not have a storage dtype"
assert (
storage_dtype is not None
), f"Variable {var} is likely quantized, but does not have a storage dtype"

if loaded_dtype == storage_dtype:
return False
Expand Down

0 comments on commit 63ed2a9

Please sign in to comment.