Open, load into memory, and close a Dataset from a file or file-like object. This is a thin wrapper around :py:meth:`~xarray.open_dataset`. It differs from `open_dataset` in that it loads the Dataset into memory, closes the file, and returns the Dataset. In contrast, `open_dataset`
(filename_or_obj: T_PathFileOrDataStore, **kwargs)
| 141 | |
| 142 | |
| 143 | def load_dataset(filename_or_obj: T_PathFileOrDataStore, **kwargs) -> Dataset: |
| 144 | """Open, load into memory, and close a Dataset from a file or file-like |
| 145 | object. |
| 146 | |
| 147 | This is a thin wrapper around :py:meth:`~xarray.open_dataset`. It differs |
| 148 | from `open_dataset` in that it loads the Dataset into memory, closes the |
| 149 | file, and returns the Dataset. In contrast, `open_dataset` keeps the file |
| 150 | handle open and lazy loads its contents. All parameters are passed directly |
| 151 | to `open_dataset`. See that documentation for further details. |
| 152 | |
| 153 | Returns |
| 154 | ------- |
| 155 | dataset : Dataset |
| 156 | The newly created Dataset. |
| 157 | |
| 158 | See Also |
| 159 | -------- |
| 160 | open_dataset |
| 161 | """ |
| 162 | if "cache" in kwargs: |
| 163 | raise TypeError("cache has no effect in this context") |
| 164 | |
| 165 | with open_dataset(filename_or_obj, **kwargs) as ds: |
| 166 | return ds.load() |
| 167 | |
| 168 | |
| 169 | def load_dataarray(filename_or_obj: T_PathFileOrDataStore, **kwargs) -> DataArray: |
searching dependent graphs…