Skip to content

Exposing chunk array types in dask.array (e.g., sparsed and masked) #2977

@shoyer

Description

@shoyer

As noted in pydata/xarray#1769, dask currently does not expose any way to determine the computed type of a dask array containing MaskedArray or sparse blocks.

This is untenable for building complex codebases using dask: we need to know the type of subarrays, so errors can be raised at graph building instead of compute time. For masked arrays, this is merely inconvenient, but for mixing up dense/sparse arrays this is a very serious concern, because it could entail loading very large arrays into memory.

I would suggest a simple hierarchy:

  • BaseArray: abstract base class for all dask array types
  • Array(BaseArray): base numpy.ndarray elements
  • MaskedArray(BaseArray): numpy.ma.MaskedArray elements
  • SparseArray(BaseArray): sparse array elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions