Title: | NUtrient Cycling and COMpetition Model Undisturbed Open Bog Ecosystems in a Temperate to Sub-Boreal Climate |
---|---|
Description: | Modelling the vegetation, carbon, nitrogen and water dynamics of undisturbed open bog ecosystems in a temperate to sub-boreal climate. The executable of the model can downloaded from <https://github.com/jeroenpullens/NUCOMBog>. |
Authors: | J.W.M. Pullens [aut, cre], R. Silveyra Gonzalez [aut], M. Bagnara [aut], F. Hartig [aut] |
Maintainer: | J.W.M. Pullens <[email protected]> |
License: | GPL |
Version: | 1.0.4.2 |
Built: | 2024-11-11 03:28:23 UTC |
Source: | https://github.com/jeroenpullens/nucombog |
This function copies the test data from the R package to a user-defined folder. This is necesarry since the model does not read the data from R.
The model needs to be run in a seperate folder and the executable can be downloaded from the provided URL. The executable needs to be copied to the folder where the data is located. The folder structure should be maintained.
If the specified folder does not exist, the function will create it at the user defined loaction. If the packages are installed on default path, then the package_folder argument can be kept empty. If not, the user has to provide the path where the R package is installed.
copytestdata(new_folder,package_folder=NULL)
copytestdata(new_folder,package_folder=NULL)
new_folder |
Folder to where the data needs to be copied |
package_folder |
Folder where the R package is installed, if this is not specified during installation leave this empty. |
JWM Pullens
The executable and the source code of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog.
## Not run: for Windows: copytestdata(new_folder="C:/testdata/",package_folder=NULL) for Linux: copytestdata(new_folder="~/testdata/",package_folder=NULL) ## End(Not run)
## Not run: for Windows: copytestdata(new_folder="C:/testdata/",package_folder=NULL) for Linux: copytestdata(new_folder="~/testdata/",package_folder=NULL) ## End(Not run)
This function returns the data from the monthly output file created by NUCOMBog.
The original model provides net primary production (NPP) as an output, the model has been modified to provide autotrophic respiration aswell. In this way the net ecosystem exchange (NEE) can be calculated, since NEE = NPP - autotrophic respiration. The micrometeorological sign convention is used in this model, e.g. a negative value for NEE means carbon uptake. All fluxes are in gram carbon per square meter per month (gC m-2 month-1). The model gives water table depth (WTD) in meters and positive values mean below ground level.
The possible outputs of the model are Net Primary Production (NPP), Net Ecosystem Exchange (NEE), heterotrohpic respiration (hetero_resp) and water table depth (WTD). The desired output needs to be specified in the setup_NUCOM function.
The getData function is integrated in all runnucom functions.
getData(setup, startval = startval)
getData(setup, startval = startval)
setup |
setup_structure described in setupNUCOM |
startval |
From which row does the output need to be loaded. Default is 1, has to be setup in the setupNUCOM function. |
JWM Pullens
The executable and the source code of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog.
## Not run: getData(setup=test_setup_singlecore) ## End(Not run)
## Not run: getData(setup=test_setup_singlecore) ## End(Not run)
The NUCOMBog R package provides an interface to the NUCOMBog model in R.
The package simulates the dynamics of five plant functional types (PFTs): graminoids, ericaceous shrubs and three groups of Sphagnum mosses (lawn, hollow and hummock mosses) on a monthly time step. The R package also calculates the monthly heterotrophic respiration and therefore the net ecosystem exchange can be calculated. The package provides a user-friendly tool that allows simulating peatlands over years/decades, under different management strategies and climate change scenarios.
For details on how to use the package, go to the help files of the functions.
This work was supported by a STSM grant to JWM Pullens from COST Action FP1304 (Profound, http://cost-profound.eu/site/)
JWM Pullens
The executable and the source code of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog.
Code to run NUCOMBog on a single core.
runNUCOM(setup, parameters = NULL)
runNUCOM(setup, parameters = NULL)
setup |
The setup structure created by setup_NUCOM function needs to be inserted here, for more information see the setup_NUCOM function help, by typing "?NUCOMBog::setup_NUCOM". |
parameters |
The parameters which are used in the model. If no parameter values are given the default values will be used. The parameters have to have the format of a dataframe with colum names: "names" and "values". See example data available via the testcopydata function. The default parameters are from Heijmans et al. 2008. |
JWM Pullens
The executable of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog
Heijmans, M., Mauquoy, D., van Geel, B., and Berendse, F. (2008). Long-term effects of climate change on vegetation and carbon dynamics in peat bogs. Journal of Vegetation Science, 19(3)
## Not run: names<-c("CO2ref","gram_Beta","eric_MaxGr") initialParameters <- c(380,0.5,65) initialParameters<-data.frame(names,initialParameters) names(initialParameters)<-c("names","values") runNUCOM(setup = test_setup_singlecore,parameters=initialParameters) ## with predefined parameters: runnucom(setup = test_setup_singlecore,parameters=NULL) ## End(Not run)
## Not run: names<-c("CO2ref","gram_Beta","eric_MaxGr") initialParameters <- c(380,0.5,65) initialParameters<-data.frame(names,initialParameters) names(initialParameters)<-c("names","values") runNUCOM(setup = test_setup_singlecore,parameters=initialParameters) ## with predefined parameters: runnucom(setup = test_setup_singlecore,parameters=NULL) ## End(Not run)
Code to run NUCOMBog parallel on multiple cores.
runparallelNUCOM(setup, clustertype, numCores = 1, parameters)
runparallelNUCOM(setup, clustertype, numCores = 1, parameters)
setup |
The setup needs to be made before by running the setup_NUCOM function. |
clustertype |
Clustertype: The model has only been tested on SOCK cluster, which is the set to default. |
numCores |
Number of Cores on which are model needs to be run (NOTE: Non-parallel runs can only be run on 1 core). Default is 1. |
parameters |
The parameters which are used in the model. If no parameter values are given the default values will be used. The parameters have to have the format of a dataframe with colum names: "names" and "values". The default parameters are from Heijmans et al. 2008. |
JWM Pullens
The executable and the source code of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog.
Heijmans, M., Mauquoy, D., van Geel, B., and Berendse, F. (2008). Long-term effects of climate change on vegetation and carbon dynamics in peat bogs. Journal of Vegetation Science, 19(3)
## Not run: !!the variable "test_setup" is from the function setupNUCOM, see the help for more information!! parallel<-runparallelNUCOM(setup = test_setup, clustertype = "SOCK", numCores = 1, parameters=initialParameters) ## End(Not run)
## Not run: !!the variable "test_setup" is from the function setupNUCOM, see the help for more information!! parallel<-runparallelNUCOM(setup = test_setup, clustertype = "SOCK", numCores = 1, parameters=initialParameters) ## End(Not run)
Code to make the setup structure needed run the model.
The data used in the example is stored in the package and can be copied to a user specified location via the copytestdata function of this package.
setupNUCOM(mainDir, climate, environment, inival, start, end, type, numFolders = 1, parallel = F, separate = F, startval = 1)
setupNUCOM(mainDir, climate, environment, inival, start, end, type, numFolders = 1, parallel = F, separate = F, startval = 1)
mainDir |
Working directory |
climate |
climate input (monthly) format: year, month, air temperature, precipitation, potential evapotranspiration (tab seperated). The potential evapotranspiration needs to be calcluated by using the Penman open water evapotranspiration. |
environment |
environment input (yearly) format: year, atmospheric co2 values, nitrogen deposition |
inival |
initial values of biomass |
start |
year in which the simulation starts |
end |
year in which the simulation ends |
type |
Which output is needed? For more information see the help of the getData function. |
numFolders |
The amount of folders that needs to be created (in case of parallel computing) |
parallel |
Run the model on parallel cores? TRUE/FALSE, default is FALSE. |
separate |
Does the model needs to be run for all parameters seperate? Default is FALSE |
startval |
From which row does the output need to be loaded. Default is 1. |
A list with paths and filenames and parameter values which can be implemented in the runnucom and the runnucomParallel function.
JWM Pullens
The executable and the source code of the model can downloaded from https://github.com/jeroenpullens/NUCOMBog.
## Not run: #Define complete file path in setup for LINUX: ~/home/...../data/ ! pay attention to the last "/" for Windows_ C://..//data// ! pay attention to the last "//" ##Single core setup: test_setup_singlecore <- setupNUCOM(mainDir="/home/jeroen/NUCOMBog_data/", climate="ClimLVMhis.txt", environment="EnvLVMhis.txt", inival="inivalLVMhis.txt", start=1766, end=1999, type=c("NEE","WTD"), parallel=F) ## Multi core setup: names<-c("CO2ref","gram_Beta","eric_MaxGr") nparvector<-50 initialParameters <- matrix(runif(n=length(names)*nparvector, min=c(300,0.1,40), max=c(500,1,80)), nrow=length(names)) initialParameters<-data.frame(names,initialParameters) names(initialParameters)<-c("names",rep("values",nparvector)) initialParameters$names<-as.character(initialParameters$names) test_setup <- setupNUCOM(mainDir="/home/jeroen/NUCOMBog_data/", climate="ClimLVMhis.txt", environment="EnvLVMhis.txt", inival="inivalLVMhis.txt", start=1766, end=1999, type=c("NEE","WTD"), parallel=T, numFolders=nparvector, separate=F, startval=1) ## End(Not run)
## Not run: #Define complete file path in setup for LINUX: ~/home/...../data/ ! pay attention to the last "/" for Windows_ C://..//data// ! pay attention to the last "//" ##Single core setup: test_setup_singlecore <- setupNUCOM(mainDir="/home/jeroen/NUCOMBog_data/", climate="ClimLVMhis.txt", environment="EnvLVMhis.txt", inival="inivalLVMhis.txt", start=1766, end=1999, type=c("NEE","WTD"), parallel=F) ## Multi core setup: names<-c("CO2ref","gram_Beta","eric_MaxGr") nparvector<-50 initialParameters <- matrix(runif(n=length(names)*nparvector, min=c(300,0.1,40), max=c(500,1,80)), nrow=length(names)) initialParameters<-data.frame(names,initialParameters) names(initialParameters)<-c("names",rep("values",nparvector)) initialParameters$names<-as.character(initialParameters$names) test_setup <- setupNUCOM(mainDir="/home/jeroen/NUCOMBog_data/", climate="ClimLVMhis.txt", environment="EnvLVMhis.txt", inival="inivalLVMhis.txt", start=1766, end=1999, type=c("NEE","WTD"), parallel=T, numFolders=nparvector, separate=F, startval=1) ## End(Not run)