[R-sig-Geo] reading .grd files

Roman Luštrik roman.lustrik at gmail.com
Mon Apr 29 09:55:45 CEST 2013


Have you tried something like this?

Loading required package: sp
> x <- raster()
> x
class       : RasterLayer
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84

> x[] <- runif(ncell(x))
> plot(x)
> writeRaster(x, "myfile.grd")
class       : RasterLayer
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source : C:\Users\romunov\myfile.grd
names       : layer
values      : 3.938144e-05, 0.9999952  (min, max)

> y <- raster("myfile.grd")
> y
class       : RasterLayer
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source : C:\Users\romunov\myfile.grd
names       : layer
values      : 3.938144e-05, 0.9999952  (min, max)


Cheers,
Roman




On Mon, Apr 29, 2013 at 9:46 AM, Swagath <swagathnavin82 at gmail.com> wrote:
>
> Hello all,
>
> I  downloaded a .grd file from http://pubs.usgs.gov/of/2005/1413/gisdata/data/NAMrad_U.grd and would like to open it in R. Can anyone please tell me how to open .grd type files in R. I tried to read with raster, ncdf and also rgdal, but couldnt.
>
> Thanks a lot for your time.
>
> Swagath
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo




--
In God we trust, all others bring data.



More information about the R-sig-Geo mailing list