4. Create Open Boundary Conditions - NOC-MSM/SRIL34 GitHub Wiki

Generate the open boundary conditions (OBC) using Copernicus (CMEMS) data

To generate the OBC with the CMEMS data downloaded, you will need to use PyNEMO. You can use this tool on the livljobs servers or you can directly install PyNEMO on Archer2. Here we show the steps to download and use PyNEMO on Archer2.

1. Install miniconda (only for archer2)

If you followed the setting up SRIL34 instructions, you should already have miniconda installed on archer2. If not, log into Archer2, and cd into you working directory. Here, install miniconda.

cd /work/n01/n01/<user>
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod u+x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh

Install in /work/n01/n01/$USER/miniconda3 when prompted.

Allow it to modify PYTHONPATH in .bashrc . Close and open shell.

NOTE: you do not need to install miniconda on livljobs to use PyNEMO. This step is only to use it on Archer2.

2. Install PyNEMO

In your working directory, clone the PyNEMO repository:

$ cd /work/n01/n01/$USER
$ git clone https://github.com/NOC-MSM/PyNEMO.git

Cloning the repository will generate a PyNEMO directory containing the repository files, including the pynemo_39.yml. This file specifies the modules needed to run PyNEMO and is used to create the right conda environment for it. Move into the directory and create a conda environment specifically for PyNEMO.

$ cd PyNEMO
$ conda env create -f pynemo_39.yml

Activate your environment to install PyNEMO:

$ source activate pynemo

On Archer2, your Java path should already be set, however if for any reason it's not, this might cause issues. If you have issues, you can check you path using $ whereis java, and export the correct java path if needed. You will probably be able to skip this step. NOTE: if you are on livljobs, you will need to check what the latest java path is to use and export it.

$ export JAVA_HOME=/usr/lib64/jvm/java

You should now be in your PyNEMO directory ( /work/n01/n01/$USER/PyNEMO ) with your pynemo environment activated. Install PyNEMO with:

python setup.py build
export PYTHONPATH=/home/n01/n01/$USER/miniconda3/envs/pynemo/lib/python3.9/site-packages:$PYTHONPATH
python setup.py install

you can check that the installation worked using

$ pynemo -h

which should result in a help usage prompt message similar to:

usage: pynemo [-g] -s <namelist.bdy> 
       -g (optional) will open settings editor before extracting the data
       -s <bdy filename> file to use

NOTE: it is possible you also see the note 'Didn't find a proxy environment variable' along with the help usage prompt. This doesn't mean your installation went wrong.

3. Use PyNEMO

To use pynemo you will first need to gather a bunch of files used by the program. You need:

  • The domain file from the model you want to create OBC for (here for eg. SRIL34).
  • The bathymetry file from the model you want to create OBC for.
  • A coordinates file from you parent model (here for eg. CMEMS, which can be downloaded as explained here).
  • A file called inputs_src_zgr.ncml which contains the location of the parent coordinates file and defines some of the parent model variable names.
  • A file called inputs_dst.ncml which is used to rename some variables.
  • You might need a mask file for you subdomain (not needed if you only want tidal boundary condition).
  • Another ncml file setting the paths to your parent model and some of its variable. Usually this is one file per year (eg CMEMS_2014.ncml). NOTE: there are two separate paths to be defined in the file, one for the CMEMS file containing salinity/temperature, and one for the CMEMS file containing the U, V current.
  • FES tide data, if running tides (NOTE: these are on shared location on both archer2 and livljobs, you only really need the paths)

Finally, to run pynemo you will then need a namelist file defines the variables that you are using. You can amend this file to run tidal boundary conditions, open boundary conditions, or both (eg. namelist_SRIL34.dby, or namelist_FES14_Archer.bdy).

Make sure that you namelist file ( namelist_SRIL34.dby) , and your three ncml files (inputs_src_zgr.ncml , inputs_dst.ncml, CMEMS_2014.ncml) are set for the right dates and pointing to the right directories. Also set your output directories where you want to save files.

Then, to run PyNEMO use the command:

$ pynemo -s /path/to/namelist/file   (eg. pynemo -s namelist_SRIL34.bdy)
⚠️ **GitHub.com Fallback** ⚠️