To summarise, you need three separate data files from the reanalysis data:
- Pressure level data (or model levels)
- Surface variable data
- Fixed data.
You’ll be required to select which surface varibles you want to download, as well as which pressure levels, too. The land-sea mask is just a single file. According to 夏朗的芒果, we just need to download UNGRIB - Required Fields
The details of the Python API are here, it’s well explained so I will only summarise here what you need to do:
- Register on the ECMWF site
- Download an access key to placed on the computer or system you are downloading to.
- Install the ecmwfapi Python module.
- Either write your own python script using the API documentation above, or have the ECMWF web interface generate one for you. (Click the ‘view MARS request’ after making your selections, and then copy the Python script that is displayed. An example python script looks like this:
ECMWF provide the data in two different file formats, GRIB (gridded-binary) and netCDF (.nc files). WPS comes with the ungribber tool (ungrib.exe) so I’ve gone for the grib data format here. (Selected by default in the Python download script).
Now we need to ‘ungrib’ data to convert into the WPS intermediate file format, before running metgrid. This has to be done in two stages - one for the surface and pressure level data, and one for the land-sea mask. This is because the land-sea mask has a ‘start date’ of 1989-01-01 if you try to run ungrib with the date of your case study, ungrib will fail, complaining that the dates specified could not be found.
Link the correct Vtable to the file name “Vtable” in the directory. The Vtable can be found in
Link GRIB files to the correct file names in the run directory../link_grib.csh ERA-Int_pl_20150806_20150809_0.75.grib
Ungribbing the pressure level data.In the namelist.wps file, I set the the
&ungribsection to the following:out_format = 'WPS',prefix = 'PL'./ungrib.exe
Repeat again for the surface data:./link_grib.csh ERA-Int_sfc_20150806_20150809_0.75.gribout_format = 'WPS',prefix = 'SFC'./ungrib.exe
Repeat again for the fixed data:start_date = '1989-01-01_12:00:00','1989-01-01_12:00:00',end_date = '1989-01-01_12:00:00','1989-01-01_12:00:00',...out_format = 'WPS',prefix = 'FIX'./ungrib.exe
You should have these files now:FIX:1989-01-01_12 PL:2015-08-07_12 PL:2015-08-08_06 SFC:2015-08-07_06 SFC:2015-08-08_00PL:2015-08-07_00 PL:2015-08-07_18 PL:2015-08-08_12 SFC:2015-08-07_12 SFC:2015-08-08_06PL:2015-08-07_06 PL:2015-08-08_00 SFC:2015-08-07_00 SFC:2015-08-07_18 SFC:2015-08-08_12
If you are using the sea surface temparatures field from the ECMWF data, you’ll need to make a few changes to the
METGRID.TBL file for it to correctly interpolate and mask the sea surface temparatures around land. In the
METGRID.TBL file (located in
WPS/metgrid/), change the entry of the SST field to the following:
The changes are to make the interp_mask use the LANDMASK mask instead of LANDSEA (the default), and to change the interpolation option slightly. Without the changes, Declan found that for his inner domain the sea surface temperatures were incorrectly masked, and had been interpolated over land as well. Although metgrid.exe did not complain when run, the met files generated caused an error when real.exe was run - generating an error message saying:
The changes to METGRID.TBL should remedy this error message.
Before running metgrid, there is one last change to make to the namelist.wps file:
Hopefully it will produce all the input met files needed, and correctly interpolated. It’s a good idea before running real.exe and wrf.exe to check that the fields look reasonable. In particular, check the SST field if you are using sea-surface temperatures. Check the nested domains as well - I found that my SST field had been incorrectly interpolated in the inner domain, which required the change to the METGRID.TBL file above. Ncview is a useful utility for checking the met files generated by metgrid.