Hello!
Does anyone know how to open a .grd file (surfer type file) with R (or
convert this kind of file in ascii)? I tried using the RSAGA library but
failed.
rsaga.geoprocessor("io_grid", 3, list( FILE = '10s70s0e150e.sgrd'))
This are bathymetry data from the GEBCO website.
Thanks
Anne
opening a grd file (Surfer)
4 messages · Anne GOARANT, Roger Bivand, Dylan Beaudette +1 more
On Thu, 9 Oct 2008, Anne Goarant wrote:
Hello!
Does anyone know how to open a .grd file (surfer type file) with R (or
convert this kind of file in ascii)? I tried using the RSAGA library but
failed.
rsaga.geoprocessor("io_grid", 3, list( FILE = '10s70s0e150e.sgrd'))
This are bathymetry data from the GEBCO website.
The GS7BG -- Golden Software Surfer 7 Binary Grid File Format, or GSBG -- Golden Software Binary Grid File Format drivers in the rgdal package ought to open these files for reading. They are in the CRAN Windows binary package. Roger
Thanks Anne
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
On Thursday 09 October 2008, Anne Goarant wrote:
Hello!
Does anyone know how to open a .grd file (surfer type file) with R (or
convert this kind of file in ascii)? I tried using the RSAGA library but
failed.
rsaga.geoprocessor("io_grid", 3, list( FILE = '10s70s0e150e.sgrd'))
This are bathymetry data from the GEBCO website.
Thanks
Anne
GDAL
Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341
Hi Anne,
in case you are not mainly interested in importing the (potentially
large) Surfer grid into R, but want to do raster calculations instead
(e.g. using other SAGA modules), you might still be interested in the
RSAGA way of converting it:
You didn't specify the file name of the SAGA output grid (GRID
argument), the your FILE argument should point to the Surfer file (.grd).
Here a generic solution, starting with a Surfer grid temp.grd (which you
can generate with io_grid module 2 if you don't have one):
library(RSAGA)
setwd("C:/here/is/my/tempfile")
# Get some help:
rsaga.get.usage("io_grid",3)
# Convert Surfer grid temp.grd to SAGA grid temp.sgrd:
rsaga.geoprocessor("io_grid",3,
param = list(GRID = "temp.sgrd", FILE = "temp.grd"))
# Convert temp.sgrd to temp.asc with three decimal places:
rsaga.sgrd.to.esri("temp", prec = 3)
# Read grid (without header):
d = read.ascii.grid("temp", return.header = FALSE)
str(d) # only the grid data matrix
# Read grid (with header):
d = read.ascii.grid("temp")
str(d) # list: header, data matrix
Cheers
Alex
Anne Goarant wrote:
Hello!
Does anyone know how to open a .grd file (surfer type file) with R (or
convert this kind of file in ascii)? I tried using the RSAGA library but
failed.
rsaga.geoprocessor("io_grid", 3, list( FILE = '10s70s0e150e.sgrd'))
This are bathymetry data from the GEBCO website.
Thanks
Anne
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Alexander Brenning brenning at uwaterloo.ca - T +1-519-888-4567 ext 35783 Department of Geography and Environmental Management University of Waterloo 200 University Ave. W - Waterloo, ON - Canada N2L 3G1 http://www.fes.uwaterloo.ca/geography/faculty/brenning/