Re: [R] using grib files in R

2010-08-06 Thread Roger Bivand

In addition to Paul's advice, you may find it useful to know that *.grb files
may be read by GDAL drivers in the rgdal package, so that for
http://gribs.ocens.net/NorthEurope.wind.grb.bz2, after downloading and
uncompressing, GDALinfo("NorthEurope.wind.grb") shows the 122 bands in the
file, and readGDAL() will read them into an sp object. Other software may be
needed to access metadata. You will probably also need to set the missing
values to NA manually - in this example file it was necessary to say:

grib <- readGDAL("NorthEurope.wind.grb")
is.na(grib$band1) <- grib$band1 > 100
image(grib, attr=1)

Hope this helps,

Roger


Paul Hiemstra wrote:
> 
> Hi Janet,
> 
> This question would probably be more suited for the r-sig-geo mailing 
> list. In my view, the best option is to use a tool like wgrib to dump 
> the layer you want from the grib file to text and then read it into R 
> using e.g. read.table. See also the spatial data classes provided to R 
> through the sp-package. A good book on spatial data in R is the book by 
> Bivand et al [1]. The spatial task view is another good source of 
> information [2].
> 
> regards,
> Paul
> 
> [1] 
> http://www.springer.com/public+health/epidemiology/book/978-0-387-78170-9
> [2] http://cran.r-project.org/web/views/Spatial.html
> 
> On 08/05/2010 06:37 PM, Janet Nye wrote:
>> I am not new to R, but I am new to .grib files.  I am downloading some
>> climate data and I would like to analyze it in R.  R has a nice netcdf
>> package, but I don’t see any package available to deal specifically
>> with grib files.  I see a few posts from other people using grib files
>> in R.  However, I was unclear if they used grib files in a different
>> software program and then imported the data somehow into R.  Is it
>> possible to use read grib files in R and then use the data?  If so,
>> could someone point me to a book/website that might help me learn how
>> to do this?  Any advice would be helpful…I am beginning to think I
>> should use a different software program, but I’d like to use R!
>>
>> Thanks,
>> Janet
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> -- 
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 253 5773
> http://intamap.geo.uu.nl/~paul
> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 


-
Roger Bivand
Economic Geography Section
Department of Economics
Norwegian School of Economics and Business Administration
Helleveien 30
N-5045 Bergen, Norway

-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-grib-files-in-R-tp2315130p2316226.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using grib files in R

2010-08-06 Thread Paul Hiemstra

Hi Janet,

This question would probably be more suited for the r-sig-geo mailing 
list. In my view, the best option is to use a tool like wgrib to dump 
the layer you want from the grib file to text and then read it into R 
using e.g. read.table. See also the spatial data classes provided to R 
through the sp-package. A good book on spatial data in R is the book by 
Bivand et al [1]. The spatial task view is another good source of 
information [2].


regards,
Paul

[1] 
http://www.springer.com/public+health/epidemiology/book/978-0-387-78170-9

[2] http://cran.r-project.org/web/views/Spatial.html

On 08/05/2010 06:37 PM, Janet Nye wrote:

I am not new to R, but I am new to .grib files.  I am downloading some
climate data and I would like to analyze it in R.  R has a nice netcdf
package, but I don’t see any package available to deal specifically
with grib files.  I see a few posts from other people using grib files
in R.  However, I was unclear if they used grib files in a different
software program and then imported the data somehow into R.  Is it
possible to use read grib files in R and then use the data?  If so,
could someone point me to a book/website that might help me learn how
to do this?  Any advice would be helpful…I am beginning to think I
should use a different software program, but I’d like to use R!

Thanks,
Janet

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
   



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 253 5773
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using grib files in R

2010-08-05 Thread Janet Nye
I am not new to R, but I am new to .grib files.  I am downloading some
climate data and I would like to analyze it in R.  R has a nice netcdf
package, but I don’t see any package available to deal specifically
with grib files.  I see a few posts from other people using grib files
in R.  However, I was unclear if they used grib files in a different
software program and then imported the data somehow into R.  Is it
possible to use read grib files in R and then use the data?  If so,
could someone point me to a book/website that might help me learn how
to do this?  Any advice would be helpful…I am beginning to think I
should use a different software program, but I’d like to use R!

Thanks,
Janet

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.