MCPcopy Index your code
hub / github.com/pydata/xarray / load_dataarray

Function load_dataarray

xarray/backends/api.py:169–192  ·  view source on GitHub ↗

Open, load into memory, and close a DataArray from a file or file-like object containing a single data variable. This is a thin wrapper around :py:meth:`~xarray.open_dataarray`. It differs from `open_dataarray` in that it loads the Dataset into memory, closes the file, and returns t

(filename_or_obj: T_PathFileOrDataStore, **kwargs)

Source from the content-addressed store, hash-verified

167
168
169def load_dataarray(filename_or_obj: T_PathFileOrDataStore, **kwargs) -> DataArray:
170 """Open, load into memory, and close a DataArray from a file or file-like
171 object containing a single data variable.
172
173 This is a thin wrapper around :py:meth:`~xarray.open_dataarray`. It differs
174 from `open_dataarray` in that it loads the Dataset into memory, closes the
175 file, and returns the Dataset. In contrast, `open_dataarray` keeps the file
176 handle open and lazy loads its contents. All parameters are passed directly
177 to `open_dataarray`. See that documentation for further details.
178
179 Returns
180 -------
181 datarray : DataArray
182 The newly created DataArray.
183
184 See Also
185 --------
186 open_dataarray
187 """
188 if "cache" in kwargs:
189 raise TypeError("cache has no effect in this context")
190
191 with open_dataarray(filename_or_obj, **kwargs) as da:
192 return da.load()
193
194
195def load_datatree(filename_or_obj: T_PathFileOrDataStore, **kwargs) -> DataTree:

Callers 1

test_load_dataarrayMethod · 0.90

Calls 2

open_dataarrayFunction · 0.85
loadMethod · 0.45

Tested by 1

test_load_dataarrayMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…