Skip to content

Commit

Permalink
Add to api.rst, fix whats-new.rst typo, raise error instead of warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed May 16, 2019
1 parent 2ee5443 commit c609b69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ Dataset methods
:toctree: generated/

open_dataset
load_dataset
open_mfdataset
open_rasterio
open_zarr
Expand Down Expand Up @@ -487,6 +488,7 @@ DataArray methods
:toctree: generated/

open_dataarray
load_dataarray
DataArray.to_dataset
DataArray.to_netcdf
DataArray.to_pandas
Expand Down
4 changes: 2 additions & 2 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Enhancements
- Clean up Python 2 compatibility in code (:issue:`2950`)
By `Guido Imperiale <https://github.com/crusaderky>`_.
- Implement ``load_dataset()`` and ``load_dataarray()`` as alternatives to ``open_dataset()`` and
``open_dataarray()` to open, load into memory,
``open_dataarray()`` to open, load into memory,
and close files, returning the Dataset or DataArray. These functions are helpful
for avoiding file-lock errors when trying to write to files opened using ``open_dataset()`` or
for avoiding file-lock errors when trying to write to files opened using ``open_dataset()`` or
``open_dataarray()``. (:issue:`2887`)
By `Dan Nowacki <https://github.com/dnowacki-usgs>`_.

Expand Down
8 changes: 2 additions & 6 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ def load_dataset(filename_or_obj, **kwargs):
open_dataset
"""
if 'cache' in kwargs:
warnings.warn(
'The cache argument has no effect in this context.',
SerializationWarning, stacklevel=2)
raise TypeError('cache has no effect in this context')

with open_dataset(filename_or_obj, **kwargs) as ds:
return ds.load()
Expand All @@ -233,9 +231,7 @@ def load_dataarray(filename_or_obj, **kwargs):
open_dataarray
"""
if 'cache' in kwargs:
warnings.warn(
'The cache argument has no effect in this context.',
SerializationWarning, stacklevel=2)
raise TypeError('cache has no effect in this context')

with open_dataarray(filename_or_obj, **kwargs) as da:
return da.load()
Expand Down

0 comments on commit c609b69

Please sign in to comment.