Skip to content

NotImplementedError: 'item' is not yet a valid method on dask arrays in cf_convert_between_lon_frames #451

Description

@cehbrecht

In clisops 0.16.2, subsetting fails when longitude coordinates are dask-backed.

The issue comes from this line in clisops/utils/dataset_utils.py

lon_min, lon_max = ds.coords[lon].min().item(), ds.coords[lon].max().item()

The .item() method only works on NumPy scalars. When applied to a dask-backed array, it raises:

NotImplementedError: 'item' is not yet a valid method on dask arrays

Suggested fix:

lon_min = float(ds.coords[lon].min().compute().values)
lon_max = float(ds.coords[lon].max().compute().values)

This forces evaluation before extracting the scalar and works with both NumPy and dask arrays.

Example:

In this notebook the error is reproduced using rooki via Rook WPS:

https://github.com/roocs/rooki/blob/master/notebooks/errors/cds-error-2025-09-08-cmip6-noresm2.ipynb

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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