Skip to content

Commit 5f311bb

Browse files
update
1 parent cfc22fe commit 5f311bb

4 files changed

Lines changed: 58 additions & 14 deletions

File tree

vignettes/UUSS_MAT_Reconstruction.Rmd

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,10 @@ fossil_input2 <- fossil_input %>%
725725
tibble::column_to_rownames("sample.id"))
726726
727727
728-
# If you want to run the code for creating reconstructions (i.e., the predict.mat and predict.mat bootstrap output for each site), then you can uncomment the section below (the code takes approximately 30 minutes to run, depending on your machine). Here, we load the existing reconstruction file to save time. First, comment out the following line:
729-
reconstructions <- readRDS(here::here("vignettes/data/full_reconstruction_output_FINAL.rds"))
728+
# If you want to run the code for creating reconstructions (i.e., the predict.mat and predict.mat bootstrap output for each site), then you can uncomment the section below (the code takes approximately 30 minutes to run, depending on your machine). Below, we load output files from the model to save time.
729+
730+
# You can use this line once you have ran the reconstruction. The file output was too large to load into GitHub.
731+
# reconstructions <- readRDS(here::here("vignettes/data/full_reconstruction_output_FINAL.rds"))
730732
731733
# Iterate over the fossil pollen data to create reconstructions for each transfer function.
732734
# reconstructions <-
@@ -839,9 +841,29 @@ mat_predict <-
839841
# mat_predict,
840842
# here::here("vignettes/data/diagnostics_reconstruction/mat_prediction.rds"))
841843
844+
845+
842846
# Here, we pull out the data from the predict.mat objects. First, we pull out the predicted values for the four best analogues. In the analogue package, the analogues have cumulative means, so we only need to extract the four record here.
843-
mat_prediction_4 <-
844-
purrr::map_df(reconstructions, "recon_df")
847+
# Since, I do not run the reconstructions script here. I saved the output as a tibble.
848+
mat_prediction_4 <- readr::read_rds(here::here("vignettes/data/diagnostics_reconstruction/mat_prediction_4.rds"))
849+
850+
# mat_prediction_4 <-
851+
# purrr::map_df(reconstructions, "recon_df")
852+
853+
# If you need to write the data to file, then you can uncomment and run the following.
854+
# readr::write_rds(
855+
# mat_prediction_4,
856+
# here::here("vignettes/data/diagnostics_reconstruction/mat_prediction_4.rds"))
857+
858+
859+
# Since, I do not run the reconstructions script here. I saved the output as a tibble.
860+
predictMat <- readr::read_rds(here::here("vignettes/data/diagnostics_reconstruction/predictMat.rds"))
861+
# predictMat <- purrr::map(reconstructions, "recon")
862+
863+
# If you need to write the data to file, then you can uncomment and run the following.
864+
# readr::write_rds(
865+
# predictMat,
866+
# here::here("vignettes/data/diagnostics_reconstruction/predictMat.rds"))
845867
846868
```
847869

@@ -867,7 +889,7 @@ pre_minDC_samples <- rlen_full_results1 %>%
867889
#dplyr::filter(dataset.id %in% only_90b) %>%
868890
dplyr::pull(sample.id)
869891
870-
rlgh.mdc2 <- purrr::map(reconstructions, "recon") %>%
892+
rlgh.mdc2 <- predictMat %>%
871893
purrr::map_df(., "minDC") %>%
872894
tidyr::pivot_longer(everything(), names_to = "ind", values_to = "values", values_drop_na = TRUE)
873895
@@ -987,7 +1009,7 @@ tavg_new_90 <- fos_90 %>%
9871009
modern_temperature <-
9881010
as.data.frame(
9891011
raster::extract(
990-
x = temp.raster,
1012+
x = paleomat::temp.raster,
9911013
y = tavg_new_90 %>% dplyr::ungroup() %>%
9921014
dplyr::select(long, lat)
9931015
)

vignettes/UUSS_MAT_Reconstruction.html

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<meta name="author" content="Andrew Gillreath-Brown" />
1313

14-
<meta name="date" content="2023-11-02" />
14+
<meta name="date" content="2023-11-03" />
1515

1616
<title>paleoMAT: A Low-Frequency Summer Temperature Reconstruction for the United States Southwest, 3000 BC – AD 2000</title>
1717

@@ -1631,7 +1631,7 @@ <h1 class="title toc-ignore">paleoMAT: A Low-Frequency Summer
16311631
Temperature Reconstruction for the United States Southwest, 3000 BC – AD
16321632
2000</h1>
16331633
<h4 class="author">Andrew Gillreath-Brown</h4>
1634-
<h4 class="date">02 November 2023</h4>
1634+
<h4 class="date">03 November 2023</h4>
16351635

16361636
</div>
16371637

@@ -2317,8 +2317,10 @@ <h3>Spatial Autocorrelation</h3>
23172317
tibble::column_to_rownames(&quot;sample.id&quot;))
23182318

23192319

2320-
# If you do not want to run the code for creating reconstructions (which takes approximately 30 minutes to run, depending on your machine), then you can uncomment and run the following line:
2321-
reconstructions &lt;- readRDS(here::here(&quot;vignettes/data/full_reconstruction_output_FINAL.rds&quot;))
2320+
# If you want to run the code for creating reconstructions (i.e., the predict.mat and predict.mat bootstrap output for each site), then you can uncomment the section below (the code takes approximately 30 minutes to run, depending on your machine). Below, we load output files from the model to save time.
2321+
2322+
# You can use this line once you have ran the reconstruction. The file output was too large to load into GitHub.
2323+
# reconstructions &lt;- readRDS(here::here(&quot;vignettes/data/full_reconstruction_output_FINAL.rds&quot;))
23222324

23232325
# Iterate over the fossil pollen data to create reconstructions for each transfer function.
23242326
# reconstructions &lt;-
@@ -2431,9 +2433,29 @@ <h3>Spatial Autocorrelation</h3>
24312433
# mat_predict,
24322434
# here::here(&quot;vignettes/data/diagnostics_reconstruction/mat_prediction.rds&quot;))
24332435

2436+
2437+
24342438
# Here, we pull out the data from the predict.mat objects. First, we pull out the predicted values for the four best analogues. In the analogue package, the analogues have cumulative means, so we only need to extract the four record here.
2435-
mat_prediction_4 &lt;-
2436-
purrr::map_df(reconstructions, &quot;recon_df&quot;)</code></pre>
2439+
# Since, I do not run the reconstructions script here. I saved the output as a tibble.
2440+
mat_prediction_4 &lt;- readr::read_rds(here::here(&quot;vignettes/data/diagnostics_reconstruction/mat_prediction_4.rds&quot;))
2441+
2442+
# mat_prediction_4 &lt;-
2443+
# purrr::map_df(reconstructions, &quot;recon_df&quot;)
2444+
2445+
# If you need to write the data to file, then you can uncomment and run the following.
2446+
# readr::write_rds(
2447+
# mat_prediction_4,
2448+
# here::here(&quot;vignettes/data/diagnostics_reconstruction/mat_prediction_4.rds&quot;))
2449+
2450+
2451+
# Since, I do not run the reconstructions script here. I saved the output as a tibble.
2452+
predictMat &lt;- readr::read_rds(here::here(&quot;vignettes/data/diagnostics_reconstruction/predictMat.rds&quot;))
2453+
# predictMat &lt;- purrr::map(reconstructions, &quot;recon&quot;)
2454+
2455+
# If you need to write the data to file, then you can uncomment and run the following.
2456+
# readr::write_rds(
2457+
# predictMat,
2458+
# here::here(&quot;vignettes/data/diagnostics_reconstruction/predictMat.rds&quot;))</code></pre>
24372459
</div>
24382460
</div>
24392461
<div id="no-analog-threshold-or-minimum-dissimilarity" class="section level2">
@@ -2455,7 +2477,7 @@ <h2>No Analog Threshold (or Minimum Dissimilarity)</h2>
24552477
#dplyr::filter(dataset.id %in% only_90b) %&gt;%
24562478
dplyr::pull(sample.id)
24572479

2458-
rlgh.mdc2 &lt;- purrr::map(reconstructions, &quot;recon&quot;) %&gt;%
2480+
rlgh.mdc2 &lt;- predictMat %&gt;%
24592481
purrr::map_df(., &quot;minDC&quot;) %&gt;%
24602482
tidyr::pivot_longer(everything(), names_to = &quot;ind&quot;, values_to = &quot;values&quot;, values_drop_na = TRUE)
24612483

@@ -2568,7 +2590,7 @@ <h1>Anomaly Calculation</h1>
25682590
modern_temperature &lt;-
25692591
as.data.frame(
25702592
raster::extract(
2571-
x = temp.raster,
2593+
x = paleomat::temp.raster,
25722594
y = tavg_new_90 %&gt;% dplyr::ungroup() %&gt;%
25732595
dplyr::select(long, lat)
25742596
)
37.9 KB
Binary file not shown.
8.01 MB
Binary file not shown.

0 commit comments

Comments
 (0)