Skip to content

fix(era5_aggregate): fix missing data check #81

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

Merged
merged 1 commit into from
Jan 2, 2025
Merged
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
12 changes: 6 additions & 6 deletions openhexa/toolbox/era5/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ def _has_missing_data(da: xr.DataArray) -> bool:
missing = False

# if da.step.size == 1, da.step is just an int so we cannot iterate over it
if da.step.size == 1 and da.isnull().all():
return True

# if da.step size > 1, da.step is an array of int (one per step)
for step in da.step:
if da.sel(step=step).isnull().all():
missing = True
if da.step.size > 1:
for step in da.step:
if da.sel(step=step).isnull().all():
missing = True
else:
missing = da.isnull().all()

return missing

Expand Down
Loading