Skip to content

Commit b90a605

Browse files
committed
fix intersphinx config, use intersphinx to fix broken links in comp patterns
1 parent 10f3e71 commit b90a605

File tree

2 files changed

+57
-60
lines changed

2 files changed

+57
-60
lines changed

_config.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ sphinx:
9191

9292
intersphinx_mapping:
9393
xarray:
94-
- https://docs.xarray.dev/en/latest/
94+
- https://docs.xarray.dev/en/stable
9595
- null
9696
numpy:
9797
- https://numpy.org/doc/stable
9898
- null
99+
pandas:
100+
- https://pandas.pydata.org/docs
101+
- null
99102
scipy:
100103
- https://docs.scipy.org/doc/scipy
101104
- null
102-
matplotlib:
103-
- https://matplotlib.org/stable/
105+
python:
106+
- https://docs.python.org/3
104107
- null
105108
dask:
106-
- https://docs.dask.org/en/latest
109+
- https://docs.dask.org/en/stable
107110
- null
108-
python:
109-
- https://docs.python.org/3/
110-
- null
111-
pandas:
112-
- https://pandas.pydata.org/pandas-docs/stable
111+
matplotlib:
112+
- https://matplotlib.org/stable
113113
- null

intermediate/01-high-level-computation-patterns.ipynb

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@
7979
"\n",
8080
"Xarray provides methods for high-level analysis patterns:\n",
8181
"\n",
82-
"1. `rolling` :\n",
83-
" [Operate on rolling or sliding (fixed length, overlapping) windows of your data e.g. running mean.](https://docs.xarray.dev/en/stable/user-guide/computation.html#rolling-window-operations)\n",
84-
"1. `coarsen` :\n",
85-
" [Operate on blocks (fixed length) of your data (downsample).](https://docs.xarray.dev/en/stable/user-guide/computation.html#coarsen-large-arrays)\n",
86-
"1. `groupby` :\n",
87-
" [Parse data into groups (using an exact value) and operate on each one (reduce data).](https://docs.xarray.dev/en/stable/groupby.html)\n",
88-
"1. `groupby_bins`: [GroupBy after discretizing a numeric (non-exact, e.g. float) variable.](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.groupby_bins.html)\n",
89-
"1. `resample` :\n",
90-
" [Groupby specialized for time axes. Either downsample or upsample your data.](https://docs.xarray.dev/en/stable/user-guide/time-series.html#resampling-and-grouped-operations)\n",
91-
"1. `weighted`: [Weight your data before reducing.](https://docs.xarray.dev/en/stable/user-guide/computation.html#weighted-array-reductions) \n",
82+
"1. [`rolling`](<inv:xarray#*rolling-window-operations>) :\n",
83+
" Operate on rolling or sliding (fixed length, overlapping) windows of your data e.g. running mean.\n",
84+
"1. [`coarsen`](<inv:xarray#*coarsen-large-arrays>) :\n",
85+
" Operate on blocks (fixed length) of your data (downsample).\n",
86+
"1. [`groupby`](<inv:xarray:py:method:#*.DataArray.groupby>) :\n",
87+
" Parse data into groups (using an exact value) and operate on each one (reduce data).\n",
88+
"1. [`groupby_bins`](<inv:xarray:py:method:#*.DataArray.groupby_bins>): GroupBy after discretizing a numeric (non-exact, e.g. float) variable.\n",
89+
"1. [`resample`](<inv:xarray#*resampling-and-grouped-operations>) :\n",
90+
" [Groupby specialized for time axes. Either downsample or upsample your data.]\n",
91+
"1. [`weighted`](<inv:xarray#*weighted-array-reductions>): Weight your data before reducing.\n",
9292
"\n",
9393
"\n",
9494
"```{note}\n",
@@ -352,21 +352,21 @@
352352
"\n",
353353
"These are sequential windowed operations with a window of a fixed size.\n",
354354
"\n",
355-
"1. `rolling` :\n",
356-
" [Operate on rolling or sliding (fixed length, overlapping) windows of your data e.g. running mean.](https://docs.xarray.dev/en/stable/user-guide/computation.html#rolling-window-operations)\n",
357-
"1. `coarsen` :\n",
358-
" [Operate on blocks (fixed length) of your data (downsample).](https://docs.xarray.dev/en/stable/user-guide/computation.html#coarsen-large-arrays)\n",
355+
"1. [`rolling`](<inv:xarray#*rolling-window-operations>) :\n",
356+
" Operate on rolling or sliding (fixed length, overlapping) windows of your data e.g. running mean.\n",
357+
"1. [`coarsen`](<inv:xarray#*coarsen-large-arrays>) :\n",
358+
" Operate on blocks (fixed length) of your data (downsample).\n",
359359
"\n",
360360
"\n",
361361
"### Label space\n",
362362
"\n",
363363
"These are windowed operations with irregular windows based on your data. Members of a single group may be non-sequential and scattered through the dataset.\n",
364364
"\n",
365-
"1. `groupby` :\n",
366-
" [Parse data into groups (using an exact value) and operate on each one (reduce data).](https://docs.xarray.dev/en/stable/groupby.html)\n",
367-
"1. `groupby_bins`: [GroupBy after discretizing a numeric (non-exact, e.g. float) variable.](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.groupby_bins.html)\n",
368-
"1. `resample` :\n",
369-
" [Groupby specialized for time axes. Either downsample or upsample your data.](https://docs.xarray.dev/en/stable/user-guide/time-series.html#resampling-and-grouped-operations)\n"
365+
"1. [`groupby`](<inv:xarray:py:method:#*.DataArray.groupby>) :\n",
366+
" Parse data into groups (using an exact value) and operate on each one (reduce data).\n",
367+
"1. [`groupby_bins`](<inv:xarray:py:method:#*.DataArray.groupby_bins> ): GroupBy after discretizing a numeric (non-exact, e.g. float) variable.\n",
368+
"1. [`resample`](<inv:xarray#*resampling-and-grouped-operations>) :\n",
369+
" Groupby specialized for time axes. Either downsample or upsample your data.\n"
370370
]
371371
},
372372
{
@@ -385,7 +385,7 @@
385385
"\n",
386386
"## Index space: windows of fixed width\n",
387387
"\n",
388-
"### Sliding windows of fixed length: [`rolling`](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.rolling.html)\n",
388+
"### Sliding windows of fixed length: [`rolling`](<inv:xarray:py:method:#*.DataArray.rolling>)\n",
389389
"\n",
390390
"- Supports common reductions : `sum`, `mean`, `count`, `std`, `var` etc.\n",
391391
"- Returns object of same shape as input\n",
@@ -435,11 +435,11 @@
435435
"source": [
436436
"#### Apply an existing numpy-only function with `reduce`\n",
437437
"\n",
438-
"In some cases, we may want to apply a sliding window function using rolling that is not built in to Xarray. In these cases we can still leverage the sliding windows of rolling and apply our own function with [`reduce`](https://docs.xarray.dev/en/stable/generated/xarray.core.rolling.DataArrayRolling.reduce.html).\n",
438+
"In some cases, we may want to apply a sliding window function using rolling that is not built in to Xarray. In these cases we can still leverage the sliding windows of rolling and apply our own function with [`reduce`](<inv:xarray:py:method:#*.DataArrayRolling.reduce>).\n",
439439
"\n",
440440
"The `reduce` method on Xarray objects (e.g. DataArray, Dataset) expects a function that can *receive and return plain arrays (e.g. numpy)*, as in each of the \"windows\" provided by the rolling iterator. This is in contrast to the `map` method on DataArray and Dataset objects, which expects a function that can receive and return Xarray objects.\n",
441441
"\n",
442-
"Here's an example function: [`np.ptp`](https://numpy.org/doc/stable/reference/generated/numpy.ptp.html).\n"
442+
"Here's an example function: [`np.ptp`](<inv:numpy:py:function:#*numpy.ptp>).\n"
443443
]
444444
},
445445
{
@@ -461,7 +461,7 @@
461461
":class: tip\n",
462462
"\n",
463463
"Calculate the rolling mean in 5 point bins along both latitude and longitude using\n",
464-
"[`rolling(...).reduce`](https://docs.xarray.dev/en/stable/generated/xarray.core.rolling.DataArrayRolling.reduce.html)\n",
464+
"[`rolling(...).reduce`](<inv:xarray:py:method:#*.DataArrayRolling.reduce>)\n",
465465
"\n",
466466
":::{admonition} Solution\n",
467467
":class: dropdown\n",
@@ -486,7 +486,7 @@
486486
"source": [
487487
"#### View the `rolling` operation as a Xarray object with `construct`\n",
488488
"\n",
489-
"In the above examples, we plotted the outputs of our rolling operations. Xarray makes it easy to integrate the outputs from `rolling` directly into the DataArray using the [`construct`](https://docs.xarray.dev/en/stable/generated/xarray.core.rolling.DataArrayRolling.construct.html#xarray.core.rolling.DataArrayRolling.construct) method."
489+
"In the above examples, we plotted the outputs of our rolling operations. Xarray makes it easy to integrate the outputs from `rolling` directly into the DataArray using the <inv:xarray:py:method:#*.DataArrayRolling.construct> method.\n"
490490
]
491491
},
492492
{
@@ -588,7 +588,7 @@
588588
"\n",
589589
"### Block windows of fixed length: `coarsen`\n",
590590
"\n",
591-
"For non-overlapping windows or \"blocks\" use [`coarsen`](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.coarsen.html). The syntax is very similar to `rolling`. You will need to specify how you want Xarray to handle the `boundary` if the length of the dimension is not a multiple of the block size.\n",
591+
"For non-overlapping windows or \"blocks\" use [`coarsen`](<inv:xarray:py:method:#*.DataArray.coarsen>). The syntax is very similar to `rolling`. You will need to specify how you want Xarray to handle the `boundary` if the length of the dimension is not a multiple of the block size.\n",
592592
"\n",
593593
"\n",
594594
"- Supports common reductions : `sum`, `mean`, `count`, `std`, `var` etc.\n",
@@ -759,7 +759,7 @@
759759
"metadata": {},
760760
"source": [
761761
"Note that `coarsen` pads with NaNs. For more control over padding, use\n",
762-
"[DataArray.pad](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.pad.html) explicitly."
762+
"[DataArray.pad](<inv:xarray:py:method:#*.DataArray.pad>) explicitly."
763763
]
764764
},
765765
{
@@ -910,8 +910,7 @@
910910
"1. *Combine* : concatenate results from apply step along a new \"group\" dimension\n",
911911
"\n",
912912
"illustrated in this neat schematic from [Project Pythia](https://foundations.projectpythia.org/core/xarray/computation-masking.html#groupby-split-apply-combine):\n",
913-
"<img src=\"https://foundations.projectpythia.org/_images/xarray-split-apply-combine.jpeg\" width=30%>\n",
914-
"\n",
913+
"<img src=\"https://raw.githubusercontent.com/ProjectPythia/pythia-foundations/refs/heads/main/core/xarray/images/xarray-split-apply-combine.jpeg\" width=30%>\n",
915914
"\n",
916915
"But really there is a \"hidden\" first step: *identifying* groups (also called \"factorization\" or sometimes \"binning\"). Usually this is the hard part.\n",
917916
"\n",
@@ -1036,23 +1035,22 @@
10361035
"\n",
10371036
"If the automatic group detection doesn't work for your problem then these functions are useful for constructing specific \"group labels\" in many cases\n",
10381037
"\n",
1039-
"1. [numpy.digitize](https://numpy.org/doc/stable/reference/generated/numpy.digitize.html)\n",
1038+
"1. [numpy.digitize](<inv:numpy:py:function:#*numpy.digitize>)\n",
10401039
" for binning\n",
1041-
"1. [numpy.searchsorted](https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html)\n",
1040+
"1. [numpy.searchsorted](<inv:numpy:py:function:#*numpy.searchsorted>)\n",
10421041
" supports many other data types\n",
1043-
"1. [pandas.factorize](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.factorize.html)\n",
1042+
"1. [pandas.factorize](<inv:pandas:py:function:#*pandas.factorize>)\n",
10441043
" supports characters, strings etc.\n",
1045-
"1. [pandas.cut](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.cut.html)\n",
1044+
"1. [pandas.cut](<inv:pandas:py:function:#*pandas.cut>)\n",
10461045
" for binning\n",
1047-
"1. [\"Datetime components\"](https://docs.xarray.dev/en/stable/user-guide/time-series.html#datetime-components) of Xarray DataArrays\n",
1048-
"1. [DataArray.isin](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.isin.html)\n",
1049-
"1. [scipy.ndimage.label](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.label.html)\n",
1046+
"1. [\"Datetime components\"](<inv:xarray#*indexing-using-datetime-components>) of Xarray DataArrays\n",
1047+
"1. [DataArray.isin](<inv:xarray:py:method:#*.DataArray.isin>)\n",
1048+
"1. [scipy.ndimage.label](<inv:scipy:py:function:#*scipy.ndimage.label>)\n",
10501049
"1. Do you know of any more? (Send in a pull request to update this list!)\n",
10511050
"\n",
10521051
"\n",
1053-
"\n",
10541052
"```{tip}\n",
1055-
"Xarray uses [`pandas.factorize`](https://pandas.pydata.org/docs/reference/api/pandas.factorize.html) for `groupby` and [`pandas.cut`](https://pandas.pydata.org/docs/reference/api/pandas.cut.html) for `groupby_bins`.\n",
1053+
"Xarray uses `pandas.factorize` for `groupby` and `pandas.cut` for `groupby_bins`.\n",
10561054
"```"
10571055
]
10581056
},
@@ -1066,10 +1064,9 @@
10661064
"tags": []
10671065
},
10681066
"source": [
1069-
"#### [\"Datetime components\"](https://docs.xarray.dev/en/stable/user-guide/time-series.html#datetime-components) for creating groups\n",
1067+
"#### \"Datetime components\" for creating groups\n",
10701068
"\n",
1071-
"See a full list\n",
1072-
"[here](https://docs.xarray.dev/en/stable/generated/xarray.core.accessor_dt.DatetimeAccessor.html?highlight=DatetimeAccessor)\n",
1069+
"See a full list [here](<inv:xarray:py:class#*DatetimeAccessor>)\n",
10731070
"\n",
10741071
"These can be accessed in a few different ways as illustrated below.\n"
10751072
]
@@ -1229,7 +1226,7 @@
12291226
"source": [
12301227
"##### `floor`, `ceil` and `round` on time\n",
12311228
"\n",
1232-
"Additional functionality in the [datetime accessor](https://docs.xarray.dev/en/stable/generated/xarray.core.accessor_dt.DatetimeAccessor.html) allows us to effectively \"resample\" our time data to remove roundoff errors in timestamps.\n"
1229+
"Additional functionality in the [datetime accessor](<inv:xarray:py:class#*DatetimeAccessor>) allows us to effectively \"resample\" our time data to remove roundoff errors in timestamps.\n"
12331230
]
12341231
},
12351232
{
@@ -1449,16 +1446,16 @@
14491446
"\n",
14501447
"Xarray provides methods for high-level analysis patterns:\n",
14511448
"\n",
1452-
"1. `rolling` :\n",
1453-
" [Operate on rolling (fixed length, overlapping) windows of your data e.g. running mean.](https://docs.xarray.dev/en/stable/user-guide/computation.html#rolling-window-operations)\n",
1454-
"1. `coarsen` :\n",
1455-
" [Operate on blocks (fixed length) of your data (downsample).](https://docs.xarray.dev/en/stable/user-guide/computation.html#coarsen-large-arrays)\n",
1456-
"1. `groupby` :\n",
1457-
" [Parse data into groups (using an exact value) and operate on each one (reduce data).](https://docs.xarray.dev/en/stable/groupby.html)\n",
1458-
"1. `groupby_bins`: [GroupBy after discretizing a numeric (non-exact, e.g. float) variable.](https://docs.xarray.dev/en/stable/generated/xarray.DataArray.groupby_bins.html)\n",
1459-
"1. `resample` :\n",
1460-
" [Groupby specialized for time axes. Either downsample or upsample your data.](https://docs.xarray.dev/en/stable/user-guide/time-series.html#resampling-and-grouped-operations)\n",
1461-
"1. `weighted`: [Weight your data before reducing.](https://docs.xarray.dev/en/stable/user-guide/computation.html#weighted-array-reductions)\n",
1449+
"1. [`rolling`](<inv:xarray#*rolling-window-operations>) :\n",
1450+
" Operate on rolling or sliding (fixed length, overlapping) windows of your data e.g. running mean.\n",
1451+
"1. [`coarsen`](<inv:xarray#*coarsen-large-arrays>) :\n",
1452+
" Operate on blocks (fixed length) of your data (downsample).\n",
1453+
"1. [`groupby`](<inv:xarray:py:method:#*.DataArray.groupby>) :\n",
1454+
" Parse data into groups (using an exact value) and operate on each one (reduce data).\n",
1455+
"1. [`groupby_bins`](<inv:xarray:py:method:#*.DataArray.groupby_bins>): GroupBy after discretizing a numeric (non-exact, e.g. float) variable.\n",
1456+
"1. [`resample`](<inv:xarray#*resampling-and-grouped-operations>) :\n",
1457+
" [Groupby specialized for time axes. Either downsample or upsample your data.]\n",
1458+
"1. [`weighted`](<inv:xarray#*weighted-array-reductions>): Weight your data before reducing.\n",
14621459
"\n",
14631460
"Xarray also provides a consistent interface to make using those patterns easy:\n",
14641461
"\n",

0 commit comments

Comments
 (0)