[R] Converting ncdf to geoTIFF

John Wasige johnwasige at gmail.com
Wed Jan 7 16:31:04 CET 2015


Dear all,
This is to request for help on how to convert ncdf data to geoTIFF in R
with my script below;

my script is:
library(raster)
library(ncdf)

setwd('D:/Lund2015/CRU1982_2011')

prec1 <- open.ncdf('D:/Lund2015/CRU1982_2011/
b8_cruts3.20_pre_19820101_20111231_1month_mean.nc')
print(prec1)
rast<-raster(prec1, varname="pre")

I am getting the following error:

[1] "file D:/Lund2015/CRU1982_2011/b8_cruts3.20_pre_19820101_20111231_1month_mean.nc
has 3 dimensions:"
[1] "lon   Size: 167"
[1] "lat   Size: 146"
[1] "time   Size: 360"
[1] "------------------------"
[1] "file D:/Lund2015/CRU1982_2011/b8_cruts3.20_pre_19820101_20111231_1month_mean.nc
has 1 variables:"
[1] "double pre[lon,lat,time]  Longname:precipitation
Missval:9.96920996838687e+36"> rast<-raster(prec1, varname="pre")Error
in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘raster’ for
signature ‘"ncdf"’


>

	[[alternative HTML version deleted]]



More information about the R-help mailing list