Repository navigation
3. Download CMEMS Data
Boundary conditions for the SANH model configuration were generated using Copernicus (CMEMS) data. Data can be downloaded from the Copernicus website using the motu client. Note, you will need to set up a Copernicus account and have already completed the earlier steps here.
The motu client requires a separate working environment, which we can set up using:
conda create --name motu_env python=3.7
To activate the environment, use:
conda activate motu_env
Finally, install the motuclient:
python -m pip install motuclient==1.8.4 --no-cache-dir
When no longer needed, the environment can be deactivated using:
conda deactivate motu_env
For the SANH boundary conditions, we need to download the following variables from the global reanalysis product (GLOBAL_MULTIYEAR_PHY_001_030):
- Temperature
- Salinity
- Sea surface height
- U velocity component
- V velocity components
An example of how to download an individual day (e.g. 1st Jan 1993) is:
python -m motuclient --motu http://my.cmems-du.eu/motu-web/Motu --service-id GLOBAL_MULTIYEAR_PHY_001_030-TDS --product-id cmems_mod_glo_phy_my_0.083_P1D-m --longitude-min 50 --longitude-max 115 --latitude-min -10 --latitude-max 30 --date-min "1993-12-31 12:00:00" --date-max "1993-12-31 12:00:00" --depth-min 0.493 --depth-max 5727.918000000001 --variable thetao --variable so --variable zos --out-name "CMEMS_1993_12_31_download.nc" --user USERNAME --pwd PASSWORD
USERNAME and PASSWORD are the credentials you use to log in to your Copernicus account.
To download daily data for an entire year, use:
. ./download_CMEMS.sh
. ./download_CMEMS_UV.sh
Edit the scripts for the year you want to download. For each year, also download the day before and after (e.g. for 1993, there will be extra requests for 31st Dec 1992 and 1st Jan 1994), and any leap years, as these are not automatically included in the download scripts.
Downloading all the required variables takes a long time, roughly 4 hours per year with a good, consistent connection. The Copernicus system can only cope with one data request per user at a time, so the scripts cannot run simultaneously.
Due to the time and number of data files that need to be downloaded, data omissions are common. To spot which files are missing, we can use the *.txt files for the CMEMS downloads.
First, navigate to the directory you stored the variables in, e.g.::
cd $CMEMS
Then see how many files have been downloaded using the command::
ls -l . | egrep -c '^-'
There should be 367 files in the directory (368 if its a leap year). If any files are missing, they will need to be downloaded individually.
The Download1.txt (CMEMS temp, sal) and Download2.txt (U,V) contain the log of all data being downloaded. Search for any occurrences of ''ERROR'' and manually download the missing files into the appropriate directory. Most of the time, data omissions are due to inconsistent connection between your local machine and Copernicus, so multiple data omissions are likely to occur consecutively.
To generate the open boundary conditions (OBC), PyNEMO interpolates data from 12:00 to 11:59 the next day. As such, PyNEMO requires data before and after the day of OBC generation, e.g. generating OBC for the 1st January 1993 requires data for the 31st December 1992, and the 2nd January 1993.
Occasionally, the date before/after does not exist, e.g. ERA5 data only begins on the 1st January 1993. If this is the case, duplicate the date (i.e. 1st January 1993) and rename it to the previous date (31st December 1992). We then trick PyNEMO into reading the duplicated date as the day before (see OBC generation).