| Title: | Sources and standardizes permanent sample plot data |
|---|---|
| Description: | Converts all data into two keyed tables. One is for tree measurements, and the other is for plot data. Some arguments exist for handling disturbance agents. |
| Authors: | Ian M S Eddy [aut, cre], Alex M Chubaty [ctb] |
| Maintainer: | Ian M S Eddy <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0.9006 |
| Built: | 2026-06-02 23:45:30 UTC |
| Source: | https://github.com/ianmseddy/PSPclean |
Identifies plots where all trees identified, and their subsequent measurements. These are of interest as the stand age is unlikely to be correct
calculates elapsed time between successive measurements and flags trees with biologically implausible DBH growth based on the max_assumed_growth_rate param
assessTreeNumberConsistency(plots, max_assumed_growth_rate = 1)assessTreeNumberConsistency(plots, max_assumed_growth_rate = 1)
plots |
A list containing at least a data frame |
max_assumed_growth_rate |
Maximum plausible DBH growth per year for regenerating trees (cm/year, default = 1). |
A list with:
MeasurementIDs with 100% regen at some point in plot history If the problematic measurement is the last measurement, then prior measurements are not included. If the problematic measurement is NOT the first, then all measurements are included
trees with problematic DBH (ie growing faster than max_assumed_growth_rate) and other variables: elapsedTime (years between measurements), DBHdiffFromMax (the difference between the actual growth rate and the expected maximum growth rate), and DBHdiffFromMax_perYear (the latter divided by the former))
Assigns status to each tree based on its observation history. Detects new regeneration, lost trees, and survivors.
classify_tree_status(Trees)classify_tree_status(Trees)
Trees |
A |
A list containing:
The full dataset with status classification.
Trees first appearing after plot monitoring began.
Trees last measured before monitoring ended.
Trees present consistently or throughout.
Unique OrigPlotID1 identifiers.
This function cleans and standardizes the Alberta PSP data, including tree measurements and plot information. Species names can be standardized using a species equivalency table.
dataPurification_ABPSP( treeMeasure, plotMeasure, tree, plot, codesToExclude = 3, excludeAllObs = TRUE, areaDiffThresh = 0.95, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_ABPSP( treeMeasure, plotMeasure, tree, plot, codesToExclude = 3, excludeAllObs = TRUE, areaDiffThresh = 0.95, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
treeMeasure |
A |
plotMeasure |
A |
tree |
A |
plot |
A |
codesToExclude |
Character vector of damage agent codes used to filter tree data (see GOA PSP Manual). Measurements with these codes will be removed. |
excludeAllObs |
Logical. If |
areaDiffThresh |
Numeric. Threshold for plot size discrepancy below which plots
are assigned a new ID. Expressed as |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes the British Columbia PSP data, including tree measurements and plot header information. Species names can be standardized using a species equivalency table.
dataPurification_BCPSP( treeDataRaw, plotHeaderDataRaw, damageAgentCodes, codesToExclude = "IBM", excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_BCPSP( treeDataRaw, plotHeaderDataRaw, damageAgentCodes, codesToExclude = "IBM", excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
treeDataRaw |
A |
plotHeaderDataRaw |
A |
damageAgentCodes |
A character vector of damage agent codes present in the data. |
codesToExclude |
A character vector of damage agent codes to exclude from measurements. |
excludeAllObs |
Logical. If |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes New Brunswick PSP data, including tree and plot data. Species names can be standardized using a species equivalency table.
dataPurification_NBPSP( NB_PSP_Data, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_NBPSP( NB_PSP_Data, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
NB_PSP_Data |
A list of |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes NFI PSP data, including tree, plot, and location data. Species names can be standardized using a species equivalency table.
dataPurification_NFIPSP( NFIdata, codesToExclude = "IB", excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_NFIPSP( NFIdata, codesToExclude = "IB", excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
NFIdata |
A list containing NFI tree, plot, and location data.tables. |
codesToExclude |
Vector of damage agent codes. Measurements with these codes will be removed. |
excludeAllObs |
Logical. If |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes Ontario PSP data, including tree and plot data. Species names can be standardized using a species equivalency table.
dataPurification_ONPSP( ONPSPlist, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_ONPSP( ONPSPlist, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
ONPSPlist |
A list of relevant PSP plots and associated data.tables. |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes the Quebec PSP data, including tree and plot data. Species names can be standardized using a species equivalency table.
dataPurification_QCPSP( QuebecPSP, codesToExclude = NULL, excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_QCPSP( QuebecPSP, codesToExclude = NULL, excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
QuebecPSP |
A list of |
codesToExclude |
Character vector of damage or pest disturbance codes to exclude from measurements. Currently placeholder, update if applicable. |
excludeAllObs |
Logical. If |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
This function cleans and standardizes the Saskatchewan PSP data, including tree measurements, plot headers, and measurement headers. Species names can be standardized using a species equivalency table.
dataPurification_SKPSP( SADataRaw, plotHeaderRaw, measureHeaderRaw, treeDataRaw, codesToExclude = NULL, excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )dataPurification_SKPSP( SADataRaw, plotHeaderRaw, measureHeaderRaw, treeDataRaw, codesToExclude = NULL, excludeAllObs = TRUE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
SADataRaw |
A |
plotHeaderRaw |
A |
measureHeaderRaw |
A |
treeDataRaw |
A |
codesToExclude |
Character vector of damage agent codes used to filter tree data. Codes: Natural or Undetermined = 1, Disease = 2, Insect = 3, Human = 4, Wind = 5, Snow = 6, Other Trees = 7, Hail or Ice Storm = 8. Measurements with these codes will be removed. |
excludeAllObs |
Logical. If |
sppEquiv |
A table providing species name equivalencies between the original PSP species names
and the final standardized naming format. Default is |
sppEquivCol |
Character string. The column in |
A list containing standardized plotData and treeData as data.tables.
standardize and treat the Saskatchewan Mistik temporary sample plot data This function will be deprecated
dataPurification_SKTSP_Mistik(compiledPlotData, compiledTreeData)dataPurification_SKTSP_Mistik(compiledPlotData, compiledTreeData)
compiledPlotData |
the plot header data |
compiledTreeData |
the tree data |
a list of plot and tree data.tables
Flags statistically implausible DBH values based on the z-score method #' (using mean and standard deviation) within each plot group. This can help identify data entry or measurement errors in repeated tree measurements.
detect_dbh_outliers( Trees, dbh_col = "DBH", plot_col = "OrigPlotID1", z_thresh = 7 )detect_dbh_outliers( Trees, dbh_col = "DBH", plot_col = "OrigPlotID1", z_thresh = 7 )
Trees |
A |
dbh_col |
Character. Name of the DBH column. Default is "DBH". |
plot_col |
Character. Name of the plot/grouping column. Default is "OrigPlotID1". |
z_thresh |
Numeric. Z-score threshold for identifying outliers. Default is 7. |
A list with:
The modified data.table with added columns: meanDBH, sdDBH, zscore, is_outlier_z
Unique plot/group IDs used in analysis
convert plot location data to long/lat and output in a sf object
geoCleanPSP(Locations)geoCleanPSP(Locations)
Locations |
the compiled plot data |
an sf object with OrigPlotID1 column
return a merged PSP object from a vector of data sources
getPSP( PSPdataTypes, destinationPath, forGMCS = FALSE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )getPSP( PSPdataTypes, destinationPath, forGMCS = FALSE, sppEquiv = LandR::sppEquivalencies_CA, sppEquivCol = "Latin_full" )
PSPdataTypes |
character vector of PSP data sources - e.g. |
destinationPath |
destination folder for downloaded objects |
forGMCS |
if |
sppEquiv |
species equivalencies table. |
sppEquivCol |
Character string. The column in |
a list of standardized plot and tree data.tables
source the Alberta PSP data
prepInputsAlbertaPSP(dPath)prepInputsAlbertaPSP(dPath)
dPath |
passed to prepInputs destinationPath |
a list of Alberta PSP data.tables
Source the BC PSP data
prepInputsBCPSP(dPath)prepInputsBCPSP(dPath)
dPath |
passed to |
a list of BC PSP objects
retrieve the New Brunswick PSP raw data
prepInputsNBPSP(dPath)prepInputsNBPSP(dPath)
dPath |
data directory for raw data |
a list of plot, tree, measurement, and location data.tables after exporting mdb to csv txt
source the NFI PSP data
prepInputsNFIPSP(dPath)prepInputsNFIPSP(dPath)
dPath |
passed to prepInputs destinationPath |
a list of NFI PSP data.tables
retrieve preprocessed Ontario PSP and PGP data
prepInputsOntarioPSP(dPath, ...)prepInputsOntarioPSP(dPath, ...)
dPath |
the Access database for PSP and PGP plots |
... |
additional args passed to prepInputs |
a list of plot and tree data.tables
retrieve the Quebec PSP raw data
prepInputsQCPSP(dPath)prepInputsQCPSP(dPath)
dPath |
data directory for raw data |
a list of plot, tree, measurement, and location data.tables after exporting mdb to csv txt
source the Saskatchewan PSP data
prepInputsSaskatchwanPSP(dPath)prepInputsSaskatchwanPSP(dPath)
dPath |
passed to prepInputs destinationPath |
a list of Saskatchewan PSP data.tables
source the Saskatchewan PSP data
prepInputsSaskatchwanTSP(dPath)prepInputsSaskatchwanTSP(dPath)
dPath |
passed to prepInputs destinationPath |
a list of Saskatchewan PSP data.tables
standardize and treat the BC PSP data
prepPSP_climateNA(dPath, filename2, PSPplot, PSPgis)prepPSP_climateNA(dPath, filename2, PSPplot, PSPgis)
dPath |
directory to download elevation data |
filename2 |
the full filename of the output file |
PSPplot |
the standardized PSP plot attribute data |
PSPgis |
the standardized plot location sf object |
a text file
Detects and manages inconsistencies in tree DBH (Diameter at Breast Height) measurements across years within PSP. Flags implausible negative growth, cleans the dataset accordingly, and excludes OrigPlotID1s with high anomaly rates.
process_dbh_issues(Trees)process_dbh_issues(Trees)
Trees |
A |
A list containing:
Cleaned dataset with problematic entries removed.
Subset of detected DBH inconsistencies.
Summary of negative growth by OrigPlotID1.
List of retained OrigPlotID1 identifiers.
standardize the species names in a given PSP measurement data.table
standardizeSpeciesNames(speciesTable, forestInventorySource)standardizeSpeciesNames(speciesTable, forestInventorySource)
speciesTable |
the tree measurement csv |
forestInventorySource |
one of MBTSP, ABPSP, BCPSP, SKPSP, NWTTSP, NFIPSP. |
the species table with standardized species names
Ensures consistent Species and Tree numbering within a plot (OrigPlotID1)
treenum_to_multiplePSP(Trees)treenum_to_multiplePSP(Trees)
Trees |
A |
A list containing:
Cleaned tree dataset.