pymc icon indicating copy to clipboard operation
pymc copied to clipboard

ENH: Infer dims automatically from DataArray object

Open ivlis opened this issue 4 months ago • 1 comments

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.

ivlis avatar Aug 05 '25 12:08 ivlis

Can i work on this issue?

aman-coder03 avatar Dec 05 '25 15:12 aman-coder03