https://github.com/damian-oswald/pre
A repository for the R package containing the code for the process rate estimator (PRE).
https://github.com/damian-oswald/pre
agriculture biogeochemistry modelling nitrate nitrogen
Last synced: about 2 months ago
JSON representation
A repository for the R package containing the code for the process rate estimator (PRE).
- Host: GitHub
- URL: https://github.com/damian-oswald/pre
- Owner: Damian-Oswald
- License: gpl-3.0
- Created: 2024-01-05T15:40:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-11T16:10:35.000Z (9 months ago)
- Last Synced: 2024-08-11T17:28:41.944Z (9 months ago)
- Topics: agriculture, biogeochemistry, modelling, nitrate, nitrogen
- Language: R
- Homepage: https://github.com/Damian-Oswald/process-rate-estimator
- Size: 231 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The R package PRE
=================A repository for the R package containing the code for the process rate estimator (PRE). Note that this README file contains only a very brief documentation. For a more comprehensive overview, please visit the [documentation site](https://damian-oswald.github.io/process-rate-estimator/).
# Installation
You can install this R package directly from GitHub using the following R command.
```r
install.packages("remotes")
remotes::install_github("https://github.com/Damian-Oswald/PRE")
```Next, attach the library to your search path and your good to go!
```r
library(PRE)
```# Loading the data
First, load the prepared hyperparameters.
```r
hyperparameters <- PRE::hyperparameters
```Next, load the measurements used for the modelling.
```r
measurements <- PRE::measurements
```Finally, load the parameters for this session.
```r
parameters <- getParameters()
```You may also load the parameters with some (or any number of) alternative parameter value.
```r
parameters <- getParameters(BD = 1.7)
```# Impute the missing dependent data
Calculate N2O-N:
```r
data <- getN2ON(data = measurements, parameters = parameters)
```Interpolate the missing values based on the bandwidths in `hyperparameters` (This function interpolates all values over time; and it also computes and adds the derivatives):
```r
data <- getMissing(data = data, hyperparameters = hyperparameters)
```Calculate fluxes from measurement data (This function calculates all necessary parameters from the data)
```r
data <- calculateFluxes(data = data, parameters = parameters)
```Read some details on a function.
```r
help(calculateFluxes)
```# Run the solver once
Run the solver for some column, depth and date combination.
```r
x <- PRE(data = data, column = 1, depth = 7.5, date = "2016-01-01", n = 200, parameters = parameters)
```Print out information.
```r
print(x)
```Generate a plot.
```r
plot(x)
```Produce a pairwise panel plot.
```r
pairs(x)
```# Run the solver over time
Run the solver for all the dates.
```r
x <- longPRE(data, column = 6, depth = 90, n = 10)
```Print information about the PRE results.
```
print(x)
```Plot the results to get an overview.
```r
plot(x)
```Plot the results for a specific process.
```r
plot(x, which = "Nitrification")
```Plot the overview with fixed y-axis limits.
```r
plot(x, ylim.processes = list(Nitrification = c(-50,50), Denitrification = NA, Reduction = NA))
```