Skip to content

BaseAdjustment _check_inputs too restrictive for chunking along the main dimension #159

@saschahofmann

Description

@saschahofmann

Addressing a Problem?

I think for at least some adjustments like the Scaling class there is no need to prevent a chunked main dimension. Since the mean works really well over a chunked dimension, I think this restriction is more harmful (memory) than helpful. Unless there is an advantage of having the dimension unchunked that I am not seeing.

Potential Solution

A simple _allow_chunked_main_dimension = False similar to _allow_diff_calendars could do the trick quite easily. Happy to implement this if you're happy with this.

Additional context

Reproducible example

import xarray as xr
from xsdba import Scaling
import numpy as np

time = xr.date_range('2000-01-01', '2010-12-31')
hist = xr.DataArray(np.random.rand(time.size), coords=dict(time=('time', time))).chunk(time=100)
ref = xr.DataArray(np.random.rand(time.size), coords=dict(time=('time', time)))


Scaling.train(ref, hist)

Fails with on adjustment.py:93

ValueError: Multiple chunks along the main adjustment dimension time is not supported.

Contribution

  • I would be willing/able to open a Pull Request to contribute this feature.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestwontfixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions