Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to get data for my database from some GRIB files (binary), I downloaded wgrib2, which can export GRIB-2 files to .csv and csv is very suitable for me, but some GRIB files are GRIB-1, so I used wgrib2 on them and program wgrib2 told me: "grib1 message ignored (use wgrib)", so I used wgrib, but wgrib can't export files to different format. So I tried to install recommended cnvgrib to convert GRIB-1 to GRIB-2, but still getting some errors during installation due different library versions, 32/64 bit problem, different directories etc., it's written in Fortran, that's also the problem I can't compile it easily...

So is there another way to convert GRIB-1 files to GRIB-2 (or to some non-binary format)? I can google many ways to do it, but I need help from some1 who have already converted GRIB-1 to another format, because there can be some easy way how to do that, but I have so much pain fixing installation problems, wrong configurations, Fortran version incompatibilities etc during installation of cvngrib, which I haven't even fixed and gave up...

EDIT: OK, my co-employee fixed degrib (it linked own libraries with newer system libraries), so I can run degrib now. So I run "degrib "GRIB file" -C -msg all -nMet -Csv" on GRIB-1 file and it failed the conversion to .csv with:

ERROR: In call to Grib2Convert. 
ERROR: In call to ReadGrib2Record. 
Problems with ReadGrib1Record called by ReadGrib2Record 
Inside ReadGrib1Record 
Grid projection number is 4 
Don't know how to handle this grid projection. 

I try to fix it soon, but meanwhile you can help me again!

share|improve this question
add comment

2 Answers 2

Try using degrib, which is a product of National Weather Service's Meteorological Development Lab (NWS MDL).

It can convert GRIB1 and GRIB2 to several different formats. It won't be able to convert GRIB1 directly to GRIB2, but you should be able to convert GRIB1 to CSV or another format. The tutorial page is the best source for usage information (follow the link to the man page for detailed usage info).

share|improve this answer
    
I can't even use degrib, because I run configure without errors and then make and I get error: "undefined reference to `gzopen64'". –  Salda May 30 '12 at 13:39
1  
You need to give more information if you expect useful help. What platform are you running on? It's not the easiest build process but it is worth it when you get it running. If you're on some Linux variant, try running configure with './configure CFLAGS="-O3"', then run make clean and make again. If the build process fails, check the src/degrib/ subdirectory for the 'degrib' binary--sometimes it fails on the optional components; as long as it compiled 'degrib', try running it and if it works, copy to wherever you put other binaries (e.g. /usr/local/bin) –  greenlaw May 30 '12 at 15:38
    
OK, my co-employee fixed degrib (it linked own libraries with newer system libraries), so I can run degrib now. So I run "degrib "GRIB file" -C -msg all -nMet -Csv" on GRIB-1 file and it failed the conversion to .csv with: "ERROR: In call to Grib2Convert. ERROR: In call to ReadGrib2Record. Problems with ReadGrib1Record called by ReadGrib2Record Inside ReadGrib1Record Grid projection number is 4 Don't know how to handle this grid projection." I try to fix it soon, but meanwhile you can help me again! –  Salda May 30 '12 at 17:06
    
Sorry, can't help you there. Sounds like your grid is using an unsupported projection. What type of data are you trying to convert? I would suggest contacting the people who made degrib for further help, their contact info is on the tutorial page. –  greenlaw May 30 '12 at 18:19
add comment

Use "gdal_translate" see http://www.gdal.org/gdal_translate.html

gdal_translate -of <output-format>... <infile> <outfile>

should do the job for you.

gdal_translate --formats

will give the formats; GRIB is input-only; there are lots of GIS formats available as outputs.

See http://www.gdal.org/index.html for GDAL, generally. It is a really powerful translator-library/utility-programs set.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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