QuantileDeltaMapping adjustment in Dask fails if training dataset has been loaded #1678
Closed
2 tasks done
Labels
bug
Something isn't working
Setup Information
Description
When I modify the example from the docs to run the QuantileDeltaMapping in Dask, it fails during adjustment if I load the dataset after training.
As you can see in the example below, all I did is add chunking to
ref
andsim
. I then load theqdm.ds
to make sure that training is performed. In my real world example, I want to do this because I will adjust multiple simulations with the same training dataset. In fact, the same xclim example recommends doing this.The error message (
TypeError: object of type 'NoneType' has no len()
) points to xclim/sdba/base.py:606.These are the lines
reduced_dims
aregroups
andquantiles
which aren't inchunks
after I calledload
onqdm.ds
. That's whychunks.get(dim)
return NoneType which explains the error message.In fact, just 2 lines above xclim seems to anticipate this case by returning an empty list by default (L599
if len(chunks.get(dim, [])) > 1
).I suggest to use the same approach to fix this issue. Happy to make a PR.
Steps To Reproduce
Additional context
No response
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: