To be updated soon. This work springboards from the pyBDY Project.
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
-
Creating a specific conda virtual environment is highly recommended (click here for more about virtual enviroments).
cd $PYBDY_DIR conda env create -n pybdy -f environment.yml python=3.9
-
Activate the new virtual environment:
conda activate pybdy
-
To deactivate:
conda deactivate
-
Make sure the Java Runtime Environment is set (e.g. livljobs*):
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/
-
Install pyBDY:
pip install -e .
This should result in pyBDY being installed in the virtual environment, and can be checked by entering:
pybdy -v
Resulting in a help usage prompt:
usage: pybdy -g -s <namelist.bdy>
To use pyBDY, the following command is entered: (the example will run an benchmarking test):
pybdy -s /path/to/namelist/file (e.g. ./inputs/namelist_remote.bdy)
For best experience create a new conda environment (e.g. pybdy-dev):
conda env create -n pybdy-dev -f environment.yml python=3.9
conda activate pybdy-dev
Before pushing to GitHub, run the following commands:
- Update conda environment:
make conda-env-update
- Install this package:
pip install -e .
- Sync with the latest template:
make template-update
- Run quality assurance checks:
make qa
- Run tests:
make unit-tests
- Run the static type checker (currently not working):
make type-check
- Build the documentation (see Sphinx tutorial):
make docs-build
The pyBDY module can be tested using the bench marking namelist bdy file in the inputs folder. To check the outputs of the benchmark test, these can be visualised using the plotting script within the test_scripts folder. A local version of the benchmark data can be downloaded from here. The ./benchmark directory should reside as a subfolder of ./inputs. 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.:
cd $PYBDY_DIR pybdy -s /full/path/to/namelist/file
-
This will create two output files coordinates.bdy.nc and NNA_R12_bdyT_y1979_m11.nc in an ./outputs folder
-
To check the coordinates.bdy.nc has the correct boundary points, the script bdy_coords_plot.py will plot the domain boundaries and shown the different locations of the rim width (increasing number should go inwards) This script is located in the test_scripts folder. There are also two plotting scripts in ./plotting, one does a similar job to bdy_coords_plot.py the other plots the tracer boundaries (as a pcolormesh) to help visualise the output.
-
The result should look like this (if using the current benchmark data)
-
Activate the new virtual environment:
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>
-
Press go:
pybdy -s inputs/namelist_local.bdy
Take about 120s. Generates 7 consitutents, using FES2014 data, written to `outputs`:
coordinates.bdy.nc
NNA_R12_bdytide_FES2014_M4_grd_V.nc
NNA_R12_bdytide_FES2014_Q1_grd_U.nc
NNA_R12_bdytide_FES2014_K2_grd_U.nc
NNA_R12_bdytide_FES2014_M4_grd_Z.nc
NNA_R12_bdytide_FES2014_Q1_grd_V.nc
NNA_R12_bdytide_FES2014_K2_grd_V.nc
...