Skip to content

Commit

Permalink
Fix TypeError when adjusting with preloaded training dataset (#1679)
Browse files Browse the repository at this point in the history
See issue #1678 for an explanation of the problem

### What kind of change does this PR introduce?

Returns an empty list if a reduced dimension is not in the dataset
chunks in xclim/sdba/base.py map_blocks when checking for badchunks

### Does this PR introduce a breaking change?
No.
  • Loading branch information
Zeitsperre authored Mar 21, 2024
2 parents 4ab0cd2 + 818e743 commit 4cca5f1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Contributors
* Maliko Tanguy <[email protected]> `@malngu <https://github.com/malngu>`_
* Christopher Whelan `@qwhelan <https://github.com/qwhelan>`_
* Dante Castro <[email protected]> `@profesorpaiche <https://github.com/profesorpaiche>`_
* Sascha Hofmann <[email protected]> `@saschahofmann <https://github.com/saschahofmann>`_
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Announcements
Bug fixes
^^^^^^^^^
* Fixed an bug in sdba's ``map_groups`` that prevented passing DataArrays with cftime coordinates if the ``sdba_encode_cf`` option was True. (:issue:`1673`, :pull:`1674`).
* Fixed bug (:issue:`1678`, :pull:`1679`) in sdba where a loaded training dataset could not be used for adjustment

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion xclim/sdba/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def _map_blocks(ds, **kwargs): # noqa: C901
{
dim: chunks.get(dim)
for dim in reduced_dims
if len(chunks.get(dim)) > 1
if len(chunks.get(dim, [])) > 1
}
)
if badchunks:
Expand Down

0 comments on commit 4cca5f1

Please sign in to comment.