Tuesday, October 9, 2012

IRIS driver for GDAL

IRIS is a software by VAISALA (formerly by Sigmet) to manage and visualize meteorological radar data. It has its own data format, which is pretty well documented at their web page.

Since I've worked for a long time at the SMC, I've had to work with these kind of stuff many times, developing scripts and programs to change its format so it was possible to draw the radar data.

Besides, I started using GDAL quite a lot, and wondered why it wasn't possible to open IRIS data files directly. Since nobody did a driver for it, I decide to do it myself after reading the GDAL driver tutorial, which seemed easier than what it actually was to me.

But finally I've managed to create the driver. When compiled into the GDAL distribution, the driver allows to change IRIS data format to GTiff or any other using gdal_translate, opening the file using QGIS, serving the data with Mapserver, etc. So your life will become much easier if you have to work with IRIS data files, without having to code the format translation yourself.

This first version comes with a CAPPI example file to test it,  and supports the following data types:
  • PPI (reflectivity and speed): Plan position indicator
  • CAPPI: Constant Altitude Plan position indicator
  • RAIN1: Hourly rainfall accumulation
  • RAINN: N-Hour rainfall accumulation
  • TOPS: Height for selectable dBZ contour
  • VIL: Vertically integrated liquid for selected layer
  • MAX: Column Max Z WF W/NS Sections

I've submitted the driver at the GDAL trac so they can include it to the software if they find it convenient: https://trac.osgeo.org/gdal/ticket/4854 and commented it at their mailing list.
 But if you are impatient (or the driver isn't finally included), it is possible to add it to your GDAL after re-compiling it. The instructions:
  • Download the latest GDAL source and the driver source code.
  • Copy the iris folder into the frmts folder in your GDAL distribution.
  • Then following the steps at the GDAL driver tutorial:
    •  Edit the file gcore/gdal_frmts.h  and add the driver at the end of the list, which will look like:
      void CPL_DLL GDALRegister_IRIS(void);
    • Edit the file frmts/gdalallregister.cpp and register the driver adding a piece of code:
      #ifdef FRMT_iris
          GDALRegister_IRIS();
      #endif
    • Edit the files GDALmake.opt and GDALmake.opt.in and look for the line containing GDAL_FORMATS =, adding the word iris to the formats list in the variable.
    • Edit frmts/makefile.vc and change the EXTRAFLAGS = list adding
      -DFRMT_iris
  •  Once all this is done, just compile GDAL as usual:
    ./configure (add the flags you need here, IRIS format does not need any extra flag)
    make
    make install
 And that's all. As you can see, it would be much easier if the driver was included in the GDAL distribution!
If you have any comment or problem, please write it in the comments.
The latest SMC radar image processed from the IRIS data format