Skip to content

Add array_namespace property for each data object #747

@sandorkertesz

Description

@sandorkertesz

Is your feature request related to a problem? Please describe.

The idea is to add a property to data objects to access the earthkit-utils patched array namespace of the objects. E.g.:

ds = ekd.from_source(f, "my.grib")
ds.array_namespace
ds[0].array_namespace

For Xarray it should be available on the earthkit accessor:

r = ds.to_xarray()
r.earthkit.array_namespace

Questions:

  • do we need this property/method on the object? We could always use the array_namespace method in earthkit-utils:
from earthkit.utils import array_namespace
array_namespace(ds)
array_namespace(ds[0])
array_namespace(r)
  • use a method with arguments? With a method we could pass options for compound datatypes such as fieldlist/Xarray e.g. to check all fields/variables or just the first one.
  • use a private property '_array_namespace`?
  • add array_backend too? We can get the namespace from the backend as array_backend.namesapce

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Organisation

ECMWF

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions