Skip to content
/ PyNEMO Public
forked from JMorado/PyNEMO

PyNEMO: a Python based regional NEMO model configuration toolbox.

License

Notifications You must be signed in to change notification settings

jdha/PyNEMO

 
 

Repository files navigation

PyNEMO

To be updated soon. This work springboards from the PyNEMO Project.

How do I get set up?

Steps to take to install PyNEMO, creating a specific conda virtual environment is highly recommended. click here for more about virtual enviroments

  • Clone PyNEMO repository:

    $ export PYNEMO_DIR=$PWD/PyNEMO
    $ git clone https://github.com/NOC-MSM/PyNEMO.git
    
  • Create conda environment for PyNEMO:

    $ cd $PyNEMO_DIR
    $ conda env create -f environment.yml
    
  • Activate the new virtual environment:

    $ conda activate pynemo
    
  • 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 PyNEMO:

    $ pip install .
    

This should result in PyNEMO being installed in the virtual environment, and can be checked by entering:

$ pynemo -v

Resulting in a help usage prompt:

$ usage: pynemo -g -s <namelist.bdy>

To use PyNEMO, the following command is entered: (the example will run an benchmarking test):

$ pynemo -s /path/to/namelist/file (e.g. ./inputs/namelist_remote.bdy)

Contribution guidelines

For best experience create a new conda environment (e.g. pynemo-develop):

conda env create -f environment.yml
conda activate pynemo-develop

Before pushing to GitHub, run the following commands:

  1. Update conda environment: make conda-env-update
  2. Install this package: pip install -e .
  3. Sync with the latest template (optional): make template-update
  4. Run quality assurance checks: make qa
  5. Run tests: make unit-tests
  6. Run the static type checker: make type-check
  7. Build the documentation (see Sphinx tutorial): make docs-build

Bench Marking Tests

The PyNEMO 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 PyNEMO using the namelist file in the inputs folder (namelist_local.bdy) e.g.:

    $ pynemo -s /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)

Example BDY coords output{width="800px"}

Example: generating tidal boundary conditions on ARCHER2

  • Activate the new virtual environment:

    conda activate pynemo
    
  • Make sure all the directories and files are in place:

    cd PyNEMO
    mkdir outputs
    ln -s /work/n01/n01/shared/jelt/FES2014 inputs/.
    <cp benchmark dir into inputs/benchmark>
    
  • Press go:

    pynemo -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
...

About

PyNEMO: a Python based regional NEMO model configuration toolbox.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 65.5%
  • TeX 31.4%
  • PLSQL 2.2%
  • Jupyter Notebook 0.7%
  • Makefile 0.1%
  • Shell 0.1%