R/as.raster.R

Defines functions as.raster

Documented in as.raster

as.raster <- function(bathy) {
	
	if (!is(bathy,"bathy")) stop("Objet is not of class bathy")

	lat <- as.numeric(colnames(bathy))
	lon <- as.numeric(rownames(bathy))

	r <- raster::raster(ncol = nrow(bathy), nrow = ncol(bathy), xmn = min(lon), xmx = max(lon), ymn = min(lat), ymx = max(lat))
	raster::values(r) <- as.vector(bathy[,rev(1:ncol(bathy))])

	return(r)

}
ericpante/marmap documentation built on April 4, 2023, 2:56 p.m.