Station data


library(barrks)

To calculate the phenology based on station data, phenology() should be called with a data frame as input. It should have a date column whose values need to be interpretable by as.Date(), and a station column that specifies the name of the respective station. Additional columns provide the actual parameters used by the model. This vignette uses the station data provided by barrks as sample data.


station_data <- barrks_data('stations')

head(station_data, 10)
#> # A tibble: 10 x 9
#>    date       station  tmean  tmin  tmax   rad sunrise sunset daylength
#>    <date>     <chr>    <dbl> <dbl> <dbl> <dbl>   <dbl>  <dbl>     <dbl>
#>  1 2011-01-01 Freiburg   0.1  -0.4   0.7  228.     499   1006      8.45
#>  2 2011-01-02 Freiburg  -0.1  -3.4   2.2  642.     499   1007      8.47
#>  3 2011-01-03 Freiburg  -3.4  -8.4   0.3 1708.     499   1008      8.48
#>  4 2011-01-04 Freiburg  -3.7  -7.6  -1.4 1194.     499   1009      8.5 
#>  5 2011-01-05 Freiburg  -2.2  -6.5   2.4 1639.     499   1010      8.52
#>  6 2011-01-06 Freiburg   7.8  -2.6  12.8  356.     499   1011      8.53
#>  7 2011-01-07 Freiburg  11.5   9.1  14.9  336.     498   1012      8.57
#>  8 2011-01-08 Freiburg  12.8   7.7  16.2  736.     498   1013      8.58
#>  9 2011-01-09 Freiburg   8.7   4    13.3  169.     498   1015      8.62
#> 10 2011-01-10 Freiburg   2.9   1.9   4.1  397.     497   1016      8.65

To illustrate the beetle development at a specific station, plot_development_diagram() is used. It is possible to add several phenology objects to the plot that will be displayed as lines. The area between the lines of the particular generations will be filled if the respective generation appears in all phenology objects.


# calculate phenology with different parameters
pheno_sunny <- phenology('phenips-clim', station_data, exposure = 'sunny')
pheno_shaded <- phenology('phenips-clim', station_data, exposure = 'shaded')
pheno_last <- phenology('phenips-clim', station_data, exposure = 'shaded',
                        onset_mode = 0.9)
#> Error in (function (classes, fdef, mtable) : kann keine vererbte Methode finden für Funktion 'nlyr<-' für Signatur '"SpatRaster", "NULL"'

# plot development diagram
plot_development_diagram(list('sunny' = pheno_sunny,
                              'shaded' = pheno_shaded,
                              'shaded + late onset' = pheno_last),
                         xlim = as.Date(c('2011-03-15', '2011-12-31')),
                         .lty = 1:3)
#> Error in eval(expr, envir, enclos): object 'pheno_last' not found