2

I have a large set of .pgrbf.grb2 files downloaded from the Climate Prediction Center, and I need to run statistical analyses comparing them to data that was produced locally in .csv format. I'm not very familiar with the GRIB2 format, so I'm not really sure how to best go about this.

My dataset from the CPC consisted of ~250 separate files, so I'm trying to script something to easily process them all. (My .csv data was taken every hour and the CPC data is every six hours, so I'll need to ultimately remove most of my data, compare to the relevant CPC data, and then perform the analyses. Getting the CPC data into one large output file would therefore be superb.) I tried using wgrib2 in the below code, but it returns "FATAL ERROR: packing type 40 not supported" for each file (the script is written correctly; manually running wgrib2 <filename> -csv output returns the same error).

#!/bin/bash
FILES=GRIBFiles/*
CNT=0
for f in $FILES
do
    filename="${f##*/}"
    wgrib2 GRIBFiles/"$filename" -csv GRIBFiles/CSVFiles/$CNT.csv
    let "CNT++"
done

I'm also trying pygrib, but I'll be honest: I don't really understand what's going on in the documentation so I don't know how to get the data into a more usable format.

I'll be using various Python modules to conduct the statistical analyses, so as long as the format the data are converted to is general-use (Excel, CSV, etc.) then I'll be able to manipulate it for the statistics.

1

"FATAL ERROR: packing type 40 not supported"

wgrib2 was compiled without support for jpeg2000 compression (packing 40). You tried reading a grib record that was compressed with jpeg2000.

  • can you expand on the answer please. A short answer is susceptible to the delete vote. see help. I admit there is not a real question(?), just several statements. But can you help him understand where you found the information, how it got that way and/or how to fix it? – Brad Nesom Oct 21 '14 at 4:48
1

The bug in Fedora 20 has been reported and an update is being tested. The Fedora version was accidentally compiled without jpeg2000 support.

If OP is using the Fedora version, the OP can downgrade as suggested by the previous poster or build wgrib2.

http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/compile_questions.html

0

This excellent Example using the WGrib Utility will show you how to do it. ( See the first answer ).

It also gives information on how to use GDal to convert to a Tiff format as well.

0

I also encountered the same error. I am sure the command line is correct since I was using it few weeks ago and it worked find. I guess the new release (at least for Fedora20 x86_64) has some issues. I fixed the problem by downloading an older version "1.9.8-2.fc20.x86_64.rpm" from the following link: http://www.rpmfind.net/linux/rpm2html/search.php?query=wgrib2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.