Skip to content

Commit 8ea6645

Browse files
committed
[JTH] add more docs to new sphinx documentation
1 parent eefb286 commit 8ea6645

File tree

9 files changed

+165
-6
lines changed

9 files changed

+165
-6
lines changed

bluemath_tk/interpolation/rbf.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class RBF(BaseInterpolation):
162162
)
163163
164164
rbf = RBF()
165+
165166
predictions = rbf.fit_predict(
166167
subset_data=subset,
167168
subset_directional_variables=["Dir"],
@@ -172,11 +173,7 @@ class RBF(BaseInterpolation):
172173
num_workers=4,
173174
iteratively_update_sigma=True,
174175
)
175-
176-
rbf.get_metrics(
177-
data1=target,
178-
data2=predictions.drop(columns=["DirPred_u", "DirPred_v"], inplace=False),
179-
)
176+
print(predictions.head())
180177
181178
References
182179
----------
62.5 KB
Loading

docs/source/_static/sketch_tk.png

494 KB
Loading

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"sphinx.ext.napoleon",
2020
"sphinx.ext.doctest",
2121
"jupyter_sphinx",
22+
"myst_parser",
2223
]
2324

2425
templates_path = ["_templates"]

docs/source/contribute.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Contributions
2+
3+
Thank you for considering contributing to the BlueMath package! We welcome contributions from the community and are grateful for your support.
4+
5+
## How to Contribute
6+
7+
### 1. Fork the Repository (skip if you are GeoOcean)
8+
9+
Start by forking the repository to your GitHub account. This will create a copy of the repository under your GitHub account.
10+
11+
### 2. Clone the Repository
12+
13+
Clone the forked repository to your local machine using the following command:
14+
15+
```sh
16+
git clone https://github.com/geoocean/BlueMath.git
17+
```
18+
19+
### 3. Create a branch
20+
21+
Create a new branch for your contribution. Use a descriptive name for your branch:
22+
23+
```sh
24+
git checkout -b feature/your-feature-name
25+
```
26+
27+
An example branch could be `feature/xbeach-wrapper`.
28+
29+
### 4. Make changes
30+
31+
Make the necessary changes to the codebase. Ensure that your code follows the project's coding standards and guidelines.
32+
33+
### 5. Commit changes
34+
35+
```sh
36+
git add .
37+
git commit -m "Add your commit message here"
38+
```
39+
40+
### 6. Push changes
41+
42+
Push your changes to your forked repository (Remember repo is not forked if your GeoOcean):
43+
44+
```sh
45+
git push origin feature/your-feature-name
46+
```
47+
48+
### 7. Create a Pull Request
49+
50+
Go to the original repository on GitHub and create a pull request from your forked repository. Provide a clear and detailed description of your changes and the problem they solve.
51+
52+
### 8. Review Process
53+
54+
Your pull request will be reviewed by the maintainers. Please be responsive to any feedback or questions they may have. Once your pull request is approved, it will be merged into the main branch.
55+
56+
### 9. Reporting Issues
57+
58+
If you encounter any issues or bugs, please report them by creating a new issue on the GitHub repository. Provide as much detail as possible to help us understand and resolve the issue.
59+
60+
### 10. Code of Conduct
61+
62+
Please adhere to our Code of Conduct to ensure a welcoming and inclusive environment for everyone.
63+
64+
### 11. License
65+
66+
By contributing to the BlueMath package, you agree that your contributions will be licensed under the MIT License.
67+
68+
### 12. Contact
69+
70+
If you have any questions or need further assistance, feel free to reach out to the maintainers.
71+
72+
Thank you for your contributions and support!
73+
74+
## Documentation
75+
76+
When creating new `python` code, it is essential to properly document all new classes and functions. Below, we show how the **docstrings** of classes should look, so the community can properly learn how to use **BlueMath**.
77+
78+
Code example:
79+
```python
80+
import numpy as np
81+
82+
class HyWavesExample:
83+
"""
84+
This class implements a HyWaves Metamodel Example for nearshore wave propagations.
85+
86+
Attributes
87+
----------
88+
waves_model : str
89+
The waves numerical model to use.
90+
statistical_model : str, optional
91+
The statistical model to use. Default is "MDA".
92+
93+
Methods
94+
-------
95+
run_model -> np.ndarray
96+
Runs the waves numerical model and returns the output.
97+
"""
98+
99+
def __init__(self, waves_model: str, statistical_model: str = "MDA") -> None:
100+
self.waves_model = waves_model
101+
self.statistical_model = statistical_model
102+
103+
def run_model(self, launcher: str) -> np.ndarray:
104+
"""
105+
Runs the numerical waves model.
106+
107+
Parameters
108+
----------
109+
launcher : str
110+
The launcher to use.
111+
"""
112+
113+
self.run_model(launcher=launcher, model=self.waves_model)
114+
return self.get_model_ouput()
115+
```

docs/source/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ documentation for details.
1515
:maxdepth: 2
1616
:caption: Contents:
1717

18+
intro
19+
installation
20+
contribute
1821
modules
1922

2023
Indices and tables

docs/source/installation.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Installation for Developers
2+
3+
BlueMath is already available via `pip` or `conda`.
4+
5+
To test its capabilities locally, please run the following commands:
6+
7+
1. Clone the repository from GitHub:
8+
```sh
9+
git clone https://github.com/GeoOcean/BlueMath_tk.git
10+
```
11+
2. Move inside the directory to install everything:
12+
```sh
13+
cd BlueMath_tk
14+
```
15+
3. Create a compatible conda environment:
16+
```sh
17+
conda env create -f environment.yml
18+
```
19+
4. Then activate the environment using:
20+
```sh
21+
conda activate bluemath
22+
```
23+
5. Finally, install package in development mode:
24+
```sh
25+
pip install -e .
26+
```

docs/source/intro.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Introduction
2+
3+
<img src="_static/sketch_tk.png" alt="picture" width="800"/>
4+
5+
## Installation
6+
7+
```sh
8+
pip install bluemath-tk
9+
```
10+
11+
## Authors
12+
13+
Demo codes have been developed through a collaborative effort by members of the GeoOcean group at the University of Cantabria. For inquiries, please contact Fernando Méndez at mendezf@unican.es
14+
15+
## Project status
16+
17+
- UNDER DEVELOPMENT

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies = [
5050

5151
[project.optional-dependencies]
5252

53-
docs = ["sphinx", "sphinx-rtd-theme", "jupyter-sphinx"]
53+
docs = ["sphinx", "sphinx-rtd-theme", "jupyter-sphinx", "myst-parser"]
5454
deep = ["tensorflow", "keras"]
5555
num-models = ["hydromt-sfincs"]
5656
waves = ["wavespectra"]

0 commit comments

Comments
 (0)