How do you parse GRIB files? NCAR/NCEP reanalysis data has all fields for a certain variable for an entire year in one l

Post Reply
sonny.zinn
Posts: 354
Joined: May 8th, 2019, 1:31 pm
Registered HYSPLIT User: Yes

How do you parse GRIB files? NCAR/NCEP reanalysis data has all fields for a certain variable for an entire year in one l

Post by sonny.zinn »

[Note that the question and the answer below are recreated from a HYSPLIT FAQ site that predates this forum site. The original posting date is unknown.]

Question: How do you parse GRIB files? NCAR/NCEP reanalysis data has all fields for a certain variable for an entire year in one large GRIB file. I’d like to extract (keeping the data in GRIB format) just one or several of the grid numbers from different files into one file containing all data for a given date/time. This is a requirement to run the ARL HYSPLIT converter to get the data in a format compatible with HYSPLIT. Does any one have a GRIB extractor or editor that allows one to parse grib files?

Answer: The NCEP reanalysis grib data that you can get from NCAR already comes in synoptic format (all variables together at one time). It’s just that the reanalysis data provided by the NOAA Climate Analysis Branch (CAB) has been repackaged by variable to simplify climate studies. The CDC also get their data from NCAR.

The NCAR Archive is available in GRIB format and as a university you can join and get access, otherwise it appears to cost about $30 per gigabyte. You would need to access the 6-hrly analysis archive (2.5 deg grid, 17 pressure levels) which is called “ds090.0”. The data files would have a name starting with pgb.f00 followed by YYMMDDHH. Each grib file contains all the variables required by Hysplit and should be readable by the ARL converter without modification. Their on-line directory shows which tar volume contains the files you need. For instance if you are interested in October of 1983, the pgb files can be found on volume A04814. You may want to try to get a sample file from them for testing (pgb.f0071123118) from the NCAR ftp site.

The syntax of the Hysplit reanalysis data grib decoder would be ncr2arl [file] [lat] [lon], where file is the name of the grib file, lat and lon are the center of a 100×100 grid that is extracted from the grib file. The output goes to a file called Data.ncr. You can use the utility programs display.exe and profile.exe in the \metdata directory to view the data.ncr file. The program processes only one time period. To run Hysplit you will need to put multiple time periods into one file. You can use the copy, cat, or type commands to append multiple files into one: e.g. “type file2 >>file1”. The best way to process multiple files is to write a batch file or script to handle the process.

Roland Draxler
Post Reply

Return to “General questions on meteorological data needed for HYSPLIT”