Skip to content

5. Create ERA5 forcing

Julia Rulent edited this page Nov 2, 2022 · 11 revisions

Downloading ERA5 data.

To create the ERA5 forcing you first need to download some ERA5 data. The following step explain how to do this on NOC's server (livljobs).

ERA5 data are stored in NOC under /projectsa/NEMO/Forcing/ERA5/SURFACE_FORCING . Before you download new data, check that what you need isn't already in this shared directory (it probably is).

If not, you will need to first create an account on CDS (if you do not already have one), then install the cdsapi python package and add your security key.

The next step is to run the script Download_viaCDS_ERA5_Global_PerVariable.py (saved in livljobs under the /projectsa/NEMO/Forcing/Download_viaCDS_ERA5_Global_PerVariable.py) to download ERA5 data.

Adapt the script by changing the dates and variables you need to download (you can make a copy of the script and run it from your directory).

NOTE: The script is set to automatically download data in /projectsa/NEMO/Forcing/ERA5/SURFACE_FORCING. If unsure, this can be modified in the script. Please, don't change this in the original script, make a copy.

More detailed instructions on how to download the ERA5 data are available here.

Generate ERA5 forcing

To generate the forcing for the SRIL34 (on NOC's server, livljobs), you will need to activate a python environment that has the numpy libraries installed (eg. nrct_env_py3).

module load anaconda
source activate nrct_env_py3

and load the module

module load nco/gcc/4.4.2 

NOTE: This is an updated module and is subsequently switched back to nco/gcc/4.4.2.ncwa in the main code

Then, you need to amend the USR PARAMS in the script OFFICIAL_Generate_NEMO_Forcing_NEWERA.py, to set the correct dates and paths. The coordinates should already be set for the SRIL34 domain as below (IMPORTANT: The extracted region has to be larger than your model domain size). The path_EXTRACT and path_FORCING needs to be changed to the directories where you want to extract data and output the forcing. The path_ERA5 should remain the same.

#====================== USR PARAMS ===========================

Year_init    = 2019                                             ## First year to process          
Year_end     = 2019                                             ## Last one [included]
East         =  115                                              ## East Border
West         =  50                                             ## West Border
North        =  40                                             ## North Border
South        =  -10                                             ## South Border
path_ERA5    = '/projectsa/NEMO/Forcing/ERA5/SURFACE_FORCING/'  ## ROOT PATH OD ERA5 DATA
path_EXTRACT = '/<PathToDir>/EXTRACT_TEST/'       ## WHERE TO EXTRACT YOUR REGION
path_FORCING = '/<PathToDir>/FORCING_TEST/'                                     ## NEMO FORCING

Now you should be able to run the script:

python OFFICIAL_Generate_NEMO_Forcing_NEWERA.py

NOTE: the original scripts for a generic domain is also on livljobs under /projectsa/NEMO/Forcing/Download_viaCDS_ERA5_Global_PerVariable.py or on github here. If you use these, make sure you change the coordinates to those of your domain.

Once all your scripts are set, you can use the create_forcing.sh script to go through all the above steps in one go.

Create weights for atmospheric forcing

To generate the weights, transfer the ERA5 forcing that you have just generated to Archer2, into your $SBC directory and move into that directory.

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

also copy the job_create_forcing.slurm into the $SBC directory. Amend the script by replacing the $TDIR/ to the full path directory. This script (last tested august 2022) will first load modules:

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

Then it will generate the 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

NOTE: the SCRIP tools are generated when you compile the NEMO tools

To run the script submit the job_create_forcing.sh using:

sbatch job_create_forcing.sh