Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
59d0da1
Adding first GH page
jdha Feb 4, 2025
a9a41f0
adding docs workflow
jdha Feb 4, 2025
025a3fb
update pre-commit to accept 'unsafe' + docs updates
jdha Feb 4, 2025
fefc7a0
restructuring docs
jdha Feb 4, 2025
b012940
update ci
jdha Feb 4, 2025
e566759
mistake
jdha Feb 4, 2025
3c31cd3
adding ci
jdha Feb 4, 2025
db82d11
ci update
jdha Feb 4, 2025
9090dc4
temporary addtion of docs branch to populate gh pages
jdha Feb 4, 2025
3967725
removing old docs
jdha Feb 4, 2025
642de44
update syntax error
jdha Feb 4, 2025
3ca1c63
formatting
jdha Feb 5, 2025
4c4e49b
formatting
jdha Feb 5, 2025
dd095a2
formatting
jdha Feb 5, 2025
de8485a
formatting
jdha Feb 5, 2025
b1d3173
missing line
jdha Feb 5, 2025
73fda77
Added Contents header and How to use pyBDY documentation
b-barton May 28, 2025
f440b1f
Small changes
b-barton May 28, 2025
abfc40d
Added Tidal Boundary Conditions Generation from the old pyNEMO docs. …
b-barton May 29, 2025
87d1e6f
Added CMEMS Downloader from old pyNEMO page. I'm not sure this is sti…
b-barton May 29, 2025
5abdca1
Changed order. Testing links
b-barton May 29, 2025
a0bab9f
Testing links
b-barton May 29, 2025
4c635f6
Working links
b-barton May 29, 2025
a2a88de
Merge remote-tracking branch 'origin/master' into 185-docs so that th…
b-barton May 29, 2025
7855fc5
Fixed typo
b-barton May 29, 2025
3c36c02
Test adding function docstring from sphinx
b-barton May 29, 2025
0de0496
Comment docstring
b-barton May 29, 2025
bc20b8e
Added __init__.py to grid folder so sphinx can automatrically find it
b-barton May 29, 2025
9a41ca3
Testing adding function list contents
b-barton May 29, 2025
c15a5ed
Adding grid docstrings markdown file
b-barton May 29, 2025
758a567
test formatting
b-barton May 29, 2025
c9c6cef
Made index.md ready for auto appending module structure
b-barton May 29, 2025
cadd2e7
Adding automated docsting documentation of functions
b-barton May 30, 2025
dbef192
Sorted out line returns on arguments
b-barton May 30, 2025
5d514b2
Documentation typos
b-barton May 30, 2025
04526e3
Formatting to headings and indents
b-barton May 30, 2025
4e47fe9
Updated docstrings
b-barton May 30, 2025
45bd0b0
Removed Notes
b-barton May 30, 2025
6fb9f24
Formatting
b-barton May 30, 2025
5c71299
Docstring formatting
b-barton May 30, 2025
294efc0
Formatting
b-barton May 30, 2025
282035a
Docstring edits
b-barton May 30, 2025
3ce7695
Docstring formatting
b-barton May 30, 2025
454b39c
Edited docstrings and removed underscore from methods names so they a…
b-barton May 30, 2025
adc3605
Removing file because it doesn't get used anymore and has an obsolete…
b-barton May 30, 2025
43491b7
More docstring formatting issues
b-barton May 30, 2025
c0e1abc
Updated the docs
b-barton May 30, 2025
d107065
Made functions for automating the documentation of docstrings
b-barton May 30, 2025
3af6183
Updated Makefile for the new doc building script
b-barton May 30, 2025
f435fd0
Removed print
b-barton May 30, 2025
c6dc1aa
Updated docs
b-barton May 30, 2025
b7e7da8
Updated link to documentation page to the new github pages
b-barton Jun 3, 2025
082c46e
Typo, reference name and removed the CMEMS downloader bit
b-barton Jun 3, 2025
7846d56
Started adding an example namelist
b-barton Jun 5, 2025
f823895
Updating worked example
b-barton Jun 5, 2025
66d135e
Removing vertical coordinate set up parts
b-barton Jun 5, 2025
f471fc9
Removing vertical coordinate set up parts
b-barton Jun 5, 2025
d6d43c0
Removed sn_history as it wasn't used and has been replaced by sn_dst_…
b-barton Jun 6, 2025
13ee918
Added info on how to set up NcML file and continued the worked example.
b-barton Jun 6, 2025
c7e5084
Updating the example
b-barton Jun 6, 2025
e2655b0
Removed sn_history
b-barton Jun 6, 2025
f5a3ef8
Updated the docs with extra help on the nmcl and json files.
b-barton Jun 12, 2025
dbbe311
Formatting
b-barton Jun 12, 2025
4f64bf9
Formatting
b-barton Jun 12, 2025
92d11dd
Formatting
b-barton Jun 12, 2025
13f43bc
Formatting
b-barton Jun 12, 2025
b14d810
Added comments on setting up json file
b-barton Jun 16, 2025
0fdf02b
Added decription of ln_dyn2d and ln_dyn3d
b-barton Jun 16, 2025
20c4a6b
Typo
b-barton Jun 26, 2025
c056528
Adding new pybdy logo
b-barton Jun 27, 2025
8a6eb4e
Adding logo to readme
b-barton Jun 27, 2025
b399c75
Adding logos to docs page
b-barton Jun 27, 2025
75def04
Updating logo
b-barton Jun 27, 2025
8d70924
Updating logo
b-barton Jun 27, 2025
173e7e4
Update logo location
b-barton Jun 27, 2025
425d99f
Typo and trying different link for github pages
b-barton Jul 2, 2025
f2ab88d
Different link format and image format
b-barton Jul 2, 2025
0c370e3
Link heading format and trying different format for image
b-barton Jul 2, 2025
b5fc284
Image path
b-barton Jul 2, 2025
7cb1472
Image path
b-barton Jul 2, 2025
f35c2cb
Merge remote-tracking branch 'origin/master' into 185-docs
b-barton Jul 2, 2025
e51b050
Updated for module structure in tabs
b-barton Jul 2, 2025
85ccc14
Updating docs for new functions from master
b-barton Jul 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- 185-docs
tags:
- '*'
pull_request:
Expand Down Expand Up @@ -110,25 +111,23 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download combined environments
uses: actions/download-artifact@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
name: combined-environments
path: ci
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
cache-environment: true
create-args: >-
python=3.9
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Build documentation
run: |
make docs-build
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material mkdocs-glightbox
- name: deploy documentation
run: mkdocs gh-deploy --force

integration-tests:
needs: [combine-environments, unit-tests]
Expand Down
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
args: ['--unsafe']
- id: check-toml
- id: debug-statements
- id: mixed-line-ending
Expand All @@ -24,9 +25,11 @@ repos:
- id: ruff
args: [--fix, --show-fixes]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.19
hooks:
- id: mdformat
additional_dependencies:
- mdformat-mkdocs[recommended]>=4.0.0
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.9.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ template-update:
pre-commit run --all-files cruft -c .pre-commit-config-cruft.yaml

docs-build:
cd docs && rm -fr _api && make clean && make html
cd docs && bash make_docs.sh

# DO NOT EDIT ABOVE THIS LINE, ADD COMMANDS BELOW
136 changes: 69 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,70 @@
# pyBDY

[pyBDY documentation](http://pynemo.readthedocs.io/en/latest/index.html). To be updated soon.
<img src="/docs/assets/icons/pybdy_logo_small.png" alt="pybdy_logo" width="100"/>

[pyBDY documentation](https://noc-msm.github.io/pyBDY/).

## How do I get set up?

These are the steps to take to install pyBDY:

- Clone pyBDY repository:

```
export PYBDY_DIR=$PWD/pyBDY
git clone https://github.com/NOC-MSM/pyBDY.git
```
```
export PYBDY_DIR=$PWD/pyBDY
git clone https://github.com/NOC-MSM/pyBDY.git
```

- Creating a specific conda virtual environment is highly recommended ([click here for more about virtual
enviroments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)).
Use the latest version of anaconda (to be added in your .bashrc or load the module in the command line, e.g ` module load anaconda/5-2021`).
enviroments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)).
Use the latest version of anaconda (to be added in your .bashrc or load the module in the command line, e.g ` module load anaconda/5-2021`).

```
cd $PYBDY_DIR
conda env create -n pybdy -f environment.yml python=3.9
```
```
cd $PYBDY_DIR
conda env create -n pybdy -f environment.yml python=3.9
```

- Activate the new virtual environment:

```
conda activate pybdy
```
```
conda activate pybdy
```

- To deactivate (not now!):

```
conda deactivate
```
```
conda deactivate
```

- Make sure the Java Runtime Environment is set e.g.:

```
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el7_9.x86_64/ # e.g. for livljobs\*
```
```
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el7_9.x86_64/ # e.g. for livljobs\*
```

Or (downloading from https://jdk.java.net/20/)
Or (downloading from https://jdk.java.net/20/)

```
export JAVA_HOME=/Users/<username>/Downloads/jdk-20.0.1.jdk/Contents/Home/ # e.g. for mac OSX
```
```
export JAVA_HOME=/Users/<username>/Downloads/jdk-20.0.1.jdk/Contents/Home/ # e.g. for mac OSX
```

Generalised methods for defining paths are as follows:
Generalised methods for defining paths are as follows:

```
export JAVA_HOME=$(readlink -f $(which java)) # UNIX
export JAVA_HOME=$(/usr/libexec/java_home) # Mac
```
export JAVA_HOME=$(readlink -f $(which java)) # UNIX
export JAVA_HOME=$(/usr/libexec/java_home) # Mac

```
```

NB the above may not land at the correct directory level, but should find
the correct root. PyBDY expects this to be the directory level with `lib`
in which might be e.g. 3 directories back.
NB the above may not land at the correct directory level, but should find
the correct root. PyBDY expects this to be the directory level with `lib`
in which might be e.g. 3 directories back.

- Install pyBDY:

```
pip install -e .
```
```
pip install -e .
```

This should result in pyBDY being installed in the virtual environment,
and can be checked by entering:
Expand Down Expand Up @@ -109,57 +111,57 @@ The
following steps are required,

- Run pyBDY using the namelist file in the inputs folder
(namelist_local.bdy) from inside the root pyBDY directory, e.g.:
(namelist_local.bdy) from inside the root pyBDY directory, e.g.:

```
cd $PYBDY_DIR
mkdir -p outputs
pybdy -s inputs/namelist_local.bdy
```
```
cd $PYBDY_DIR
mkdir -p outputs
pybdy -s inputs/namelist_local.bdy
```

- This will create two output files `coordinates.bdy.nc` and
`NNA_R12_bdyT_y1979_m11.nc` in an `./outputs` folder
`NNA_R12_bdyT_y1979_m11.nc` in an `./outputs` folder

- To check the coordinates.bdy.nc has the correct boundary points, the
script `plotting/plot_coords.py` will plot the domain boundaries and show
the different locations of the rim width (increasing number should
go inwards).
script `plotting/plot_coords.py` will plot the domain boundaries and show
the different locations of the rim width (increasing number should
go inwards).

E.g.
`python plotting/plot_coords.py outputs/NNA_R12_bdyT_y1979m11.nc outputs/coordinates.bdy.nc`
![Example plot_coords.py output](/screenshots/example_coords.png)
E.g.
`python plotting/plot_coords.py outputs/NNA_R12_bdyT_y1979m11.nc outputs/coordinates.bdy.nc`
![Example plot_coords.py output](/screenshots/example_coords.png)

The other script `plot_bdy.py` plots extracted variables at the boundaries to help visualise the output (1D or 2D).
E.g.
`python plotting/plot_bdy.py outputs/NNA_R12_bdyT_y1979m11.nc votemper`
![Example plot_bdy.py output](/screenshots/example_bdy_data.png)
The other script `plot_bdy.py` plots extracted variables at the boundaries to help visualise the output (1D or 2D).
E.g.
`python plotting/plot_bdy.py outputs/NNA_R12_bdyT_y1979m11.nc votemper`
![Example plot_bdy.py output](/screenshots/example_bdy_data.png)

which also works on 2D tidal boundary data (note you can specify an output file name):
`python plotting/plot_bdy.py outputs/NNA_R12_bdytide_TPXO7p2_M2_grd_Z.nc z1 example_bdy_1d_data.png`
![Example plot_bdy.py output for tides](/screenshots/example_bdy_1d_data.png)
which also works on 2D tidal boundary data (note you can specify an output file name):
`python plotting/plot_bdy.py outputs/NNA_R12_bdytide_TPXO7p2_M2_grd_Z.nc z1 example_bdy_1d_data.png`
![Example plot_bdy.py output for tides](/screenshots/example_bdy_1d_data.png)

## Example: generating tidal boundary conditions on ARCHER2

- Activate the new virtual environment:

```
conda activate pybdy
```
```
conda activate pybdy
```

- Make sure all the directories and files are in place:

```
cd pyBDY
mkdir outputs
ln -s /work/n01/n01/shared/jelt/FES2014 inputs/.
<cp benchmark dir into inputs/benchmark>
```
```
cd pyBDY
mkdir outputs
ln -s /work/n01/n01/shared/jelt/FES2014 inputs/.
<cp benchmark dir into inputs/benchmark>
```

- Press go:

```
pybdy -s inputs/namelist_local.bdy
```
```
pybdy -s inputs/namelist_local.bdy
```

Take about 120s. Generates 7 consitutents, using FES2014 data, written
to \`outputs\`:
Expand Down
2 changes: 1 addition & 1 deletion contribution_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you don't have write permissions on [NOC-MSM/pyBDY](https://github.com/NOC-MS

1. Update the master branch of your local repository: `git checkout master && git pull`
1. Open a GitHub issue or pick one already opened
1. Create a branch that references the issue number and gives a summary of the changes that will be made: `git branch issue-103-remove-pynemo-traces`
1. Create a branch that references the issue number and gives a summary of the changes that will be made: `git branch issue-103-remove-pynemo-traces`
1. Switch to that branch (i.e., update HEAD to set that branch as the current branch): `git checkout issue-103-remove-pynemo-traces`

## Stage and commit changes
Expand Down
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

Binary file added docs/assets/icons/favicon.ico
Binary file not shown.
Binary file added docs/assets/icons/noc_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/icons/pybdy_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/icons/pybdy_logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/EN4_sst_climatology_mean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions docs/format_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import glob

markdown_files = glob.glob("./*.md")
index_files = glob.glob("./index*.md")

markdown_mods = list(set(markdown_files) - set(index_files))

for i in range(len(markdown_mods)):
with open(markdown_mods[i], "r") as f:
data = f.readlines()

skip_ind = []
for j in range(len(data)):
# Swap args for parameters and remove colons
if "Arg" in data[j]:
data[j] = data[j].replace("s", "").replace("Arg", "Parameters")
if (
("Parameters" in data[j]) | ("Returns" in data[j]) | ("Notes" in data[j])
) & (":" in data[j]):
data[j] = data[j].replace(":", "")

# Upgrade some headings
if ("# " in data[j]) & ("package" not in data[j]) & ("##" not in data[j]):
data[j] = data[j].replace("# ", "")
if (" module" in data[j]) & ("## " in data[j]):
data[j] = data[j].replace("## ", "# ")
if (
("### " in data[j])
& ("Parameters" not in data[j])
& ("Returns" not in data[j])
& ("Notes" not in data[j])
):
data[j] = data[j].replace("### ", "## ")
data[j] = data[j].replace("#### ", "### ")
if ("Parameters" in data[j]) | ("Returns" in data[j]):
data[j] = "> " + data[j]
if (
("### " in data[j])
& ("Parameters" not in data[j])
& ("Returns" not in data[j])
& ("Notes" not in data[j])
):
data[j] = data[j].replace("### ", "### *method* ")

# Remove notes headings
if "## Notes" in data[j]:
skip_ind.append(j)

# Indent arguments
if (":" in data[j]) & (data[j][0] != ">"):
data[j] = "> " + data[j]
if data[j][0] == ">":
data[j] = data[j][:-1] + "<br>" + data[j][-1]

with open(markdown_mods[i], "w") as f:
for j in range(len(data)):
if len(skip_ind) > 0:
if j in skip_ind:
continue
f.write(data[j])
Loading
Loading