Skip to content

Error when computing properties.return_value with a Chunked DataArray #266

@coxipi

Description

@coxipi

Setup Information

  • xsdba version:
  • Python version:
  • Operating System:

Description

Computing return levels. I compute a list of output with different return levels. When sending chunked data as input, it returns an output where the last value computed in the list is duplicated.

Loaded data works as expected.

Using a pure xarray function works in both cases

Steps To Reproduce

from xclim.testing import open_dataset
import xarray as xr
import xsdba as xa
pr = open_dataset('sdba/ahccd_1950-2013.nc').pr.isel(location=[0]).chunk({'location':1})
prex = pr.resample(time='YS').max().load()
def get_rls(da):
    return xr.concat([xa.properties.return_value(da, period=rl).expand_dims(quantile=[f'rl{rl}']) for rl in [20,50,100]], dim='quantile')
print(get_rls(prex).values.ravel())
# >>> [77.18109394 89.60306098 99.42724546]
print(get_rls(prex.chunk({'location':1})).values.ravel())
# >>> [99.42724546 99.42724546 99.42724546]

Additional context

In comparison, using a pure xarray function is ok

def get_rls(da):
    return xr.concat([da.quantile(dim='time', q=1-1/rl) for rl in [20,50,100]], dim='quantile')

Contribution

  • I would be willing/able to open a Pull Request to address this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions