Skip to content

Commit 5b2257e

Browse files
authored
link maintenance (#5182)
* remove private methods * create a API page for DataArray.str * fix a few more links * remove the API page for DataArray.str again * pin sphinx to a version lower than 4.0 this helps making the transition to sphinx>=4.0 (to be released soon) smoother * use the correct role for curve_fit * fix the link to normalize_chunks * fix more links and move BackendEntrypoint to the advanced API [skip-ci] * add a API page for set_close * explicitly document DataArray.str [skip-ci] * more docstring fixes [skip-ci]
1 parent e0358e5 commit 5b2257e

File tree

10 files changed

+46
-40
lines changed

10 files changed

+46
-40
lines changed

ci/requirements/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies:
3131
- sphinx-book-theme >= 0.0.38
3232
- sphinx-copybutton
3333
- sphinx-panels
34-
- sphinx>=3.3
34+
- sphinx<4
3535
- zarr>=2.4
3636
- pip:
3737
- sphinxext-rediraffe

doc/api-hidden.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,9 @@
826826
backends.DummyFileManager.acquire_context
827827
backends.DummyFileManager.close
828828

829-
backends.common.BackendArray
830-
backends.common.BackendEntrypoint
831-
backends.common.BackendEntrypoint.guess_can_open
832-
backends.common.BackendEntrypoint.open_dataset
829+
backends.BackendArray
830+
backends.BackendEntrypoint.guess_can_open
831+
backends.BackendEntrypoint.open_dataset
833832

834833
core.indexing.IndexingSupport
835834
core.indexing.explicit_indexing_adapter

doc/api.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,16 @@ Computation
420420
String manipulation
421421
-------------------
422422

423+
.. autosummary::
424+
:toctree: generated/
425+
:template: autosummary/accessor.rst
426+
427+
DataArray.str
428+
423429
.. autosummary::
424430
:toctree: generated/
425431
:template: autosummary/accessor_method.rst
426432

427-
DataArray.str._apply
428-
DataArray.str._padder
429-
DataArray.str._partitioner
430-
DataArray.str._re_compile
431-
DataArray.str._splitter
432-
DataArray.str._stringify
433433
DataArray.str.capitalize
434434
DataArray.str.casefold
435435
DataArray.str.cat
@@ -896,6 +896,9 @@ Advanced API
896896
as_variable
897897
register_dataset_accessor
898898
register_dataarray_accessor
899+
Dataset.set_close
900+
backends.BackendArray
901+
backends.BackendEntrypoint
899902

900903
These backends provide a low-level interface for lazily loading data from
901904
external file-formats or protocols, and can be manually invoked to create

doc/internals/how-to-add-new-backend.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ How to add a new backend
66
Adding a new backend for read support to Xarray does not require
77
to integrate any code in Xarray; all you need to do is:
88

9-
- Create a class that inherits from Xarray :py:class:`~xarray.backends.common.BackendEntrypoint`
9+
- Create a class that inherits from Xarray :py:class:`~xarray.backends.BackendEntrypoint`
1010
and implements the method ``open_dataset`` see :ref:`RST backend_entrypoint`
1111

1212
- Declare this class as an external plugin in your ``setup.py``, see :ref:`RST backend_registration`
@@ -161,8 +161,8 @@ guess_can_open
161161
``guess_can_open`` is used to identify the proper engine to open your data
162162
file automatically in case the engine is not specified explicitly. If you are
163163
not interested in supporting this feature, you can skip this step since
164-
:py:class:`~xarray.backends.common.BackendEntrypoint` already provides a
165-
default :py:meth:`~xarray.backend.common.BackendEntrypoint.guess_can_open`
164+
:py:class:`~xarray.backends.BackendEntrypoint` already provides a
165+
default :py:meth:`~xarray.backends.BackendEntrypoint.guess_can_open`
166166
that always returns ``False``.
167167

168168
Backend ``guess_can_open`` takes as input the ``filename_or_obj`` parameter of
@@ -299,7 +299,7 @@ Where:
299299
- :py:class:`~xarray.core.indexing.LazilyIndexedArray` is a class
300300
provided by Xarray that manages the lazy loading.
301301
- ``MyBackendArray`` shall be implemented by the backend and shall inherit
302-
from :py:class:`~xarray.backends.common.BackendArray`.
302+
from :py:class:`~xarray.backends.BackendArray`.
303303

304304
BackendArray subclassing
305305
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -455,5 +455,5 @@ In the first case Xarray uses the chunks size specified in
455455
``preferred_chunks``.
456456
In the second case Xarray accommodates ideal chunk sizes, preserving if
457457
possible the "preferred_chunks". The ideal chunk size is computed using
458-
:py:func:`dask.core.normalize_chunks`, setting
458+
:py:func:`dask.array.core.normalize_chunks`, setting
459459
``previous_chunks = preferred_chunks``.

doc/internals/zarr-encoding-spec.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. currentmodule:: xarray
12

23
.. _zarr_encoding:
34

doc/user-guide/computation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ Fitting arbitrary functions
451451
===========================
452452

453453
Xarray objects also provide an interface for fitting more complex functions using
454-
:py:meth:`scipy.optimize.curve_fit`. :py:meth:`~xarray.DataArray.curvefit` accepts
454+
:py:func:`scipy.optimize.curve_fit`. :py:meth:`~xarray.DataArray.curvefit` accepts
455455
user-defined functions and can fit along multiple coordinates.
456456

457457
For example, we can fit a relationship between two ``DataArray`` objects, maintaining

doc/user-guide/weather-climate.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. currentmodule:: xarray
2+
13
.. _weather-climate:
24

35
Weather and climate data

doc/whats-new.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ New Features
3737
- Many of the arguments for the :py:attr:`DataArray.str` methods now support
3838
providing an array-like input. In this case, the array provided to the
3939
arguments is broadcast against the original array and applied elementwise.
40-
- :py:attr:`DataArray.str` now supports `+`, `*`, and `%` operators. These
40+
- :py:attr:`DataArray.str` now supports ``+``, ``*``, and ``%`` operators. These
4141
behave the same as they do for :py:class:`str`, except that they follow
4242
array broadcasting rules.
4343
- A large number of new :py:attr:`DataArray.str` methods were implemented,
@@ -212,10 +212,10 @@ New Features
212212
By `Justus Magin <https://github.com/keewis>`_.
213213
- Allow installing from git archives (:pull:`4897`).
214214
By `Justus Magin <https://github.com/keewis>`_.
215-
- :py:class:`DataArrayCoarsen` and :py:class:`DatasetCoarsen` now implement a
216-
``reduce`` method, enabling coarsening operations with custom reduction
217-
functions (:issue:`3741`, :pull:`4939`). By `Spencer Clark
218-
<https://github.com/spencerkclark>`_.
215+
- :py:class:`~core.rolling.DataArrayCoarsen` and :py:class:`~core.rolling.DatasetCoarsen`
216+
now implement a ``reduce`` method, enabling coarsening operations with custom
217+
reduction functions (:issue:`3741`, :pull:`4939`).
218+
By `Spencer Clark <https://github.com/spencerkclark>`_.
219219
- Most rolling operations use significantly less memory. (:issue:`4325`).
220220
By `Deepak Cherian <https://github.com/dcherian>`_.
221221
- Add :py:meth:`Dataset.drop_isel` and :py:meth:`DataArray.drop_isel`
@@ -234,9 +234,8 @@ New Features
234234

235235
Bug fixes
236236
~~~~~~~~~
237-
- Use specific type checks in
238-
:py:func:`~xarray.core.variable.as_compatible_data` instead of blanket
239-
access to ``values`` attribute (:issue:`2097`)
237+
- Use specific type checks in ``xarray.core.variable.as_compatible_data`` instead of
238+
blanket access to ``values`` attribute (:issue:`2097`)
240239
By `Yunus Sevinchan <https://github.com/blsqr>`_.
241240
- :py:meth:`DataArray.resample` and :py:meth:`Dataset.resample` do not trigger
242241
computations anymore if :py:meth:`Dataset.weighted` or

xarray/core/dataarray.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,7 +4418,7 @@ def curvefit(
44184418
44194419
Parameters
44204420
----------
4421-
coords : DataArray, str or sequence of DataArray, str
4421+
coords : hashable, DataArray, or sequence of DataArray or hashable
44224422
Independent coordinate(s) over which to perform the curve fitting. Must share
44234423
at least one dimension with the calling object. When fitting multi-dimensional
44244424
functions, supply `coords` as a sequence in the same order as arguments in
@@ -4429,27 +4429,27 @@ def curvefit(
44294429
array of length `len(x)`. `params` are the fittable parameters which are optimized
44304430
by scipy curve_fit. `x` can also be specified as a sequence containing multiple
44314431
coordinates, e.g. `f((x0, x1), *params)`.
4432-
reduce_dims : str or sequence of str
4432+
reduce_dims : hashable or sequence of hashable
44334433
Additional dimension(s) over which to aggregate while fitting. For example,
44344434
calling `ds.curvefit(coords='time', reduce_dims=['lat', 'lon'], ...)` will
44354435
aggregate all lat and lon points and fit the specified function along the
44364436
time dimension.
44374437
skipna : bool, optional
44384438
Whether to skip missing values when fitting. Default is True.
4439-
p0 : dictionary, optional
4439+
p0 : dict-like, optional
44404440
Optional dictionary of parameter names to initial guesses passed to the
44414441
`curve_fit` `p0` arg. If none or only some parameters are passed, the rest will
44424442
be assigned initial values following the default scipy behavior.
4443-
bounds : dictionary, optional
4443+
bounds : dict-like, optional
44444444
Optional dictionary of parameter names to bounding values passed to the
44454445
`curve_fit` `bounds` arg. If none or only some parameters are passed, the rest
44464446
will be unbounded following the default scipy behavior.
4447-
param_names : seq, optional
4447+
param_names : sequence of hashable, optional
44484448
Sequence of names for the fittable parameters of `func`. If not supplied,
44494449
this will be automatically determined by arguments of `func`. `param_names`
44504450
should be manually supplied when fitting a function that takes a variable
44514451
number of parameters.
4452-
kwargs : dictionary
4452+
**kwargs : optional
44534453
Additional keyword arguments to passed to scipy curve_fit.
44544454
44554455
Returns

xarray/core/dataset.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5513,9 +5513,11 @@ def diff(self, dim, n=1, label="upper"):
55135513
-------
55145514
difference : same type as caller
55155515
The n-th order finite difference of this object.
5516-
.. note::
5517-
`n` matches numpy's behavior and is different from pandas' first
5518-
argument named `periods`.
5516+
5517+
Notes
5518+
-----
5519+
`n` matches numpy's behavior and is different from pandas' first argument named
5520+
`periods`.
55195521
55205522
Examples
55215523
--------
@@ -7137,7 +7139,7 @@ def curvefit(
71377139
71387140
Parameters
71397141
----------
7140-
coords : DataArray, str or sequence of DataArray, str
7142+
coords : hashable, DataArray, or sequence of hashable or DataArray
71417143
Independent coordinate(s) over which to perform the curve fitting. Must share
71427144
at least one dimension with the calling object. When fitting multi-dimensional
71437145
functions, supply `coords` as a sequence in the same order as arguments in
@@ -7148,27 +7150,27 @@ def curvefit(
71487150
array of length `len(x)`. `params` are the fittable parameters which are optimized
71497151
by scipy curve_fit. `x` can also be specified as a sequence containing multiple
71507152
coordinates, e.g. `f((x0, x1), *params)`.
7151-
reduce_dims : str or sequence of str
7153+
reduce_dims : hashable or sequence of hashable
71527154
Additional dimension(s) over which to aggregate while fitting. For example,
71537155
calling `ds.curvefit(coords='time', reduce_dims=['lat', 'lon'], ...)` will
71547156
aggregate all lat and lon points and fit the specified function along the
71557157
time dimension.
71567158
skipna : bool, optional
71577159
Whether to skip missing values when fitting. Default is True.
7158-
p0 : dictionary, optional
7160+
p0 : dict-like, optional
71597161
Optional dictionary of parameter names to initial guesses passed to the
71607162
`curve_fit` `p0` arg. If none or only some parameters are passed, the rest will
71617163
be assigned initial values following the default scipy behavior.
7162-
bounds : dictionary, optional
7164+
bounds : dict-like, optional
71637165
Optional dictionary of parameter names to bounding values passed to the
71647166
`curve_fit` `bounds` arg. If none or only some parameters are passed, the rest
71657167
will be unbounded following the default scipy behavior.
7166-
param_names : seq, optional
7168+
param_names : sequence of hashable, optional
71677169
Sequence of names for the fittable parameters of `func`. If not supplied,
71687170
this will be automatically determined by arguments of `func`. `param_names`
71697171
should be manually supplied when fitting a function that takes a variable
71707172
number of parameters.
7171-
kwargs : dictionary
7173+
**kwargs : optional
71727174
Additional keyword arguments to passed to scipy curve_fit.
71737175
71747176
Returns

0 commit comments

Comments
 (0)