Download the latest version of the ITRDB, and extract given parameters.
Source:R/ITRDB_FUNCTIONS.R
get_itrdb.Rd
get_itrdb
returns a named list of length 3:
'metadata': A data frame or
Simple Feature
(ifmakeSpatial==TRUE
) of the locations and names of extracted ITRDB chronologies,'widths': A matrix of tree-ring widths/densities given user selection, and
'depths': A matrix of tree-ring sample depths.
Usage
get_itrdb(
template = NULL,
label = NULL,
recon.years = NULL,
calib.years = NULL,
species = NULL,
measurement.type = NULL,
chronology.type = NULL,
raw.dir = paste0(tempdir(), "/FedData/raw/itrdb"),
extraction.dir = ifelse(!is.null(label), paste0(tempdir(),
"/FedData/extractions/itrdb/", label, "/"), paste0(tempdir(),
"/FedData/extractions/itrdb")),
force.redo = FALSE
)
Arguments
- template
An
Simple Feature
orSpatRaster
object to serve as a template for cropping. If missing, all available global chronologies are returned.- label
A character string naming the study area.
- recon.years
A numeric vector of years over which reconstructions are needed; if missing, the union of all years in the available chronologies are given.
- calib.years
A numeric vector of all required years—chronologies without these years will be discarded; if missing, all available chronologies are given.
- species
A character vector of 4-letter tree species identifiers; if missing, all available chronologies are given.
- measurement.type
A character vector of measurement type identifiers. Options include:
'Total Ring Density'
'Earlywood Width'
'Earlywood Density'
'Latewood Width'
'Minimum Density'
'Ring Width'
'Latewood Density'
'Maximum Density'
'Latewood Percent'
if missing, all available chronologies are given.
- chronology.type
A character vector of chronology type identifiers. Options include:
'ARSTND'
'Low Pass Filter'
'Residual'
'Standard'
'Re-Whitened Residual'
'Measurements Only'
if missing, all available chronologies are given.
- raw.dir
A character string indicating where raw downloaded files should be put. The directory will be created if missing.
- extraction.dir
A character string indicating where the extracted and cropped ITRDB dataset should be put. The directory will be created if missing.
- force.redo
If an extraction already exists, should a new one be created? Defaults to FALSE.
Examples
# \donttest{
# Get the ITRDB records
ITRDB <- get_itrdb(template = FedData::meve,
label = "meve")
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-africa-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-asia-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-australia-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-canada-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-europe-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-mexico-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-southamerica-crn.zip
#> Downloading file: https://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/itrdb-v713-usa-crn.zip
#> Extracting chronology data from ITRDB version 713 dated 2024-11-07
#> Extracting chronology data from 85 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-africa-crn.zip
#> Extracting chronology data from 1357 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-asia-crn.zip
#> 1 file(s) couldn't be extracted:
#> mong015.crn
#> File(s) likely malformed!
#> Extracting chronology data from 192 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-australia-crn.zip
#> 2 file(s) couldn't be extracted:
#> newz103.crn
#> newz115.crn
#> File(s) likely malformed!
#> Extracting chronology data from 901 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-canada-crn.zip
#> Extracting chronology data from 1994 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-europe-crn.zip
#> 25 file(s) couldn't be extracted:
#> bulg001.crn
#> bulg001e.crn
#> bulg001l.crn
#> bulg001n.crn
#> bulg001p.crn
#> bulg001x.crn
#> gree001.crn
#> gree001e.crn
#> gree001l.crn
#> gree001n.crn
#> gree001p.crn
#> gree001x.crn
#> gree005.crn
#> gree005e.crn
#> gree005l.crn
#> gree005n.crn
#> gree005p.crn
#> gree005x.crn
#> ital015.crn
#> ital015e.crn
#> ital015l.crn
#> ital015n.crn
#> ital015p.crn
#> ital015x.crn
#> swed318.crn
#> File(s) likely malformed!
#> Extracting chronology data from 246 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-mexico-crn.zip
#> 1 file(s) couldn't be extracted:
#> mexi037la.crn
#> File(s) likely malformed!
#> Extracting chronology data from 346 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-southamerica-crn.zip
#> Extracting chronology data from 3172 files in /tmp/RtmpYzxfyX/FedData/raw/itrdb/./itrdb-v713-usa-crn.zip
#> 41 file(s) couldn't be extracted:
#> ar081a.crn
#> co076l.crn
#> co573e_crns.crn
#> co573l_crns.crn
#> co573n_crns.crn
#> co573p_crns.crn
#> co573w_crns.crn
#> co573x_crns.crn
#> co575e_crns.crn
#> co575l_crns.crn
#> co575n_crns.crn
#> co575p_crns.crn
#> co575w_crns.crn
#> co575x_crns.crn
#> co577e_crns.crn
#> co577l_crns.crn
#> co577n_crns.crn
#> co577p_crns.crn
#> co577w_crns.crn
#> co577x_crns.crn
#> co619.crn
#> mt115.crn
#> mt115e.crn
#> mt115ea.crn
#> mt115er.crn
#> mt115l.crn
#> mt115la.crn
#> mt115lr.crn
#> mt115n.crn
#> mt115na.crn
#> mt115nr.crn
#> mt115x.crn
#> mt115xa.crn
#> mt115xr.crn
#> or081.crn
#> or081a.crn
#> or081r.crn
#> sc004.crn
#> tx054.crn
#> tx054a.crn
#> tx054r.crn
#> File(s) likely malformed!
#>
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#> SERIES = col_character(),
#> NAME = col_character(),
#> SPECIES = col_character(),
#> MEASUREMENT_TYPE = col_character(),
#> CHRONOLOGY_TYPE = col_character(),
#> ELEVATION = col_character(),
#> LAT = col_double(),
#> LON = col_double(),
#> START = col_double(),
#> END = col_double(),
#> CONTRIBUTOR = col_character(),
#> FILE = col_character()
#> )
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
# Plot the VEP polygon
plot(meve)
# Map the locations of the tree ring chronologies
plot(ITRDB$metadata$geometry, pch = 1, add = TRUE)
legend("bottomleft", pch = 1, legend = "ITRDB chronologies")
# }