Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


How to read and plot SM-DAS-2 and SM-DAS-3 Grib files

The SM-DAS-2 and SM-DAS-3 products are provided in GRIB-1 format, on a Gaussian grid at the resolution T799 and T1279, corresponding to 25 km and 16 km respectively.

There are several tools available to read and plot grib files. Three applications and examples are provided to read and plot data from grib files:

1- 1   Use GRIB API to extract time series over specific sites

We recommend to use the GRIB API software to read grib files. GRIB API can be downloaded from the ECMWF GRIB API web page. It needs to be used under Linux or UNIX systems.

For example if your SM-DAS-2 grib file is named SM-DAS-2_2009122700.grib, the command to extract data from the four nearest grid points from latitude YLAT and longitude XLON is:
grib_ls -p step,shortName -l XLAT,XLON SM-DAS-2_2009122700.grib

A more comprehensive script (and readme file) is given here with GRIB API to extract time series over four test sites. The example contains 3 directories:
- grib contains grib files of SM-DAS-2 31 for December 2009 (31 files).
- prog contains the script that needs to be used to extract SM-DAS-2 in acsii over 4 test sites.
- ascii_sites contains the times series extracted in ascii for the four test sites.
The readme file explains how to use and to modify the script. For any further questions concerning this example please contact Patricia.Rosnay@ecmwf.int.


2- 2   Use Metview-python and other python libraries for reading and plotting

For any further information about using metview-python to read and plot SM-DAS-2/SM-DAS-3, please contact David.Fairbairn@ecmwf.int.

3- Converting grib to netCDF with CDO:

  • -  The following examples use the CDO tool, which is free to download from:
    https://code.mpimet.mpg.de/projects/cdo
  • - In the terminal, we will convert the grib file from reduced Gaussian to regular lat/lon. In order to this we need to know the number of regular latitude points correspoding to the linear reduced Gaussian grid (T799~N400), which can be found at:
    https://www.ecmwf.int/en/forecasts/documentation-and-support/gaussian_n400
  • - Given there are 1600 regular latitude points (and 800 longitude points), we can convert our reduced Gaussian grid to regular lat/lon:

module load cdo

  • To convert to regular lat/lon
    cdo -R remapcon,r1600x800 -setgridtype,regular h14_2019053000.grib h14_2019053000_r.grib
  • Then convert the file from grib to netcdf:

cdo -f nc copy h14_2019053000_r.grib h14_2019053000.nc

  • Then extract the Italian domain from the global netcdf file (lon0=5, lon1=19, lat0=36, lat1=48):

cdo -sellonlatbox,5,19,36,48 h14_2019053000.nc h14_2019053000_Italy.nc

#Note that the size of the file is vastly reduced (h14_2019053000.nc ~ 25 mb, h14_2019053000_Italy.nc ~ 70 kb)!

2.1 Extract time series with Metview:
Metview script is given together with a readme file here to read SM-DAS-2 with Metview and to extract time series over four test sites (provides ascii files).

2.2 Map SM-DAS-2 with Metview:
Metview script is given together with a readme file here to map SM-DAS-2 with Metview (provides png files).

For any further question concerning this example or on how to read or map SM-DAS-2 using Metview, please contact Patricia.Rosnay@ecmwf

.int.


3. Using Matlab

Matlab is no longer supported at ECMWF. However, it is possible to read GRIB files using Matlab, which can be used on Unix, Linux and Windows systems. The library can be downloaded from read_grib_1.5.tar.gz .

Tools to read SM-DAS-2 from matlab are available at example_readgrib.rar.

For any further question on how to read SM-DAS-2 using Matlab, please contact luca.brocca@irpi.cnr.it

...