[R-sig-Geo] netcdf to raster

Sam Veloz sdveloz at ucdavis.edu
Fri Sep 4 20:25:19 CEST 2009


I am working with some climate data in Netcdf format that are available 
here:
http://hydro.engr.scu.edu/files/gridded_obs/monthly/ncfiles/

I can successfully read in the files and plot individual bands:
library(ncdf)
test.nc<-open.ncdf("gridded_obs.monthly.Tmin.1999.nc")
test.1.1999<-get.var.ncdf(test.nc,varid="Tmin",start=c(1,1,1),count=c(462,222,1))
library(raster)
image(test.1.1999) #looks good
test.raster<-raster(test.1.1999)
image(test.raster) #now North America is on its side, east coast of NA 
is now on the south side of the image

Is it possible to convert this file to a raster file without having the 
axes switched? Any guesses what I am doing wrong?

I had a similar problem using gdal_translate where the output was a 
mirror image of what it should have been.
Thanks,
Sam

-- 
****************************************************
Sam Veloz
Postdoctoral Researcher
Department of Environmental Science and Policy
University of California, Davis
sdveloz at ucdavis.edu



More information about the R-sig-Geo mailing list