diff --git a/articles/dynamAedes_02_local.html b/articles/dynamAedes_02_local.html index f7b4fbd..ae4171f 100644 --- a/articles/dynamAedes_02_local.html +++ b/articles/dynamAedes_02_local.html @@ -673,18 +673,18 @@
tail(xcells)
# 25% 50% 75% day
-# V55 65 65 65 55
-# V56 62 62 62 56
-# V57 64 64 64 57
-# V58 71 71 71 58
-# V59 77 77 77 59
-# V60 78 78 78 60
+# V55 54 54 54 55
+# V56 56 56 56 56
+# V57 59 59 59 57
+# V58 60 60 60 58
+# V59 63 63 63 59
+# V60 68 68 68 60
We will describe the uncompressed model application for -Ae. albopictus at the punctual scale by using a simulated -temperature dataset. The uncompressed model return the number -of simulated individuals not only for the three main compartments, -i.e. life stages (eggs, juveniles and adults), but also the number of -simulated individuals within each sub-compartments, such as 2-days old -eggs or host-seeking adult females.
-At the punctual scale, the model only requires a weather station -temperature time series provided as a numerical matrix (in degree -Celsius). For the purpose of this tutorial, we simulate a 1-year long -temperature time series and, for the sake of brevity, we will not -discuss the chunk of code already presented in other tutorials.
+Ae. albopictus at the punctual and regional scales by using a +simulated temperature dataset. The uncompressed model return +the number of simulated individuals not only for the three main +compartments, i.e. life stages (eggs, juveniles and adults), but also +the number of simulated individuals within each sub-compartments, such +as 2-days old eggs or host-seeking adult females.For each species, the sub-compartments are arranges as follows.
+
-#Load packages
-# simulate temperatures
-library(eesim)
-
-# data manipulation and plotting
-library(ggplot2)
-Sys.setlocale("LC_TIME", "en_GB.UTF-8")
At the punctual scale, the model only requires a temperature time +series, recorded by e.g. a weather station, provided as a numerical +matrix (in degree Celsius). For the purpose of this tutorial, we +simulate a 1-year long temperature time series and, for the sake of +brevity, we will not discuss the chunks of code already presented in +other tutorials.
# [1] ""
-++ndays <- 365*1 #length of the time series in days set.seed(123) sim_temp <- create_sims(n_reps = 1, @@ -561,13 +569,14 @@
2. Input data and punctual ## convert float temperatures to integer df_temp <- data.frame("Date" = sim_temp[[1]]$date, "temp" = sim_temp[[1]]$x) w <- t(as.integer(df_temp$temp*1000)[format(as.Date(str)+1,"%j"):format(as.Date(endr)+1,"%j")])
Running the model specifying compressed.output = FALSE
,
-this will return the number of simulated individuals for each
-sub-compartments.
+It is crucial to run the model the model specifying the argument +
+compressed.output = FALSE
. This will return the number of +simulated individuals for each sub-compartments.simout <- dynamAedes.m(species="albopictus", scale="ws", jhwv=habitat_liters, @@ -583,37 +592,42 @@
2.2 Run the model verbose=FALSE, seeding=TRUE)
A first summary of simulations can be obtained with:
-+summary(simout)
-# Length Class Mode # 1 dynamAedesClass S4
The simout object is a S4 object where simulation outputs -and related details are saved in different slot:
-For example, the number of model iterations is saved in:
-+The simout object is a S4 object where the outputs of the +model and related details are saved in different slot. For example, the +number of model iterations is saved in:
+simout@n_iterations
-# [1] 1
The simulation output is stored for each sub-compartments. -
-simout@simulation
is a list where the the -first level stores simulation of different iteration, -while the secondcorresponds to the simulated days in -the corresponding iteration. If we inspect the first iteration, we -observe that the model has computedlength(simout[[1]])
-days, since we have started the simulation on the 1st of July and ended -on the 1st of August.+The model output, i.e. the number of simulated individuals, is stored +in
+simout@simulation
. For the uncompressed model, +simout@simulation
is a list where the +first level stores the simulation of different +iteration, while the second corresponds to the +simulated days in the corresponding iteration. If we inspect the first +iteration, we observe that the model has computed +length(simout[[1]])
days, since we have started the +simulation on the 1st of July and ended on the 1st of August.length(simout@simulation[[1]])
-# [1] 30
The third level corresponds to an array with the -quantity of individuals for each compartment (rows) in each day for each -sub- compartments If we inspect the 1st and the 15th day within the +
The third level corresponds to an array reporting, +for a given iteration and a given day, the number of individuals +belonging to each compartment (rows) for each sub-compartment (the third +dimension of the array, noted as sc1-…-scN in the +print). As example, if we inspect the 1st and the 15th day within the first iteration, we obtain a matrix having:
-+++class(simout@simulation[[1]][[1]])
+# [1] "array"
simout@simulation[[1]][[1]]
-# , , sc1 # @@ -662,7 +676,7 @@
3. Analyse the results# juvenile 0 # adult 0 # diapause_egg 0
+simout@simulation[[1]][[15]]
-# , , sc1 # @@ -711,30 +725,42 @@
3. Analyse the results# juvenile 1 # adult 0 # diapause_egg 0
We can use the auxiliary functions of the package to analyse the -results.
+-3.1 Derive abundance 95% CI for a specific sub-compartment +
2.4 Derive abundance 95% CI for a specific sub-compartment
-We now compute the interquantile range abundance for the host-seeking -sub-compartment of the simulated population using the function -adci.
-++We can use the auxiliary functions of the package to analyse the +results. We now compute the interquantile range abundance for the +host-seeking sub-compartment of the simulated population using the +function adci.
++head(hs)# Retrieve the maximum number of simulated days dd <- max(simout) - # Compute the inter-quartile of abundances along the iterations -breaks=c(0.25,0.50,0.75) -ed=1:dd - +breaks <- c(0.25,0.50,0.75) +ed <- 1:dd hs <- adci(simout, eval_date=ed, breaks=breaks, stage="Adults", sub_stage = "Host-seeking" ) - -head(hs) -tail(hs)
+# X25. X50. X75. day stage sub_stage +# 1 0 0 0 1 Adult Host-seeking +# 2 0 0 0 2 Adult Host-seeking +# 3 0 0 0 3 Adult Host-seeking +# 4 0 0 0 4 Adult Host-seeking +# 5 0 0 0 5 Adult Host-seeking +# 6 0 0 0 6 Adult Host-seeking
++tail(hs)
# X25. X50. X75. day stage sub_stage +# 25 1 1 1 25 Adult Host-seeking +# 26 1 1 1 26 Adult Host-seeking +# 27 4 4 4 27 Adult Host-seeking +# 28 1 1 1 28 Adult Host-seeking +# 29 1 1 1 29 Adult Host-seeking +# 30 1 1 1 30 Adult Host-seeking
We can now simply plot it.
-+ggplot(hs, aes(x=day, y=X50., group=factor(stage), col=factor(stage))) + ggtitle("Host-seeking Ae. albopictus Interquantile range abundance") + geom_ribbon(aes(ymin=X25., ymax=X75., fill=factor(stage)), @@ -744,7 +770,6 @@
3.1 Derive abunda geom_line(linewidth=0.8) + ylim(0,10)+ labs(x="Date", y="Interquantile range abundance", col="Stage", fill="Stage") + -# facet_wrap(~stage, scales = "free_y") + theme_classic() + theme(legend.pos="bottom", text = element_text(size=16), @@ -753,14 +778,14 @@
3.1 Derive abunda
-4. Regional model +
3. Regional scale model
We can now repeat the exercise for a regional scale model.
-+-# terra 1.7.65
+gridDim <- 20 # 5000m/250 m = 20 columns and rows xy <- expand.grid(x=1:gridDim, y=1:gridDim) varioMod <- vgm(psill=0.5, range=100, model='Exp') # psill = partial sill = (sill-nugget) @@ -800,7 +825,7 @@
4. Regional modelcc <- df_temp[,c("x","y")]
We run now the regional model keeping the same settings defined for the punctual scale model.
-+-simout <- dynamAedes.m(species="albopictus", scale="rg", jhwv=habitat_liters, @@ -815,7 +840,7 @@
4. Regional model compressed.output=FALSE, seeding=TRUE, verbose=FALSE)
diff --git a/articles/dynamAedes_04_uncompModel_files/figure-html/unnamed-chunk-18-1.png b/articles/dynamAedes_04_uncompModel_files/figure-html/unnamed-chunk-18-1.png new file mode 100644 index 0000000..e8519b9 Binary files /dev/null and b/articles/dynamAedes_04_uncompModel_files/figure-html/unnamed-chunk-18-1.png differ diff --git a/articles/dynamAedes_05_spreader.html b/articles/dynamAedes_05_spreader.html index e16d195..fb73a70 100644 --- a/articles/dynamAedes_05_spreader.html +++ b/articles/dynamAedes_05_spreader.html @@ -359,7 +359,7 @@+summary(simout)
-# Summary of dynamAedes simulations: # ---------------------------------- @@ -830,27 +855,22 @@
4. Regional model# Water in the System: 1 L # Min days with population: 30 # Max days with population: 30
--# Retrieve the maximum number of simulated days -dd <- max(simout) - -# Compute a raster with the median of the iterations -breaks <- c(0.50) -ed <- 1:dd -hs.r <- adci(simout, eval_date=ed, breaks=breaks, - stage="Adults", - sub_stage = "Host-seeking", type="N")
-# REGIONAL scale input simulation provided
-# Uncompressed simulation provided
-# Computing spatio-temporal abundance estimate at substage level.
-# Computing sub-compartment Host-seeking Adults abundance...
++# inspect the raster -hs.r$`Host-seeking_q_0.5` - -# plot the raster with the median host-seeking abundace +hs.r$`Host-seeking_q_0.5`
+# class : SpatRaster +# dimensions : 20, 20, 30 (nrow, ncol, nlyr) +# resolution : 250, 250 (x, y) +# extent : 1220000, 1225000, 5700000, 5705000 (xmin, xmax, ymin, ymax) +# coord. ref. : +# source(s) : memory +# names : day1, day2, day3, day4, day5, day6, ... +# min values : 0, 0, 0, 0, 0, 0, ... +# max values : 0, 0, 0, 0, 0, 0, ...
- ++# plot the raster with the median host-seeking abundace plot(hs.r$`Host-seeking_q_0.5`$day30)
2. Pre-processing #add temporal ID to the observational dataset and merge the missing dates tmp <- templatedf %>% - mutate(temporalID=paste0(year, "_", stringr::str_pad(week(sampling_date), 2, pad="0"))) %>% + mutate(temporalID=paste0(year, "_", stringr::str_pad(week(sampling_date), 2, pad="0"))) %>% select(temporalID, value, delta_week) %>% full_join(mySeq, by="temporalID" ) %>% arrange(date) @@ -500,7 +500,7 @@
3.1 User-defined sampling period
cols <- c("Observed" = "#E1BE6A", "Post-processed" = "#40B0A6" ) -bind_rows(templatedf %>% +dplyr::bind_rows(templatedf %>% mutate(week = lubridate::week(sampling_date), field = "Observed") %>% select(week, value, field), diff --git a/news/index.html b/news/index.html index cc33cb5..dcc6090 100644 --- a/news/index.html +++ b/news/index.html @@ -72,9 +72,10 @@
Changelog
dynamAedes 2.2.8
- Adds reference file for life history traits
-AedeslifeHistoryList
.- Adds function
-spread
.- Adds vignettes 4 (Uncompressed output) and 5 (spread).
+- Adds function
+spreader
.- Adds vignettes 4 (Uncompressed output) and 5 (spreader).
- Fixes minor issues in
+adci
.- check summary print for punctual and local scale: done
dynamAedes 2.2.7
diff --git a/pkgdown.yml b/pkgdown.yml index 98b7903..1d4d102 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -7,5 +7,5 @@ articles: dynamAedes_03_regional: dynamAedes_03_regional.html dynamAedes_04_uncompModel: dynamAedes_04_uncompModel.html dynamAedes_05_spreader: dynamAedes_05_spreader.html -last_built: 2024-01-08T13:24Z +last_built: 2024-01-08T14:55Z