[R-sig-Geo] Problems with extracting data from GRIB files from "The NCEP Climate Forecast System Version 2 (CFSv2)"

Byman bymanh at gmail.com
Sun Dec 4 13:50:39 CET 2011


Klaus

I think it is better to convert the grib2 files to NetCDF from grib, 
then use raster package in R (like you did) .

I hope this will help

Byman

On 12/4/2011 10:40 AM, k_jacobi at surf2000.de wrote:
> For a model on estimating flows from snow melt, I need forecasts on
> temperature and precipitation. Forecast data (12-hourly for the next 9
> months) I find on ftp://ftpprd.ncep.noaa.gov/pub/data1/nccf/com/cfs/prod/,
> The data are in grib2 format, and I can load each file as a rasterbrick
> and extract forecasts for certain coordinates c(x,y) like that:
>
> tmp_brick<- brick(gribfile)
> t<- extract(tmp_brick, cellFromXY(tmp_brick, c(x,y))) # time series
>
> Although the coordinates of my raster brick are bit strange I can live
> with that:
>
>> tmp_brick
> class       : RasterBrick
> dimensions  : 73, 144, 10512, 559  (nrow, ncol, ncell, nlayers)
> resolution  : 2.5, 2.5  (x, y)
> extent      : 0, 360, -92.5, 90  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +a=6371200 +b=6371200 +no_defs
>
> Unfortunately, the above mentioned url contains only forecasts for the
> last 8 days. In order to verify the suitability of the data, I need to
> precess historic forecasts (reforecasts).
>
> I found something which looked initially promising under the url
> http://nomads.ncdc.noaa.gov/data/cfsr-rfl-ts9/
>
> I can load data as a raster brick, although coordinates are even more
> strange from point of view of a GIS user:
>
> class       : RasterBrick
> dimensions  : 190, 384, 72960, 1200  (nrow, ncol, ncell, nlayers)
> resolution  : 0.938, 0.9473684  (x, y)
> extent      : 0, 360.192, 88.32963, 268.3296  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +a=6371229 +b=6371229 +no_defs
>
> Also, I received the following warning from R
>
> dec_jpeg2000: Unable to open JPEG2000 image within GRIB file.
> Is the JPEG2000 driver available?
>
> When I Try to extract values for a selected coordinate, the warning
> repeats for each raster layer and the results either are either a vector
> of 0 (precipitation rate) or strange figure around -60 for temperatures.
>
> BTW, I can load and visualize the data with Open EV_WD (but trying to
> export them has no effect).
>
> Any help how to overcome this problem (including hints to data sources
> that are easier to process) would be highly appreciated.
>
> Klaus Jacobi
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list