Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using R to open grib files

I am using R to work with meteorological data. I proceed in two steps:

  1. convert grib to netcdf using the command line function ncl_convert2nc from ncar command language
  2. use package ncdf in R to import the netcdf data.

I still have one problem:

2- For some particular grib files, the conversion with ncar tool does not work. Is there other ways or trick (other than transcription into netcdf) to read grib files in R ?

Problem Answered by Dirk: 1- I would like to do automatic treatment of many files within R. Can I call ncl_convert2nc within R ? (answered by Dirk Eddelbuettel below )

like image 538
robin girard Avatar asked Jun 16 '10 14:06

robin girard


People also ask

How do I convert GRIB to CSV?

Run command grib_get_data -w time=1200 t2m_20000801. grib > temp. csv and you will get a file containing data like below. Option -w time=1200 filters data for time = 12:00 only, typing grib_get_data for help.

What does GRIB file stand for?

GRIB stands for General Regularly-distributed Infomation in Binary form. It is a data format used in meteorology to store weather data. It was first defined in 1985 by the World Meteorological Organization (WMO).


1 Answers

Regarding question 1, the answer is 'Yes' -- see help(system) and the internal=TRUE option if you want to capture results.

like image 140
Dirk Eddelbuettel Avatar answered Sep 19 '22 21:09

Dirk Eddelbuettel