Converting Grib To Netcdf

L. Larrabee Strow

We are changing our NWP and re-analysis file formats over from grib to netcdf. Netcdf can be read much more quickly and easily. The price is that it takes a lot of time to convert grib to netcdf, but that is a one-time operation. In addition, we can now get ERA-Interim and MERRA re-analysis files already in netcdf.

This document summarizes how to get ECMWF files from JPL and uses them also as an example of how to convert these grib files to netcdf.

Download ECMWF Files from JPL

Larrabee has a script to do this on tempest@jpl, just ask for help. Usually I put them in /asl/ftp/incoming.

Move ECMWF Files

Using /home/strow/bin/move_jpl2ecmwf_lls move the files from /asl/ftp/incoming to /asl/data/ecmwf_nc/yyyy/mm. This script also renames the files (back to their original names, instead of the names given them by JPL).

Convert to Netcdf

I have a Matlab wrapper (of shell commands) to convert files. You can call these shell commands any way you like, this is just an example. /home/strow/Matlab/Grib/convert_grib_to_netcdf_maya.m does the conversion.

Just make sure you don’t move files during the conversion. The shell commands are in /asl/opt/strow/bin. These should be moved one day, probably to /asl/opt/bin. They were compiled with the Intel compiler.

Future Work

Since I can download days to months at a time, I don’t think it is worthwhile automating that part of this process. But, probably the last two steps should be automated to some degree.