Skip to content

Commit 37342f3

Browse files
committed
Init reorg of docs for new notebooks
* Stop splitting notebooks into those that are rendered and those that are not. It requires remembering to render the notebooks for the docs separately. Now the docs notebooks are just symlinks to the notebooks in the `notebooks/` dir. * Update text/language around notebooks, and nest all notebooks under one section in the docs
1 parent e6de92c commit 37342f3

18 files changed

+210
-10095
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
docs/_build/
33
docs/api/
44

5+
# Icepyx-related
6+
.order_restart
7+
notebooks/.order_restart
8+
59
# Temporary local data store
610
downloaded-data/
711

docs/conf.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,26 @@
8080
always_document_param_types = True
8181

8282
nb_execution_mode = "off"
83+
84+
85+
def copy_notebook_images(app, _exception):
86+
"""Copy notebook static images into place post-build."""
87+
import shutil
88+
from pathlib import Path
89+
90+
source_dir = Path(app.srcdir) / ".." / "notebooks" / "img"
91+
dest_dir = Path(app.outdir) / "notebooks" / "img"
92+
93+
if dest_dir.exists():
94+
shutil.rmtree(dest_dir)
95+
96+
shutil.copytree(source_dir, dest_dir)
97+
98+
99+
def setup(app):
100+
"""Setup build-finished action to copy images into place.
101+
102+
Because the images are only referenced in jupyter notebooks, and not source
103+
files parsed directly by sphinx, the images will not be copied on their own.
104+
"""
105+
app.connect("build-finished", copy_notebook_images)

docs/contributing.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ jupyter lab
6161
```
6262

6363
Develop notebooks and confirm that they work as expected. Before committing
64-
changes, clear all outputs.
65-
66-
See below for information about adding rendered versions of notebooks to
67-
ReadTheDocs.
64+
changes, ensure all cells are evaluated so that outputs are populated. These
65+
notebooks are included in the docs and will be displayed on ReadTheDocs.
6866

6967
## Documentation
7068

@@ -82,6 +80,15 @@ live-reloading:
8280
inv docs.watch
8381
```
8482

83+
:::{note}
84+
85+
Most of the content included in the rendered docs come from the `docs/` dir, but
86+
some is sourced from outside of `docs/`. For example, the Jupyter Notebooks are
87+
sourced from the project's `notebooks/` directory via symlinks to
88+
`docs/notebooks`.
89+
90+
:::
91+
8592
The docs are generated and hosted by
8693
[ReadTheDocs](https://iceflow.readthedocs.io/en/latest/).
8794

@@ -90,15 +97,6 @@ Please review this carefully and ensure that any changes are accurately
9097
reflected. On a merge to main, changes to the documentation will be reflected on
9198
the main, public-facing documentation site.
9299

93-
> [!NOTE] Most of the documentation is designed to be generated automatically.
94-
> E.g., changes to the API and markdown documents will be automatically
95-
> refelcted in the documentation. The one exception are the jupyter notebooks
96-
> (e.g., `iceflow-example.ipynb`), which are static and must be re-generated
97-
> manually. Use the `invoke docs.render-notebooks-for-docs` task to re-generate
98-
> these files, and then commit any changes to the repository. See the
99-
> `notebooks/generate_rendered_notebooks_for_docs.sh` for how to add new
100-
> rendered notebooks to the docs.
101-
102100
## Releasing
103101

104102
To release a new version of the software, first update the CHANGELOG.md to
@@ -111,9 +109,11 @@ $ bump-my-version bump {major|minor|patch}
111109

112110
This will update files containing the software version number.
113111

114-
> [!WARNING]
115-
>
116-
> Please do not attempt to update version numbers by hand!
112+
:::{warning}
113+
114+
Please do not attempt to update version numbers by hand!
115+
116+
:::
117117

118118
Commit these changes and, once ready, merge them into `main` (through the use of
119119
a Pull Request on a feature branch). Tag the commit you want to release on

docs/getting-started.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,8 @@
33
## Jupyter Notebooks
44

55
[Jupyter notebooks](https://docs.jupyter.org/en/latest/) provide executable
6-
examples of how to use `iceflow`:
7-
8-
- [iceflow-example.ipynb](./iceflow-example.ipynb) provides an example of how to
9-
search for, download, and interact with `ILATM1B v1` data for a small area of
10-
interest. This notebook also illustrates how to perform
11-
[ITRF](https://itrf.ign.fr/) transformations to facilitate comparisons across
12-
datasets. To learn more about ITRF transformations, see the
13-
[corrections.ipynb](https://github.com/nsidc/NSIDC-Data-Tutorials/blob/main/notebooks/iceflow/corrections.ipynb)
14-
notebook in the
15-
[NSIDC-Data-Tutorials GitHub repository](https://github.com/nsidc/NSIDC-Data-Tutorials).
16-
17-
- [iceflow-with-icepyx.ipynb](./iceflow-with-icepyx.ipynb) shows how to search
18-
for, download, and interact with a large amount of data across many datasets
19-
supported by `iceflow`. It also illustrates how to utilize
20-
[icepyx](https://icepyx.readthedocs.io/en/latest/) to find and access ICESat-2
21-
data. Finally, the notebook provides a simple time-series analysis for
22-
elevation change over an area of interest across `iceflow` supported datasets
23-
and ICESat-2.
6+
examples of how to use `iceflow`. See [Jupyter Notebooks](./notebooks/index.md)
7+
for more information.
248

259
## API overview
2610

0 commit comments

Comments
 (0)