|
# This needs to run in the directory in which you have Bacon installed. |
|
# If you do not currently have the `neotoma` package installed then uncomment |
|
# and run the following code. Right now you will need to install the package from GitHub |
|
# because our latest bug fixes haven't been pushed up into CRAN. |
|
# |
|
# install.packages('devtools') |
|
# library(devtools) |
|
# install_github('ropensci/neotoma') |
|
# |
|
# The Neotoma package is described more fully here: |
|
# |
|
# Goring, S., Dawson, A., Simpson, G. L., Ram, K., Graham, R. W., Grimm, E. C., & |
|
# Williams, J. W.. (2015). neotoma: A Programmatic Interface to the Neotoma |
|
# Paleoecological Database, 1(1), Art. 2. DOI: http://doi.org/10.5334/oq.ab |
|
# |
|
# |
|
|
|
library(neotoma) |
|
library(maps) # you may also want to install this. |
|
|
|
# There are (surprisingly?) no data records from Nevada currently. Instead we will |
|
# pull records from California. In this call I want to find high elevation sites |
|
# because they're kind of interesting. |
|
|
|
ca_pollen <- get_dataset(gpid = 'California', datasettype = 'pollen', |
|
ageold = 10000, altmin=1000) |
|
|
|
plot(get_site(ca_pollen)[,c('long', 'lat')], |
|
xlim = c(-125, -115), ylim=c(30, 45), |
|
pch=19, col=2) |
|
map('world', add=TRUE) |
|
map("state", add=TRUE) |
|
|
|
# Now we can download the records. |
|
# You should see the site names running by. As you do this, reflect on all the work |
|
# that's gone into these records and give thanks to the named and unnamed workers who |
|
# toiled behind a microscope for months at a time so that you could download their data |
|
# in mere seconds. |
|
ca_download <- get_download(ca_pollen) |
|
|
|
# For this example we should find the one that gives us the most dated material. |
|
dated_samples <- get_chroncontrol(ca_download) |
|
|
|
# This next line is just FYI - we're getting a vector of the number of dates in each core. |
|
# Some will return a NULL if there is no associated control table. This happens for single |
|
# stratigraphic pollen sections for example. |
|
sapply(dated_samples, function(x)nrow(x$chron.control)) |
|
|
|
# The last core (Taquitz Meadow) has 6, controls: |
|
# The number is quotes is the dataset number. To choose a different dataset look at the |
|
# available datasets and enter in a different number. |
|
|
|
plot(dated_samples[['15594']]$chron.control[,c('depth', 'age')]) |
|
# You can try a few different ones to see how things look. |
|
|
|
# So Taquitz Meadow looks good. We can look at it in the Neotoma Explorer like this: |
|
# http://apps.neotomadb.org/explorer/?datasetid=15594 |
|
|
|
# The original model was generated in Bacon, let's see how well we do: |
|
write_agefile(ca_download[['15594']], chronology = 1, |
|
path = '.', corename = 'TAQUITZ', cal.prog = 'Bacon') |
|
|
|
# Source Bacon . . . |
|
source('Bacon.R') |
|
|
|
# Please note that this will actually take a very very long time. It might be worth picking a different site. |
|
Bacon('TAQUITZ') |
This comment has been minimized.
@SimonGoring ... where is Bacon.R?