Skip to content

Commit

Permalink
Merge pull request #151 from brews/fix_360calendar_chunk
Browse files Browse the repository at this point in the history
Fix 360 day calendar conversion chunk errors from dodola.services.clean_cmip6
  • Loading branch information
brews authored Dec 9, 2021
2 parents fcad6ee + 57da5aa commit 9d8d8aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ History

0.XX.X (XXXX-XX-XX)
-------------------
*
* Fix rechunk error when converting 360 days calendars. (#149, PR #151, @brews)


0.12.0 (2021-12-09)
Expand Down
3 changes: 3 additions & 0 deletions dodola/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ def xesmf_regrid(
def standardize_gcm(ds, leapday_removal=True):
"""
360 calendar conversion requires that there are no chunks in
the 'time' dimension of `ds`.
Parameters
----------
ds : xr.Dataset
Expand Down
8 changes: 8 additions & 0 deletions dodola/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,9 @@ def regrid(
def clean_cmip6(x, out, leapday_removal):
"""Cleans and standardizes CMIP6 GCM
This loads the entire `x` Dataset into memory for speed
and to avoid chunking errors.
Parameters
----------
x : str
Expand All @@ -718,6 +721,11 @@ def clean_cmip6(x, out, leapday_removal):
Whether or not to remove leap days.
"""
ds = storage.read(x)

# Cannot have chunks in time dimension for 360 day calendar conversion so loading
# data into memory.
ds.load()

cleaned_ds = standardize_gcm(ds, leapday_removal)
storage.write(out, cleaned_ds)

Expand Down

0 comments on commit 9d8d8aa

Please sign in to comment.