Skip to content

Commit 932ec23

Browse files
philippemironPhilippe Mironmilancurcic
authored
docs: copy button (#255)
* update docs * lint * Add sphinx-copybutton to requirements.txt * Don't copy prompts characters --------- Co-authored-by: Philippe Miron <[email protected]> Co-authored-by: milancurcic <[email protected]>
1 parent 507f24d commit 932ec23

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

clouddrift/analysis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,13 @@ def chunk(
159159
[3, 4]])
160160
161161
To discard the starting elements of the array instead, use ``align="end"``:
162+
162163
>>> chunk([1, 2, 3, 4, 5], 2, align="end")
163164
array([[2, 3],
164165
[4, 5]])
165166
166167
To center the chunks by discarding both ends of the array, use ``align="middle"``:
168+
167169
>>> chunk([1, 2, 3, 4, 5, 6, 7, 8], 3, align="middle")
168170
array([[2, 3, 4],
169171
[5, 6, 7]])
@@ -350,6 +352,7 @@ def ragged_to_regular(
350352
[ 4., 5.]])
351353
352354
You can specify an alternative fill value:
355+
353356
>>> ragged_to_regular(np.array([1, 2, 3, 4, 5]), np.array([2, 1, 2]), fill_value=999)
354357
array([[ 1., 2.],
355358
[ 3., -999.],

clouddrift/sphere.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def cartesian_to_spherical(
518518
the point lon = 0, lat = 0. This function is inverted by `spherical_to_cartesian`.
519519
520520
Parameters
521-
-------
521+
----------
522522
x : np.ndarray
523523
x-coordinates in 3D.
524524
y : np.ndarray
@@ -527,7 +527,7 @@ def cartesian_to_spherical(
527527
z-coordinates in 3D.
528528
529529
Returns
530-
----------
530+
-------
531531
lon : np.ndarray
532532
An N-d array of longitudes in degrees in range [-180, 180].
533533
lat : np.ndarray

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"sphinx.ext.autosummary",
3636
"sphinx.ext.doctest",
3737
"sphinx.ext.inheritance_diagram",
38+
"sphinx_copybutton",
3839
]
3940

4041
# Add any paths that contain templates here, relative to this directory.
@@ -63,3 +64,6 @@
6364
"image_dark": "logo.png",
6465
}
6566
}
67+
68+
# sphinx-copybutton settings
69+
copybutton_exclude = ".linenos, .gp" # don't copy prompts or line numbers

docs/contributing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ We also welcome contributions to improving the documentation of the project. To
2525
.. code-block:: console
2626
2727
conda install sphinx
28-
pip install pydata-sphinx-theme
28+
pip install sphinx_book_theme
29+
pip install sphinx-copybutton
2930
3031
Then, from the ``clouddrift/docs`` directory, run
3132

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinx
22
sphinx-book-theme
3+
sphinx-copybutton

0 commit comments

Comments
 (0)