-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
112 lines (77 loc) · 4.12 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
output: github_document
bibliography: vignettes/REFERENCES.bib
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
eval = TRUE
)
Sys.setlocale("LC_ALL", "English")
```
# barrks
<!-- badges: start -->
<!-- badges: end -->
The goal of `barrks` (**bar**k beetle **r**aster **k**it for **s**easonal
development) is to calculate the phenological development of bark beetles. Rather
than implementing one specific model, the package provides a collection of
different models that can be chosen. Additionally, the models can be customized
and combined to create an individual model. The calculations can be done
spatially explicit by using raster inputs, or based on station inputs that are
available as data frames. Even though most of the implemented models describe
the phenology of *Ips typographus*, the package is not limited to particular
bark beetle species. For instance, CHAPY models the phenology of
*Pityogenes chalcographus* and the package may be extended by models for additional
bark beetle species.
The full documentation of `barrks` can be found [here](https://jjentschke.github.io/barrks/).
The following table lists the models that are implemented in the package.
| Model | Publication | Species | Help |
| ----- | ----------- | ------- | ---- |
| BSO | @Jakoby2019 | *I. typographus* | `?model.bso.apply` <br/> `?model.bso.customize` |
| Lange | @Lange2008 | *I. typographus* | `?model.lange.apply` <br/> `?model.lange.customize` |
| Jönsson | @Jonsson2011 | *I. typographus* | `?model.joensson.apply` <br/> `?model.joensson.customize` |
| PHENIPS | @Baier2007 | *I. typographus* | `?model.phenips.apply` <br/> `?model.phenips.customize` |
| PHENIPS‑Clim | - | *I. typographus* | `?model.phenips_clim.apply` <br/> `?model.phenips_clim.customize` |
| RITY | @Ogris2019 | *I. typographus* | `?model.rity.apply` <br/> `?model.rity.customize` |
| CHAPY | @Ogris2020 | *P. chalcographus* | `?model.chapy.apply` <br/> `?model.chapy.customize` |
## Installation
The latest released version of `barrks` can be installed from CRAN from within R:
```{r eval = FALSE}
install.packages('barrks')
```
The development version of `barrks` can be installed from [GitHub](https://github.com/):
```{r eval = FALSE}
devtools::install_github("jjentschke/barrks")
```
## Basic Example
`barrks` comes with sample data that will be used below.
The phenology is calculated with `phenology()` which takes all necessary inputs
as arguments. Subsequently, the rasters of emerged generations by date can be retrieved
with `get_generations_rst()`. `terra::plot()` can be used to visualize these rasters.
```{r generations-plot, message=FALSE, warning = FALSE, out.width = "100%", fig.dim=c(7,2), out.width = "100%", fig.cap = "Generations plot (\"1\" means that the first generation hatched, \"1s\" means that the first generations sister brood hatched)"}
library(barrks)
library(tidyverse)
library(terra)
# calculate phenology
pheno <- phenology('phenips-clim', barrks_data())
# plot number of prevailing generations on 4 different dates
dates <- c('2015-04-15', '2015-06-15', '2015-08-15', '2015-10-15')
get_generations_rst(pheno, dates) %>% plot(mar = c(0.2, 0.1, 2, 5),
axes = FALSE, box = TRUE, nr = 1,
cex.main = 1.9, plg = list(cex = 1.8))
```
`barrks` makes it easy to plot the development of the individual generations.
To illustrate that, a "shaded" variant of the phenology above is calculated and
the development diagram for a specific cell (called "station" in `barrks`) is
plotted for both phenology variants.
```{r development-diagram, message=FALSE, out.width = "100%", fig.dim=c(7,4), fig.cap = "Development diagram"}
pheno_shaded <- phenology('phenips-clim', barrks_data(), exposure = 'shaded')
plot_development_diagram(list(sunny = pheno, shaded = pheno_shaded),
stations_create('Example', 234),
.lty = c(1, 2),
xlim = as.Date(c('2015-04-01', '2015-12-31')))
```
# References