Learn R Programming

⚠️There's a newer version (1.5.9.1) of this package.Take me there.

geotopbricks

R plug-in Development of CRAN R package geotopbricks (http://cran.r-project.org/web/packages/geotopbricks)

To install this package on R fram R console:


>library(devtools)

>library(reotes)

>install_github("ecor/geotopbricks")

Getting Started

Try to run the following lines of code. More material also on https://github.com/ecor/geotopbricks_doc .

library(geotopbricks)

#Simulation working path



wpath <-  'https://raw.githubusercontent.com/ecor/geotopbricks_doc/master/simulations/panola13_run2xC_test3'
## wpath (RAW VERSION) of https://github.com/ecor/geotopbricks_doc/tree/master/simulations/panola13_run2xC_test3
prefix <- get.geotop.inpts.keyword.value("SoilLiqWaterPressTensorFile",wpath=wpath)

slope <- get.geotop.inpts.keyword.value("SlopeMapFile",raster=TRUE,wpath=wpath) 
bedrock_depth <- get.geotop.inpts.keyword.value("BedrockDepthMapFile",raster=TRUE,wpath=wpath) 

layers <- get.geotop.inpts.keyword.value("SoilLayerThicknesses",numeric=TRUE,wpath=wpath)
names(layers) <- paste("L",1:length(layers),sep="")

##### set van genuchten parameters to estimate water volume 
theta_sat <- get.geotop.inpts.keyword.value("ThetaSat",numeric=TRUE,wpath=wpath)
theta_res <- get.geotop.inpts.keyword.value("ThetaRes",numeric=TRUE,wpath=wpath)
alphaVG <-  get.geotop.inpts.keyword.value("AlphaVanGenuchten",
                                           numeric=TRUE,wpath=wpath) # expressed in mm^-1

nVG <-  get.geotop.inpts.keyword.value("NVanGenuchten",numeric=TRUE,wpath=wpath) 


##### end set van genuchten parameters to estimate water volume


##### set meteo data


tz <- "Etc/GMT-1"  ## See help(timezones) In particular:
## Most platforms support time zones of the form Etc/GMT+n and Etc/GMT-n (possibly also without prefix Etc/), 
## which assume a fixed offset from UTC (hence no DST). Contrary to some expectations 
## (but consistent with names such as PST8PDT), negative offsets are times ahead of (east of) UTC, 
## positive offsets are times behind (west of) UTC.
start <-  get.geotop.inpts.keyword.value("InitDateDDMMYYYYhhmm",date=TRUE,wpath=wpath,tz=tz) 
end <- get.geotop.inpts.keyword.value("EndDateDDMMYYYYhhmm",date=TRUE,wpath=wpath,tz=tz) 

nmeteo <- get.geotop.inpts.keyword.value("NumberOfMeteoStations",numeric=TRUE,wpath=wpath)
level <- 1:nmeteo

## set meteo data

meteo <- get.geotop.inpts.keyword.value("MeteoFile",wpath=wpath,data.frame=TRUE,
                                        level=level,start_date=start,end_date=end,tz=tz)

##### end set meteo data

## IMPORTING AN OUTPUT SOIL MOISTURE PROFILE: 


wpath <-  'https://raw.githubusercontent.com/ecor/geotopbricks_doc/master/simulations/Muntatschini_pnt_1_225_B2_004'
## wpath (RAW VERSION) of https://github.com/ecor/geotopbricks_doc/tree/master/simulations/Muntatschini_pnt_1_225_B2_004
## Not run: 
SMC  <- get.geotop.inpts.keyword.value("SoilLiqContentProfileFile",
                                       wpath=wpath,data.frame=TRUE,date_field="Date12.DDMMYYYYhhmm.",
                                       formatter="%04d")

SMCz  <- get.geotop.inpts.keyword.value("SoilLiqContentProfileFile",
                                        wpath=wpath,data.frame=TRUE,date_field="Date12.DDMMYYYYhhmm.",
                                        formatter="%04d",zlayer.formatter="z%04d")

## End(Not run)


Further Presentations

Repository containing source code / scripts of conference documentiation and presentations: https://github.com/ecor/geotopbricks_doc

UseR 2019, July 10, Toulouse,France presentation's video: https://www.youtube.com/watch?v=sKMCyoOnpf8

Copy Link

Version

Install

install.packages('geotopbricks')

Monthly Downloads

436

Version

1.5.6.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Emanuele Cordano

Last Published

August 9th, 2023

Functions in geotopbricks (1.5.6.0)

get.geotop.inpts.keyword.value

Importing a GEOtop Keyword and its Value into R
create.geotop.meteo.files

Creates geotop meteo files from (a list of) 'zoo' objects
create.geotop.inpts.keyword

Creates an 'geotop.inpts' files the keyword and their values of a date.frame like the one returned by declared.geotop.inpts.keywords
replace.keyword

It replaces some keyword values of geotop.inpts file with the ones of anoter *.inpts value
set.geotop.recovery.state

This function re-writes the recovery ascii raster maps in a given folder
color.bar.raster

Graphic Representation of a Color legend of a Raster or GeotopbrickRaster object as a Color bar, inspired by the function written by John Colby
read.raster.from.url

It imports a 'RasterLayer' object in Escri-Asci format from a URL 'http(s)://....<FILENAME>.asc
read.vectorized.geotop.recovery

Reads a text file like the one generated by write.vectorized.geotop.recovery
brick.decimal.formatter

Imports a brick of raster ascii maps into a 'brick' object
brickFromOutputSoil3DTensor

brickFromOutputSoil3DTensor
write.geotop.table

Writes an R object (data.frame or zoo) into a CSV file readible by GEOtop.
vertical.aggregate.brick.within.depth

Aggregates with a mean or an addition on the vertical profile the values of a 'brick' within a certain depth and returns the vertical aggregated map
get.geotop.points

Get a sf object for Meteorological Stations or Control Points in a GEOtop simulation
write.ascii.vectorized.brick

Writes a z-layer brick referred to a time instant (e.g. date) in an ascii format like 'geotop.inpts' file.
GeotopRasterBrick-class

GeotopRasterBrick-class
write.vectorized.geotop.recovery

It writes a list object returened by get.geotop.recovery.state as a string vector or in a text file, following *.inpts or Matlab-like syntax.
KML

KML
getvalues.brick.at.depth

Interpolates the values of a 'brick' at a certain depth and returns the map of brick values at the "depth" level
max_value

max_value
min_value

min_value
bondone

Bondone Dataset
brick

brick
declared.geotop.inpts.keywords

Collects all keywords contained in the 'getop.inpts' configuration files and their values in a data frame object.
geotopbrick

geotopbrick
writeRasterxGEOtop

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

plot
write.vectorized.variable.in.string

Writes one or more variables (scalars, vectors or Rasters) in a string each, following *.inpts or Matlab-like syntax.
pointer.to.maps.xyz.time

pointer.to.maps.xyz.time
read.ascii.vectorized.brick

Read a text file containing values and matedata of a z-layer brick referred to a time instant (e.g. date). The file is formatted like an ascii format like 'geotop.inpts' file.
get.geotop.recovery.state

This function saves all spatially distrubuted information contained in the recovery folder into a comprehensive list object.
zoo-class

A GeotopRasterBrick: an object to manage raster maps provied by GEOtop!!
getProjection

It reads the CRS metadata utilzed in a GEOtop Simulation
argsParser

Parser of an argument string
color.bar

Graphic Representation of a Color bar, function written by John Colby
Ops

Ops