writeRasterxGEOtop: This function uses 'writeRaster' to create .asc maps which...

View source: R/writeRasterxgeotop.R

writeRasterxGEOtopR Documentation

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

Note

It makes use of system functons. It uses *.asc format for raster files. In case the file name filename is missing and then NULL, it must be imported by the simulation geotop.inpts file.

Examples


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)




geotopbricks documentation built on May 29, 2024, 8:10 a.m.