write.arcgrid {readmet}R Documentation

function to write data (read from DMNA file) into an ESRI ArcInfo gridded ASCII file

Description

This function writes a 2D matrix into an ESRI ArcInfo gridded ASCII file that can be easily imported into most geographic information systems (GIS)

Usage

write.arcgrid(z,file,xlen,ylen,xll,yll,delta,grid,naval=-9999)

Arguments

z

2D matrix containing tha data

file

name (incuding path, if needed) of the file to write to

xlen, ylen

number of data alon x and y axis, resp.

xll, yll

position of the lower left (i.e. southwest) corner

delta

grid spacing

grid

a list containing grid parameters. Instead of providing xlen,ylen,xll,yll, and delta individually, containing these values way be provided. For example, such a list is returned when calling dmna.grid

naval

value written to file instead of NA and +/-Inf

Details

The standard plotting functions for R plot columns along the x axis and rows along the y axis. Hence the matrix is rotated 90 degrees left (compared to write.table or write.csv) to yield the same orientation of the data when plotted in R and in GIS.

Value

nothing.

Note

This function was added in version 1.3.0.

Author(s)

Clemens Druee

References

Wikipedia entry on Esri grid : https://en.wikipedia.org/wiki/Esri_grid

See Also

read.dmna, dmna.grid

Examples

# read data and grid info
infile <- system.file("extdata", "example-grid.dmna", package="readmet")
so2 <- read.dmna(infile)
grid <- dmna.grid(infile)
# write file
write.arcgrid(so2, file = "myfile.grid", grid = grid)
# show head of file
writeLines(readLines("myfile.grid", n=7))
# delete file
file.remove("myfile.grid")

[Package readmet version 1.7.1 Index]