Matlab/ForECMWF
<rst> You can now easily read the ECMWF GRIB files into matlab with the command 'read_ecmwf_grib'. In conjunction with the read_flex_grib command, this allows to easily plot FLEXPART output together with meteorological variables.
- Syntax:**
output=read_ecmwf_grib(filename,variables,vcoord)
- output: a structure containing grid information and the data fields
- filename: GRIB file to be opened, with full path
- variables: a cell array with the variables to be read. A list of available variables is given below.
- vcoord: the vertical coordinate to which data should be interpolated. This is currently ignored, but use 'm' (model levels) for future compatibility.
You can pass a cell array with as many data file names as you like, they will all be read in one go. Returned is a structure with elements named as the requested variable.
- Here is an example:**
To retrieve temperature (T), mean sea level pressure (MSL), integrated water vapour (IWV), and total precipitation (TP), you state:
data=read_ecmwf_grib(enfile,{'T' 'MSL' 'IWV' 'TP'},'m');
This returns then a structure named 'data', which contains the requested variables, some fundamental information about the grid, as well as some additional variables that were used for the calculation of more complex variables (such as Q for IWV).
Type 'data' (in this example) at the prompt to see all available fields that were returned by read_ecmwf_grib.
data =
ak: [91x1 double] bk: [91x1 double] p: [91x1 double] dp: [91x1 double] Ni: 360 Nj: 181 Nk: 91 La1: 90 La2: -90 Lo1: -178 Lo2: 181 T: [91x181x360 double] Q: [91x181x360 double] LSP: [181x360 double] CP: [181x360 double] MSL: [181x360 double] IWV: [181x360 double] TP: [181x360 double]
The individual elements of the structure can directly be used for calculations or plotting.
data.ak % vector of ak level parameters data.bk % vector of bk level parameters data.p % vector of mid-level pressures (hPa) data.dp % vector of level thicknesses (hPa) data.Ni % number of grid points in longitudinal direction data.Nj % number of grid points in latitudinal direction data.Nk % number of grid points in vertical direction data.La1 % southern latitude of domain data.La2 % northern latitude of domain data.Lo1 % western longitude of domain data.Lo2 % eastern longitude of domain data.T % field data for T, just for this example data.MSL % field data for MSL, just for this example ...
Another example on using 'read_ecmwf_grib' and plotting the data can be found in
~hso/projects/watersip/loops.m
- Available variables in standard operational/ERA40 ECMWF GRIB files**
- 3D fields
- U: [m/s) U-velocity
- V: [m/s) V-velocity
- W: [Pa/s) Vertical velocity
- T: [C) Temperature
- PRS: [hPa) 3D pressure
- Q: [g/kg) Specific humidity
- Z: [m^2/s^2) Geopotential (at the surface = orography)
- 2D fields
- SP: [hPa) Surface pressure
- MSL: [hPa) Mean sea level pressure
- TCC: [0 - 1) Total cloud cover
- 10U: [m/s) 10 metre u wind component
- 10V: [m/s) 10 metre v wind component
- 2T: [C) 2 metre temperature
- 2D: [C) 2 metre dewpoint temperature
- LSP: [mm) Large scale precipitation
- CP: [mm) Convective precipitation
- TP: [mm) Total precipitation
- IWV: [mm) Integrated water vapour
- LSM: [0-1) Land/sea mask
- SD: [mm (of water equivalent)) Snow depth
- SSHF: [W/m^2*s) Surface sensible heat flux
- SSR: [W/m^2*s) Surface solar radiation
- EWSS: [N/m^2*s) East/West surface stress
- NSSS: [N/m^2*s) North/South surface stress
- SDOR: [-) Standard deviation of orography
- VEG: [%) Percentage of vegetation **Warning: field may be empty!**
- SR: [m) Surface roughness **Warning: field may be empty!**
- LCC: [0 - 1) Low cloud cover **Warning: field may be empty!**
- MCC: [0 - 1) Medium cloud cover **Warning: field may be empty!**
- HCC: [0 - 1) High cloud cover **Warning: field may be empty!**
- SKT: [C) Skin Temperature **Warning: field may be empty!**
- ST: [C) Surf.temp/soil temp lev 1 (from 930804) **Warning: field may be empty!**
- SSW: [mm (of water)) Surf soil wet/soil wet lev 1 (from 930803) **Warning: field may be empty!**
</rst>