Skip to content

4. Generate Forcing Data

jenjar93 edited this page Oct 5, 2022 · 1 revision

This page details how to generate Forcing data for the SANH configuration using ERA5 data. Please note, the below scripts extract a subset of data from local copies of ERA5 data, and not directly from the ERA5 server.

1. Extract ERA5 data

Copy the extract script to your local machine.

scp $GITCLONE/FORCING/OFFICIAL_Generate_NEMO_Forcing_NEWERA.py YOUR_LOCAL_MACHINE/DIR

Edit OFFICIAL_GENERATE_NEMO_Forcing_NEWERA.py for your chosen date range, and the latitudinal/longitudinal limits of the region your want to extract (the extracted region needs to be slightly larger than your model domain size).

Update path_EXTRACT, path_FORCING, and path_ERA5 (if necessary).

Activate the python environment that has the numpy libraries installed (in my case this was nrct_env), and load the nco modules:

module load anaconda
source activate nrct_env
module load nco/gcc/4.4.2

Run the script::

python OFFICIAL_Generate_NEMO_Forcing_NEWERA.py

Data extraction will take at least an hour, depending on the size of your region, and the memory of your local machine.

2. Extract the Land-Sea Mask

For better representation of the land/sea boundaries, you might want to extract a land-sea mask from the ERA5 data. This can be done using one of the ERA5 files already extracted.

First, use the ncks command to cut out the region you want (should be same as that stated in OFFICIAL_Generate_NEMO_Forcing_NEWERA.py)::

cd $SBC
ncks -d latitude,38.,68. -d longitude,332.,19. $GITCLONE/FORCING/era5_atmos_landseamask.nc ./my_era5_LSM.nc

Next, use the create_LSM.py script to create the draft mask file (ERA5_LSM_draft.nc)::

python create_LSM.py

Finally, run the Matlab script draft_LSM_nc.m to create the ERA5_LSM.nc file.

N/B: Some masks may show land-locked lakes or small "island" peninsulas near the coast or boundaries. These are erroneous artifacts, and should be removed (i.e. converted to land/sea).

3. Create Weights

Once the forcing data has been extracted, copy it to the $SBC data folder.

Then link your coordinates file to the $SBC directory:

ln -s $DOMAIN/coordinates.nc ./

Copy over the required namelists and edit them to reflect your pathnames:

cp $GITCLONE/FORCING/namelist_reshape_bicubic_atmos ./
cp $GITCLONE/FORCING/namelist_reshape_bilin_atmos ./

Load modules (tested Aug 2022):

module swap craype-network-ofi craype-network-ucx
module swap cray-mpich cray-mpich-ucx
module load cray-hdf5-parallel/1.12.0.7
module load cray-netcdf-hdf5parallel/4.7.4.7

Generate weights for the forcing data (ERA5 in this example) using the SCRIP tools in NEMO:

$TDIR/WEIGHTS/scripgrid.exe namelist_reshape_bilin_atmos
$TDIR/WEIGHTS/scrip.exe namelist_reshape_bilin_atmos
$TDIR/WEIGHTS/scripshape.exe namelist_reshape_bilin_atmos
$TDIR/WEIGHTS/scrip.exe namelist_reshape_bicubic_atmos
$TDIR/WEIGHTS/scripshape.exe namelist_reshape_bicubic_atmos

This is done by submitting the job_create_forcing.slurm script (after changing the $TDIR path shortcut to the full path directory):

sbatch job_create_forcing.slurm