Learn R Programming

geotopbricks (version 1.5.8.2)

writeRasterxGEOtop: This function uses writeRaster to create .asc maps which can be read by GEOtop

Description

This function uses writeRaster to create .asc maps which can be read by GEOtop

Usage

writeRasterxGEOtop(
  x,
  filename = NULL,
  overwrite = TRUE,
  NAflag = -9999,
  use.decimal.formatter = FALSE,
  start.from.zero = FALSE,
  keyword,
  wpath,
  suffix.ext = ".asc",
  ...
)

Arguments

x

a Raster object, see writeRaster. It can be also a RasterBrick-class object.

filename

see writeRaster. It is a vector of string or one string containing a decimal formatter (see brick.decimal.formatter) in case x is a RasterBrick-class object.

overwrite

logical. Default is TRUE, see writeRaster.

NAflag

numeric. Dafauli is -9999, see writeRaster.

use.decimal.formatter

logical value. Default is FALSE. If it is TRUE or x is a RasterBrick-class object with nlayers(x)!=length(filename) , filename is considered as one string containing a decimal formatter (e.g. "%04d", see brick.decimal.formatter). Otherwise, if filename is considered as a vector string.

start.from.zero

logical value. Default is FALSE. If TRUE the formatter starts from 0000, otherwise it starts from 0001.

keyword

geotop keyword to be used to extract the raster file name from geotop.inpts file. This is enabled if filename is equal to NULL.

wpath

simulation folder containing geotop.inpts file.

suffix.ext

charachter string to be added to the keyword value,e.g. possible suffix and extension of the raster file name. Default is ".asc".

...

further arguments of get.geotop.inpts.keyword.value or writeRaster

Examples

Run this code

library(geotopbricks)

## Simulation working path

#file <- paste0("https://raw.githubusercontent.com/ecor/geotopbricks_doc/master/template/",
#"rendena100/SnowDepthMapFile-2014-MA-mean-winter-2013-2014.asc")
file <- system.file("ex/elev.tif", package="terra")
elev <- raster(file)


elevfile <- rasterTmpFile()
extension(elevfile) <- ".asc"

writeRasterxGEOtop(x=elev,file=elevfile)



Run the code above in your browser using DataLab