Skip to content

Update documentation to reflect removal of inplace option #3586

Closed
@monocongo

Description

@monocongo

MCVE Code Sample

# Your code here
ds_gamma.reset_coords('month', drop=True, inplace=True)

~/miniconda3/envs/spi_multi/lib/python3.8/site-packages/xarray/core/utils.py in _check_inplace(inplace)
     38 def _check_inplace(inplace: Optional[bool]) -> None:
     39     if inplace is not None:
---> 40         raise TypeError(
     41             "The `inplace` argument has been removed from xarray. "
     42             "You can achieve an identical effect with python's standard assignment."

TypeError: The `inplace` argument has been removed from xarray. You can achieve an identical effect with python's standard assignment.

Expected Output

Coordinates reset in-place, or documentation that does not list inplace as a valid argument.

Problem Description

The documentation for Dataset.reset_coords and Dataset.reset_coords lists an inplace argument that is no longer supported. My assumption is that this should be removed from the documentation but I'm not sure how this documentation is generated -- it may come from the docstring and/or function signature and the argument is still present in the function signature so it shows up in the documentation as a result?

This appears to have been addressed before in issue #858 but maybe the inplace argument slipped back into the documentation somehow? I see that there is a function to check for an inplace argument and raise an error if present -- why is this being used rather than removing the inplace argument altogether? Is this mechanism in place to facilitate backward compatibility, etc.?

Output of xr.show_versions()

# Paste the output here xr.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-70-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.1

xarray: 0.14.1
pandas: 0.25.3
numpy: 1.17.3
scipy: 1.3.2
netCDF4: 1.5.3
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.4.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.8.1
distributed: 2.8.1
matplotlib: 3.1.2
cartopy: None
seaborn: None
numbagg: None
setuptools: 42.0.1.post20191125
pip: 19.3.1
conda: None
pytest: None
IPython: 7.10.0
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions