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)
| 167 | |
| 168 | |
| 169 | def 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 | |
| 195 | def load_datatree(filename_or_obj: T_PathFileOrDataStore, **kwargs) -> DataTree: |
searching dependent graphs…