xarray.DataArray.from_dict

classmethod DataArray.from_dict(d)[source]

Convert a dictionary into an xarray.DataArray

Input dict can take several forms:

d = {"dims": ("t"), "data": x}

d = {
    "coords": {"t": {"dims": "t", "data": t, "attrs": {"units": "s"}}},
    "attrs": {"title": "air temperature"},
    "dims": "t",
    "data": x,
    "name": "a",
}

where “t” is the name of the dimesion, “a” is the name of the array, and x and t are lists, numpy.arrays, or pandas objects.

Parameters

d (dict) – Mapping with a minimum structure of {“dims”: […], “data”: […]}

Returns

obj (xarray.DataArray)