Skip to content

Commit 0209ef8

Browse files
committed
Updates to docstrings and notebooks to improve documentation rendering with sphinx
1 parent 146e7f9 commit 0209ef8

File tree

10 files changed

+84
-68
lines changed

10 files changed

+84
-68
lines changed

notebooks/data/Basic_Indexing.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"tags": []
5252
},
5353
"source": [
54-
"# DataIndexes\n",
54+
"## DataIndexes\n",
5555
"One of the base classes of `pyearthtools.data` is the `DataIndex`, which provides a unified interface to accessing data, and common data retrieval techniques.\n",
5656
"\n",
5757
"As of the writing of this notebook, the following data sources have been implemented:\n",
@@ -513,7 +513,7 @@
513513
"id": "75e60268-5ccd-4ef8-87d7-6f1b02139a86",
514514
"metadata": {},
515515
"source": [
516-
"#### Data Loading\n",
516+
"## Data Loading\n",
517517
"Using the `search` function allows retrieval of the filepaths to each requested variable at a given time.\n",
518518
"\n",
519519
"From this, the data can be automatically loaded simply by calling the DataIndex with a date, which provides a couple of useful features, which will be explored in later notebooks. "
@@ -1143,7 +1143,7 @@
11431143
"name": "python",
11441144
"nbconvert_exporter": "python",
11451145
"pygments_lexer": "ipython3",
1146-
"version": "3.11.7"
1146+
"version": "3.13.2"
11471147
},
11481148
"vscode": {
11491149
"interpreter": {

notebooks/tutorial/HadISD/1_HadISD_Download.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": null,
24+
"execution_count": 1,
2525
"id": "e4fb7b1d",
2626
"metadata": {},
2727
"outputs": [],
@@ -231,9 +231,9 @@
231231
],
232232
"metadata": {
233233
"kernelspec": {
234-
"display_name": "pyearthtools",
234+
"display_name": "Python 3 (ipykernel)",
235235
"language": "python",
236-
"name": "pyearthtools"
236+
"name": "python3"
237237
},
238238
"language_info": {
239239
"codemirror_mode": {
@@ -245,7 +245,7 @@
245245
"name": "python",
246246
"nbconvert_exporter": "python",
247247
"pygments_lexer": "ipython3",
248-
"version": "3.13.5"
248+
"version": "3.13.2"
249249
}
250250
},
251251
"nbformat": 4,

notebooks/tutorial/HadISD/2_HadISD_to_zarr.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"id": "55a84e6e",
77
"metadata": {},
88
"outputs": [],
@@ -298,9 +298,9 @@
298298
],
299299
"metadata": {
300300
"kernelspec": {
301-
"display_name": "pyearthtools",
301+
"display_name": "Python 3 (ipykernel)",
302302
"language": "python",
303-
"name": "pyearthtools"
303+
"name": "python3"
304304
},
305305
"language_info": {
306306
"codemirror_mode": {
@@ -312,7 +312,7 @@
312312
"name": "python",
313313
"nbconvert_exporter": "python",
314314
"pygments_lexer": "ipython3",
315-
"version": "3.13.5"
315+
"version": "3.13.2"
316316
}
317317
},
318318
"nbformat": 4,

notebooks/tutorial/HadISD/3_HadISD_XGBoost_Pipeline.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": null,
17+
"execution_count": 1,
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
@@ -241,7 +241,7 @@
241241
],
242242
"metadata": {
243243
"kernelspec": {
244-
"display_name": "pet_tutorial",
244+
"display_name": "Python 3 (ipykernel)",
245245
"language": "python",
246246
"name": "python3"
247247
},
@@ -255,9 +255,9 @@
255255
"name": "python",
256256
"nbconvert_exporter": "python",
257257
"pygments_lexer": "ipython3",
258-
"version": "3.11.11"
258+
"version": "3.13.2"
259259
}
260260
},
261261
"nbformat": 4,
262-
"nbformat_minor": 2
262+
"nbformat_minor": 4
263263
}

notebooks/tutorial/HadISD/Data_Config.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": null,
25+
"execution_count": 1,
2626
"id": "c0c7c48d",
2727
"metadata": {},
2828
"outputs": [],
@@ -104,8 +104,22 @@
104104
}
105105
],
106106
"metadata": {
107+
"kernelspec": {
108+
"display_name": "Python 3 (ipykernel)",
109+
"language": "python",
110+
"name": "python3"
111+
},
107112
"language_info": {
108-
"name": "python"
113+
"codemirror_mode": {
114+
"name": "ipython",
115+
"version": 3
116+
},
117+
"file_extension": ".py",
118+
"mimetype": "text/x-python",
119+
"name": "python",
120+
"nbconvert_exporter": "python",
121+
"pygments_lexer": "ipython3",
122+
"version": "3.13.2"
109123
}
110124
},
111125
"nbformat": 4,

notebooks/tutorial/HadISD/HadISD_QC_Exploration.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
},
2828
{
2929
"cell_type": "code",
30-
"execution_count": null,
30+
"execution_count": 16,
3131
"id": "4a7da841",
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [
35-
"%run HadISD_config.ipynb"
35+
"# %run HadISD_config.ipynb"
3636
]
3737
},
3838
{
@@ -226,7 +226,7 @@
226226
],
227227
"metadata": {
228228
"kernelspec": {
229-
"display_name": "pet_tutorial",
229+
"display_name": "Python 3 (ipykernel)",
230230
"language": "python",
231231
"name": "python3"
232232
},
@@ -240,7 +240,7 @@
240240
"name": "python",
241241
"nbconvert_exporter": "python",
242242
"pygments_lexer": "ipython3",
243-
"version": "3.11.11"
243+
"version": "3.13.2"
244244
}
245245
},
246246
"nbformat": 4,

notebooks/tutorial/HadISD/Pipeline_Config.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"id": "1abab3c3",
77
"metadata": {},
88
"outputs": [],
@@ -374,8 +374,22 @@
374374
}
375375
],
376376
"metadata": {
377+
"kernelspec": {
378+
"display_name": "Python 3 (ipykernel)",
379+
"language": "python",
380+
"name": "python3"
381+
},
377382
"language_info": {
378-
"name": "python"
383+
"codemirror_mode": {
384+
"name": "ipython",
385+
"version": 3
386+
},
387+
"file_extension": ".py",
388+
"mimetype": "text/x-python",
389+
"name": "python",
390+
"nbconvert_exporter": "python",
391+
"pygments_lexer": "ipython3",
392+
"version": "3.13.2"
379393
}
380394
},
381395
"nbformat": 4,

notebooks/tutorial/HadISD_Dataset_Integration.ipynb

Whitespace-only changes.

packages/zoo/src/pyearthtools/zoo/model.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,44 +100,35 @@ class BaseForecastModel:
100100
## Config Folder
101101
The config folder for a model can use the following conventions to ease in setup
102102
103-
```txt
104-
`Data/`
105-
- Location for all data loaders
106-
`Pipeline/`
107-
- Location for all pipelines
108-
```
103+
`Data/` - Location for all data loaders
104+
`Pipeline/` - Location for all pipelines
109105
110106
It is assumed that most data configs will have a pipeline name identically to them for
111107
loading and preparing the data, however, the following exception applies.
112-
If a `Data` config has a `()`, with a str inside, it represents a different data source,
113-
but the same pipeline,
114-
this is can be useful for setting by different sources of the same data, link for downloading,
115-
archived data or experiments.
108+
If a `Data` config has a `()`, with a str inside, it represents a different data source, but the same pipeline,
109+
this is can be useful for setting by different sources of the same data, link for downloading, archived data or experiments.
116110
117111
Additionally, any data with a `-` represents an ancillary source, i.e. forcings and will not be included
118-
in the available data sources.
119-
Any text prior to the `-` represents the parent source and any after is it's purpose.
112+
in the available data sources. Any text prior to the `-` represents the parent source and any after is it's purpose.
120113
121114
Getting `ancillary_pipeline` will give back a dictionary of ancillary pipelines associated with the chosen source.
122115
123116
When creating a model subclass set `_default_config_path` to the default path.
124117
125118
A user can provide a `config_path` during `__init__` to allow access to user defined configs.
126119
This allows experiments to be easily run, and will follow the conventions outlined above.
127-
i.e. Providing a data config with '()' will use the base pipeline.
120+
i.e. Providing a data config with `()` will use the base pipeline.
128121
129122
### Examples
130123
Consider the following structure.
131124
132-
```txt
133-
├── Data
134-
│ ├── ERA5-Forcings.yaml
135-
│ ├── ERA5(cds)-Forcings.yaml
136-
│ ├── ERA5(cds).yaml
137-
│ └── ERA5.yaml
138-
└── Pipeline
139-
└── ERA5.yaml
140-
```
125+
>>> ├── Data
126+
>>> │ ├── ERA5-Forcings.yaml
127+
>>> │ ├── ERA5(cds)-Forcings.yaml
128+
>>> │ ├── ERA5(cds).yaml
129+
>>> │ └── ERA5.yaml
130+
>>> └── Pipeline
131+
>>> └── ERA5.yaml
141132
142133
A user can request either `ERA5` or `ERA5(cds)` as the data source, these two sources are then loaded and use
143134
`Pipeline/ERA5.yaml` as it's pipeline.

packages/zoo/src/pyearthtools/zoo/utils.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ class CategorisedObjects:
5151
Key's must be hashable, just like a dictionary.
5252
5353
Examples:
54-
```python
55-
record = CategorisedObjects('Example', category_1 = {'sub_cat': 10})
56-
record.category_1
57-
─┬ category_1 ──
58-
└──sub_cat
59-
```
54+
55+
>>> record = CategorisedObjects('Example', category_1 = {'sub_cat': 10})
56+
>>> record.category_1
57+
>>> ─┬ category_1 ──
58+
>>> └──sub_cat
59+
6060
## Parsing
61-
Overriding `_parse` allows custom classes to be parsed when retrieved.
6261
62+
Overriding `_parse` allows custom classes to be parsed when retrieved.
6363
Overriding `_name` allows custom classes names to be retrieved when displaying what is available.
6464
"""
6565

@@ -290,16 +290,16 @@ class AvailableModels(CategorisedObjects):
290290
Categorise with these entry points by seperating layers with `_`.
291291
292292
Examples:
293-
```python
294-
# Entrypoints
295-
# NESM_modelNAME
296-
AvailableModels()
297-
─┬ Available Models ──
298-
└─┬ NESM ──
299-
└──modelNAME
300-
```
293+
294+
>>> # Entrypoints
295+
>>> # NESM_modelNAME
296+
>>> AvailableModels()
297+
>>> ─┬ Available Models ──
298+
>>> └─┬ NESM ──
299+
>>> └──modelNAME
300+
301301
Can retrieve model by getting attibute one layer at a time,
302-
or by `getattr(self, 'NESM/modelNAME'), or if last name is unique, that name alone.
302+
or by `getattr(self, 'NESM/modelNAME')`, or if last name is unique, that name alone.
303303
304304
If `NESM/Model` exists within the AvailableModels, it can be retrieved in the following way,
305305
```python
@@ -570,19 +570,16 @@ def get_arguments(function: Callable) -> tuple[dict[str, Any], dict[str, Any]]:
570570

571571

572572
class TabCompleter:
573-
# From https://gist.github.com/iamatypeofwalrus/5637895
574573
"""
575-
A tab completer that can either complete from
576-
the filesystem or from a list.
577-
578-
Partially taken from:
579-
http://stackoverflow.com/questions/5637124/tab-completion-in-pythons-raw-input
574+
A tab completer that can either complete from the filesystem or from a list.
580575
"""
576+
# Partially taken from http://stackoverflow.com/questions/5637124/tab-completion-in-pythons-raw-input
577+
# From https://gist.github.com/iamatypeofwalrus/5637895
581578

582579
def path_completer(self, text, state):
583580
"""
584581
This is the tab completer for systems paths.
585-
Only tested on *nix systems
582+
Only tested on Linux systems
586583
"""
587584
_ = readline.get_line_buffer().split()
588585

0 commit comments

Comments
 (0)