Skip to content

06. Add met forcing.

micdom edited this page Jan 31, 2024 · 9 revisions

Add ERA5 met forcing

Prepare data for fully forced run.

0. Download ERA5 forcing data

Check the ECMWF pages for the latest guidance on obtaining the ERA5 reanalysis dataset. Download data as recommended.

1. Extract ERA5 data

The ERA5 data for the domain is post-processed using this script:

https://github.com/NOC-MSM/DEV_nibrun/blob/master/FORCING_DATA/OFFICIAL_Generate_NEMO_Forcing_NEWERA.py

which is also available in SCRIPTS/OFFICIAL_GENERATE_NEMO_Forcing_NEWERA.py, change the data path, date range of the data and also the lat and lon coordinates of the region you want to extract. IMPORTANT: Make sure the extracted region is larger than your model domain size.

For NOC users, ERA5 data are stored locally on the livljobs server, in general you would need to update path_EXTRACT and path_FORCING, but path_ERA5 should remain the same (if running on a livljobs server). However, in this example a copy is already checked out in the repo so no edits are necessary. If you do not have access to the NOC Liverpool local ERA5 archive, you will need to get these data independently.

To use the script, load anaconda:

module load anaconda

Then, there are two options:

(1) create and activate a very simple python environment with the modules needed in the script:

conda create -p /work/$USER/envs/swot_env python=3.9 numpy pip
conda activate /work/$USER/envs/swot_env
pip install netCDF4
pip install cython
pip install netcdftime

(2) alternatively, it is possible to use the PyNEMO environment, but after installing the netcdftime module

conda activate pynemo3
pip install netcdftime

If the python environment has been created previously then it only needs to be activated

conda activate /work/$USER/envs/swot_env or conda activate pynemo3

When you have the environment ready, run the script:

python SCRIPTS/OFFICIAL_Generate_NEMO_Forcing_NEWERA.py

Depending on the size of the region and the data range of the data, this will take a while.

The files generated are:

ERA5_MSDWLWRF_*.nc
ERA5_MSDWSWRF_*.nc
ERA5_MTPR_*.nc
ERA5_MSR_*.nc
ERA5_MSL_*.nc
ERA5_SPH_*.nc
ERA5_T2M_*.nc
ERA5_U10_*.nc
ERA5_V10_*.nc

2. Extract the Land-Sea Mask

You might also want to extract the land sea mask for a better representation of the coastline in NEMO. The ERA5 land/sea mask can downloaded from the ERA5 website. For NOC users, one land/sea mask is stored under: /projectsa/NEMO/Forcing/ERA5/era5_atmos_landseamask.nc. The new format include the ratio land/sea in each box as it comes from ERA5 atmospheric model - so you need to choose where to cut as not that many point have exactly 1 here (land only) and many have 0.99 etc; each user might want to think what to exactly use (and modify the threshold in create_LSM.py).

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 SEVERN-SWOT/BUILD_CFG/SURFACE_FORCING
ncks -d latitude,45.,55. -d longitude,350.,0. /projectsa/NEMO/Forcing/ERA5/era5_atmos_landseamask.nc ./my_era5_LSM.nc

Next, use the create_LSM.py script (in BUILD_CFG/SURFACE_FORCING) to create a mask file (ERA5_LSM.nc)::

python create_LSM.py

Visually inspect the LSM file.

3. Create WEIGHTS for the atmospheric forcing

Once the ERA5 data has been downloaded, generate weights for the atmospheric forcing on ARCHER2.

For NOC users, copy all netcdfs locally generated in /work/$USER/SEVERN-SWOT/BUILD_CFG/SURFACE_FORCING (livljobs) to ARCHER2

scp *nc $USER@login.archer2.ac.uk:/work/n01/n01/$USER/SEVERN-SWOT/BUILD_CFG/SURFACE_FORCING

This step requires that you have compiled successfully the NEMO-TOOLS in previous step

Update the namelists namelist_reshape_bilin_atmos and namelist_reshape_bicubic_atmos in BUILD_CFG/SURFACE_FORCING to reflect the year of your ERA5 data, paths, names, etc.

&grid_inputs
    input_file    = './ERA5_MSL_2019.nc'

Run the script SCRIPTS/create_weight_ERA5.sh that will generate the weight files for atmospheric forcing.

The files generated are:

remap_data_grid_atmos.nc
data_nemo_bilin_atmos.nc
weights_era5_SEVERN_bilin.nc
data_nemo_bicubic_atmos.nc
weights_era5_SEVERN_bicubic.nc

Other examples of this process can be found at: SANH Wiki page

Clone this wiki locally