Skip to content

ENH: Infer dims automatically from DataArray object #7888

@ivlis

Description

@ivlis

Before

type(xr_data["a"]) # DataArray

coords = {"x": xr_data.coords["x"].values, ...}

with pm.Model(coords = coords) as m:
    a = pmd.Data(
        "a", xr_data["a"], dims = ['x']
    )

After

type(xr_data["a"]) # DataArray
with pm.Model() as m:
    a = pmd.Data(
        "a", xr_data["a"]
    )

Context for the issue:

If the data is supplied as DataArray it already contains all information about dimensions and coordinates. The new functionality:

  1. infers the necessary dimensions for the Data object from the supplied data array
  2. automatically adds coordinates from the DataArray to the model.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions