Title: | Soil Database Interface |
---|---|
Description: | A collection of functions for reading soil data from U.S. Department of Agriculture Natural Resources Conservation Service (USDA-NRCS) and National Cooperative Soil Survey (NCSS) databases. |
Authors: | Dylan Beaudette [aut], Jay Skovlin [aut], Stephen Roecker [aut], Andrew Brown [aut, cre] |
Maintainer: | Andrew Brown <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.8.5 |
Built: | 2024-10-05 00:50:30 UTC |
Source: | https://github.com/ncss-tech/soildb |
A collection of functions for reading soil data from U.S. Department of Agriculture Natural Resources Conservation Service (USDA-NRCS) and National Cooperative Soil Survey (NCSS) databases
This package provides methods for extracting soils information from local NASIS databases (MS SQL Server), local PedonPC and AKSite databases (MS Access format), Soil Data Access, and other soil-related web services.
J.M. Skovlin, D.E. Beaudette, S.M Roecker, A.G. Brown
fetchNASIS, SDA_query, loafercreek
The following database types are tested and fully supported:
SQLite or Geopackage
DuckDB
Postgres or PostGIS
In theory any other DBI-compatible data source can be used for output. See conn
argument. If you encounter issues using specific DBI connection types, please report in the soilDB issue tracker.
createSSURGO( filename, exdir, conn = NULL, pattern = NULL, include_spatial = TRUE, overwrite = FALSE, header = FALSE, quiet = TRUE, ... )
createSSURGO( filename, exdir, conn = NULL, pattern = NULL, include_spatial = TRUE, overwrite = FALSE, header = FALSE, quiet = TRUE, ... )
filename |
Output file name (e.g. |
exdir |
Path containing containing input SSURGO spatial (.shp) and tabular (.txt) files, downloaded and extracted by |
conn |
A DBIConnection object. Default is a |
pattern |
Character. Optional regular expression to use to filter subdirectories of |
include_spatial |
Logical. Include spatial data layers in database? Default: |
overwrite |
Logical. Overwrite existing layers? Default |
header |
Logical. Passed to |
quiet |
Logical. Suppress messages and other output from database read/write operations? |
... |
Additional arguments passed to |
Character. Vector of layer/table names in filename
.
## Not run: downloadSSURGO("areasymbol IN ('CA067', 'CA077', 'CA632')", destdir = "SSURGO_test") createSSURGO("test.gpkg", "SSURGO_test") ## End(Not run)
## Not run: downloadSSURGO("areasymbol IN ('CA067', 'CA077', 'CA632')", destdir = "SSURGO_test") createSSURGO("test.gpkg", "SSURGO_test") ## End(Not run)
Create a memory or file-based instance of NASIS database for selected tables.
createStaticNASIS( tables = NULL, new_names = NULL, SS = TRUE, dsn = NULL, output_path = NULL, verbose = FALSE )
createStaticNASIS( tables = NULL, new_names = NULL, SS = TRUE, dsn = NULL, output_path = NULL, verbose = FALSE )
tables |
Character vector of target tables. Default: |
new_names |
Optional: new table names (should match length of vector of matching |
SS |
Logical. Include "selected set" tables (ending with suffix |
dsn |
Optional: path to SQLite database containing NASIS table structure; or a |
output_path |
Optional: path to new/existing SQLite database to write tables to. Default: |
verbose |
Show error messages from attempts to dump individual tables? Default |
A named list of results from calling dbQueryNASIS
for all
columns in each NASIS table.
Create a connection to a local NASIS database with DBI
dbConnectNASIS(dsn = NULL) NASIS(dsn = NULL)
dbConnectNASIS(dsn = NULL) NASIS(dsn = NULL)
dsn |
Optional: path to SQLite database containing NASIS table
structure; Default: |
A DBIConnection
object, as returned by
DBI::dbConnect()
. If dsn
is a DBIConnection
, the attribute isUserDefined
of the result is set to TRUE
. If the DBIConnection
is created by the internal NASIS connection process, isUserDefined
is set to FALSE.
Send queries to a NASIS DBIConnection
dbQueryNASIS(conn, q, close = TRUE, ...)
dbQueryNASIS(conn, q, close = TRUE, ...)
conn |
A |
q |
A statement to execute using |
close |
Close connection after query? Default: |
... |
Additional arguments to |
Result of DBI::dbGetQuery
Download ZIP files containing spatial (ESRI shapefile) and tabular (TXT) files with standard SSURGO format; optionally including the corresponding SSURGO Template Database with include_template=TRUE
.
downloadSSURGO( WHERE = NULL, areasymbols = NULL, destdir = tempdir(), exdir = destdir, include_template = FALSE, db = c("SSURGO", "STATSGO"), extract = TRUE, remove_zip = FALSE, overwrite = FALSE, quiet = FALSE )
downloadSSURGO( WHERE = NULL, areasymbols = NULL, destdir = tempdir(), exdir = destdir, include_template = FALSE, db = c("SSURGO", "STATSGO"), extract = TRUE, remove_zip = FALSE, overwrite = FALSE, quiet = FALSE )
WHERE |
A SQL |
areasymbols |
Character vector of soil survey area symbols e.g. |
destdir |
Directory to download ZIP files into. Default |
exdir |
Directory to extract ZIP archives into. May be a directory that does not yet exist. Each ZIP file will extract to a folder labeled with |
include_template |
Include the (possibly state-specific) MS Access template database? Default: |
db |
Either |
extract |
Logical. Extract ZIP files to |
remove_zip |
Logical. Remove ZIP files after extracting? Default: |
overwrite |
Logical. Overwrite by re-extracting if directory already exists? Default: |
quiet |
Logical. Passed to |
To specify the Soil Survey Areas you would like to obtain data you use a WHERE
clause for query of sacatalog
table such as areasymbol = 'CA067'
, "areasymbol IN ('CA628', 'CA067')"
or areasymbol LIKE 'CT%'
.
When db="STATSGO"
the WHERE
argument is not supported. Allowed areasymbols
include "US"
and two-letter state codes e.g. "WY"
for the Wyoming general soils map.
Pipe-delimited TXT files are found in /tabular/ folder extracted from a SSURGO ZIP. The files are named for tables in the SSURGO schema. There is no header / the files do not have column names. See the Soil Data Access Tables and Columns Report: https://sdmdataaccess.nrcs.usda.gov/documents/TablesAndColumnsReport.pdf for details on tables, column names and metadata including the default sequence of columns used in TXT files. The function returns a try-error
if the WHERE
/areasymbols
arguments result in
Several ESRI shapefiles are found in the /spatial/ folder extracted from a SSURGO ZIP. These have prefix soilmu_
(mapunit), soilsa_
(survey area), soilsf_
(special features). There will also be a TXT file with prefix soilsf_
describing any special features. Shapefile names then have an a_
(polygon), l_
(line), p_
(point) followed by the soil survey area symbol.
Character. Paths to downloaded ZIP files (invisibly). May not exist if remove_zip = TRUE
.
Estimate color mixtures using weighted average of CIELAB color coordinates
estimateColorMixture(x, wt = "pct", backTransform = FALSE)
estimateColorMixture(x, wt = "pct", backTransform = FALSE)
x |
data.frame, typically from NASIS containing at least CIE LAB ('L', 'A', 'B') and some kind of weight |
wt |
fractional weights, usually area of hz face |
backTransform |
logical, should the mixed sRGB representation of soil color be transformed to closest Munsell chips? This is performed by |
A data.frame containing estimated color mixture
See aqp::mixMunsell()
for a more realistic (but slower) simulation of subtractive mixing of pigments. An efficient replacement for this function (wt. mean in CIELAB coordinates) is implemented in aqp::mixMunsell(..., mixingMethod = 'estimate')
.
D.E. Beaudette
Estimate soil temperature regime (STR) based on mean annual soil temperature (MAST), mean summer temperature (MSST), mean winter soil temperature (MWST), presence of O horizons, saturated conditions, and presence of permafrost. Several assumptions are made when O horizon or saturation are undefined.
estimateSTR( mast, mean.summer, mean.winter, O.hz = NA, saturated = NA, permafrost = FALSE )
estimateSTR( mast, mean.summer, mean.winter, O.hz = NA, saturated = NA, permafrost = FALSE )
mast |
vector of mean annual soil temperature (deg C) |
mean.summer |
vector of mean summer soil temperature (deg C) |
mean.winter |
vector of mean winter soil temperature (deg C) |
O.hz |
logical vector of O horizon presence / absence |
saturated |
logical vector of seasonal saturation |
permafrost |
logical vector of permafrost presence / absence |
Soil Temperature Regime Evaluation Tutorial
Vector of soil temperature regimes.
D.E. Beaudette
Soil Survey Staff. 2015. Illustrated guide to soil taxonomy. U.S. Department of Agriculture, Natural Resources Conservation Service, National Soil Survey Center, Lincoln, Nebraska.
# simple example estimateSTR(mast=17, mean.summer = 22, mean.winter = 12)
# simple example estimateSTR(mast=17, mean.summer = 22, mean.winter = 12)
Download soil characterization and morphologic data via BBOX, MLRA, or soil series name query, from the KSSL database.
fetchKSSL( series = NA, bbox = NA, mlra = NA, pedlabsampnum = NA, pedon_id = NA, pedon_key = NA, returnMorphologicData = FALSE, returnGeochemicalData = FALSE, simplifyColors = FALSE, progress = TRUE )
fetchKSSL( series = NA, bbox = NA, mlra = NA, pedlabsampnum = NA, pedon_id = NA, pedon_key = NA, returnMorphologicData = FALSE, returnGeochemicalData = FALSE, simplifyColors = FALSE, progress = TRUE )
series |
vector of soil series names, case insensitive |
bbox |
a single bounding box in WGS84 geographic coordinates e.g.
|
mlra |
vector of MLRA IDs, e.g. "18" or "22A" |
pedlabsampnum |
vector of KSSL pedon lab sample number |
pedon_id |
vector of user pedon ID |
pedon_key |
vector of KSSL internal pedon ID |
returnMorphologicData |
logical, optionally request basic morphologic data, see details section |
returnGeochemicalData |
logical, optionally request geochemical, optical and XRD/thermal data, see details section |
simplifyColors |
logical, simplify colors (from morphologic data) and join with horizon data |
progress |
logical, optionally give progress when iterating over multiple requests |
This interface has largely been superseded by the Soil Data Access
snapshot of the Laboratory Data Mart, available via fetchLDM()
.
Series-queries are case insensitive. Series name is based on the "correlated as" field (from KSSL snapshot) when present. The "sampled as" classification was promoted to "correlated as" if the "correlated as" classification was missing.
When returnMorphologicData
is TRUE, the resulting object is a list.
The standard output from fetchKSSL
(SoilProfileCollection
object) is stored in the named element "SPC". The additional elements are
basic morphologic data: soil color, rock fragment volume, pores, structure,
and redoximorphic features. There is a 1:many relationship between the
horizon data in "SPC" and the additional dataframes in morph
. See
examples for ideas on how to "flatten" these tables.
When returnGeochemicalData
is TRUE, the resulting object is a list.
The standard output from fetchKSSL
(SoilProfileCollection
object) is stored in the named element "SPC". The additional elements are
geochemical and mineralogy analysis tables, specifically:
geochemical/elemental analyses "geochem", optical mineralogy "optical", and
X-ray diffraction / thermal "xrd_thermal". returnGeochemicalData
will
include additional dataframes geochem
, optical
, and
xrd_thermal
in list result.
Setting simplifyColors=TRUE
will automatically flatten the soil color
data and join to horizon level attributes.
Function arguments (series
, mlra
, etc.) are fully vectorized
except for bbox
.
a SoilProfileCollection
object when
returnMorphologicData
is FALSE, otherwise a list.
SoilWeb maintains a snapshot of these KSSL and NASIS data. The SoilWeb snapshot was developed using methods described here: https://github.com/dylanbeaudette/process-kssl-snapshot. Please use the link below for the live data.
D.E. Beaudette and A.G. Brown
http://ncsslabdatamart.sc.egov.usda.gov/
library(aqp) # search by series name s <- fetchKSSL(series='auburn') # search by bounding-box # s <- fetchKSSL(bbox=c(-120, 37, -122, 38)) # how many pedons length(s) # plot plotSPC(s, name='hzn_desgn', max.depth=150) ## ## morphologic data ## # get lab and morphologic data s <- fetchKSSL(series='auburn', returnMorphologicData = TRUE) # extract SPC pedons <- s$SPC # if (requireNamespace("farver")) { # ## automatically simplify color data (requires farver) # s <- fetchKSSL(series='auburn', returnMorphologicData = TRUE, simplifyColors=TRUE) # # check # par(mar=c(0,0,0,0)) # plot(pedons, color='moist_soil_color', print.id=FALSE) # }
library(aqp) # search by series name s <- fetchKSSL(series='auburn') # search by bounding-box # s <- fetchKSSL(bbox=c(-120, 37, -122, 38)) # how many pedons length(s) # plot plotSPC(s, name='hzn_desgn', max.depth=150) ## ## morphologic data ## # get lab and morphologic data s <- fetchKSSL(series='auburn', returnMorphologicData = TRUE) # extract SPC pedons <- s$SPC # if (requireNamespace("farver")) { # ## automatically simplify color data (requires farver) # s <- fetchKSSL(series='auburn', returnMorphologicData = TRUE, simplifyColors=TRUE) # # check # par(mar=c(0,0,0,0)) # plot(pedons, color='moist_soil_color', print.id=FALSE) # }
This function provides access to the Kellogg Soil Survey Laboratory Data Mart via Soil Data Access or a local SQLite snapshot. See details and examples for additional usage instructions.
fetchLDM( x = NULL, what = "pedlabsampnum", bycol = "pedon_key", tables = c("lab_physical_properties", "lab_chemical_properties", "lab_calculations_including_estimates_and_default_values", "lab_rosetta_Key"), WHERE = NULL, chunk.size = 1000, ntries = 3, layer_type = c("horizon", "layer", "reporting layer"), area_type = c("ssa", "country", "state", "county", "mlra", "nforest", "npark"), prep_code = c("S", ""), analyzed_size_frac = c("<2 mm", ""), dsn = NULL )
fetchLDM( x = NULL, what = "pedlabsampnum", bycol = "pedon_key", tables = c("lab_physical_properties", "lab_chemical_properties", "lab_calculations_including_estimates_and_default_values", "lab_rosetta_Key"), WHERE = NULL, chunk.size = 1000, ntries = 3, layer_type = c("horizon", "layer", "reporting layer"), area_type = c("ssa", "country", "state", "county", "mlra", "nforest", "npark"), prep_code = c("S", ""), analyzed_size_frac = c("<2 mm", ""), dsn = NULL )
x |
A vector of values to find in column specified by |
what |
A single column name from tables: |
bycol |
A single column name from |
tables |
A vector of table names; Default is |
WHERE |
character. A custom SQL WHERE clause, which overrides |
chunk.size |
Number of pedons per chunk (for queries that may exceed |
ntries |
Number of tries (times to halve |
layer_type |
Default: |
area_type |
Default: |
prep_code |
Default: |
analyzed_size_frac |
Default: |
dsn |
Data source name; either a path to a SQLite database, an open DBIConnection or (default) |
You can download SQLite or GeoPackage snapshots here: https://ncsslabdatamart.sc.egov.usda.gov/database_download.aspx. Specify the dsn
argument to use a local copy of the lab data rather than Soil Data Access web service.
Lab Data Mart model diagram: https://jneme910.github.io/Lab_Data_Mart_Documentation/Documents/SDA_KSSL_Data_model.html
If the chunk.size
parameter is set too large and the Soil Data Access request fails, the algorithm will re-try the query with a smaller (halved) chunk.size
argument. This will be attempted up to 3 times before returning NULL
The default behavior joins the lab_area
tables only for the "Soil Survey Area" related records. You can specify alternative area records for use in x
, what
or WHERE
arguments by setting area_type
to a different value.
When requesting data from "lab_major_and_trace_elements_and_oxides"
, "lab_mineralogy_glass_count"
, or "lab_xray_and_thermal"
multiple preparation codes (prep_code
) or size fractions (analyzed_size_frac
) are possible. The default behavior of fetchLDM()
is to attempt to return a topologically valid (minimal overlaps) SoilProfileCollection. This is achieved by setting prep_code="S"
("sieved") and analyzed_size_frac="<2 mm"
. You may specify alternate or additional preparation codes or fractions as needed, but note that this may cause "duplication" of some layers where measurements were made with different preparation or on fractionated samples
a SoilProfileCollection
for a successful query, a try-error
if no site/pedon locations can be found or NULL
for an empty lab_layer
(within sites/pedons) result
## Not run: # fetch by Soil Survey Area area symbol (area_code using default "ssa" area_type) res <- fetchLDM("CA630", what = "area_code") # fetch by Major Land Resource area symbol (area_code using "mlra" area_type) res <- fetchLDM("22A", what = "area_code", area_type = "mlra") # fetch by multiple case-insensitive taxon name # (correlated or sampled as Musick or Holland series) res <- fetchLDM(WHERE = "(CASE WHEN corr_name IS NOT NULL THEN LOWER(corr_name) ELSE LOWER(samp_name) END) IN ('musick', 'holland')") # physical properties of soils correlated as taxonomic subgroup "Typic Argialbolls" res <- fetchLDM(x = "Typic Argialbolls", what = "corr_taxsubgrp", tables = "lab_physical_properties") ## End(Not run)
## Not run: # fetch by Soil Survey Area area symbol (area_code using default "ssa" area_type) res <- fetchLDM("CA630", what = "area_code") # fetch by Major Land Resource area symbol (area_code using "mlra" area_type) res <- fetchLDM("22A", what = "area_code", area_type = "mlra") # fetch by multiple case-insensitive taxon name # (correlated or sampled as Musick or Holland series) res <- fetchLDM(WHERE = "(CASE WHEN corr_name IS NOT NULL THEN LOWER(corr_name) ELSE LOWER(samp_name) END) IN ('musick', 'holland')") # physical properties of soils correlated as taxonomic subgroup "Typic Argialbolls" res <- fetchLDM(x = "Typic Argialbolls", what = "corr_taxsubgrp", tables = "lab_physical_properties") ## End(Not run)
SoilProfileCollection
from NASISFetch commonly used site/pedon/horizon or mapunit component data from NASIS,
returned as a SoilProfileCollection
object.
This function imports data from NASIS into R as a SoilProfileCollection
object.
It "flattens" NASIS pedon and component tables, including their child tables, into several
more manageable data frames. Primarily these functions access the local NASIS database using
an ODBC connection. The dsn
argument allows you to specify a path or DBIConnection
to an SQLite database. The argument from = "pedon_report"
, data can be read
from the NASIS Report 'fetchNASIS', from either text file or URL (specified as url
). The primary purpose
of fetchNASIS(from = "pedon_report")
is importing datasets larger than 8000+
pedons/components.
The value of nullFragsAreZero
will have a significant impact on the
rock fragment fractions returned by fetchNASIS. Set nullFragsAreZero = FALSE
in those cases where there are many data-gaps and NULL rock
fragment values should be interpreted as NULL. Set
nullFragsAreZero = TRUE
in those cases where NULL rock
fragment values should be interpreted as 0.
This function attempts to do most of the boilerplate work when extracting site/pedon/horizon or component data from a local NASIS database. Pedon IDs that are missing horizon data, or have errors in their horizonation are printed on the console. Pedons with combination horizons (e.g. B/C) are erroneously marked as errors due to the way in which they are stored in NASIS as two overlapping horizon records.
Tutorials:
fetchNASIS( from = "pedons", url = NULL, SS = TRUE, rmHzErrors = FALSE, nullFragsAreZero = TRUE, soilColorState = "moist", mixColors = TRUE, lab = FALSE, fill = FALSE, dropAdditional = TRUE, dropNonRepresentative = TRUE, duplicates = FALSE, stringsAsFactors = NULL, dsn = NULL ) get_concentrations_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_phfmp_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL)
fetchNASIS( from = "pedons", url = NULL, SS = TRUE, rmHzErrors = FALSE, nullFragsAreZero = TRUE, soilColorState = "moist", mixColors = TRUE, lab = FALSE, fill = FALSE, dropAdditional = TRUE, dropNonRepresentative = TRUE, duplicates = FALSE, stringsAsFactors = NULL, dsn = NULL ) get_concentrations_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_phfmp_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL)
from |
Determines what objects should fetched? Default: |
url |
String specifying the url for the NASIS pedon_report (default:
|
SS |
Fetch data from the currently loaded selected set in NASIS or from
the entire Local database (default: |
rmHzErrors |
Should pedons with horizon depth errors be removed from
the results? (default: |
nullFragsAreZero |
Should fragment volumes of |
soilColorState |
Used only for |
mixColors |
Should mixed colors be calculated (Default: |
lab |
Should the |
fill |
Include pedon or component records without horizon data in result? (default: |
dropAdditional |
Used only for |
dropNonRepresentative |
Used only for |
duplicates |
Used only for |
stringsAsFactors |
deprecated |
dsn |
Optional: path or DBIConnection to local database containing NASIS table structure; default: |
A SoilProfileCollection
object
D. E. Beaudette, J. M. Skovlin, S.M. Roecker, A.G. Brown
get_component_data_from_NASIS()
Fetch KSSL laboratory pedon/horizon layer data from a local NASIS database, return as a SoilProfileCollection object.
fetchNASISLabData(SS = TRUE, dsn = NULL)
fetchNASISLabData(SS = TRUE, dsn = NULL)
SS |
fetch data from the currently loaded selected set in NASIS or from
the entire local database (default: |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
This function currently works only on Windows, and requires a 'nasis_local' ODBC connection.
a SoilProfileCollection object
J.M. Skovlin and D.E. Beaudette
get_labpedon_data_from_NASIS_db
Get component tables from NASIS Web Reports
fetchNASISWebReport( projectname, rmHzErrors = FALSE, fill = FALSE, stringsAsFactors = NULL ) get_component_from_NASISWebReport(projectname, stringsAsFactors = NULL) get_chorizon_from_NASISWebReport( projectname, fill = FALSE, stringsAsFactors = NULL ) get_legend_from_NASISWebReport( mlraoffice, areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_lmuaoverlap_from_NASISWebReport( areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_mapunit_from_NASISWebReport( areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_projectmapunit_from_NASISWebReport(projectname, stringsAsFactors = NULL) get_projectmapunit2_from_NASISWebReport( mlrassoarea, fiscalyear, projectname, stringsAsFactors = NULL ) get_project_from_NASISWebReport(mlrassoarea, fiscalyear) get_progress_from_NASISWebReport(mlrassoarea, fiscalyear, projecttypename) get_project_correlation_from_NASISWebReport( mlrassoarea, fiscalyear, projectname ) get_cosoilmoist_from_NASISWebReport( projectname, impute = TRUE, stringsAsFactors = NULL ) get_sitesoilmoist_from_NASISWebReport(usiteid)
fetchNASISWebReport( projectname, rmHzErrors = FALSE, fill = FALSE, stringsAsFactors = NULL ) get_component_from_NASISWebReport(projectname, stringsAsFactors = NULL) get_chorizon_from_NASISWebReport( projectname, fill = FALSE, stringsAsFactors = NULL ) get_legend_from_NASISWebReport( mlraoffice, areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_lmuaoverlap_from_NASISWebReport( areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_mapunit_from_NASISWebReport( areasymbol, droplevels = TRUE, stringsAsFactors = NULL ) get_projectmapunit_from_NASISWebReport(projectname, stringsAsFactors = NULL) get_projectmapunit2_from_NASISWebReport( mlrassoarea, fiscalyear, projectname, stringsAsFactors = NULL ) get_project_from_NASISWebReport(mlrassoarea, fiscalyear) get_progress_from_NASISWebReport(mlrassoarea, fiscalyear, projecttypename) get_project_correlation_from_NASISWebReport( mlrassoarea, fiscalyear, projectname ) get_cosoilmoist_from_NASISWebReport( projectname, impute = TRUE, stringsAsFactors = NULL ) get_sitesoilmoist_from_NASISWebReport(usiteid)
projectname |
text string vector of project names to be inserted into a
SQL WHERE clause (default: |
rmHzErrors |
should pedons with horizonation errors be removed from the
results? (default: |
fill |
should rows with missing component ids be removed (default: |
stringsAsFactors |
deprecated |
mlraoffice |
text string value identifying the MLRA Regional Soil
Survey Office group name inserted into a SQL WHERE clause (default: |
areasymbol |
text string value identifying the area symbol (e.g.
|
droplevels |
logical: indicating whether to drop unused levels in classifying factors. This is useful when a class has large number of unused classes, which can waste space in tables and figures. |
mlrassoarea |
text string value identifying the MLRA Soil Survey Office
areasymbol symbol inserted into a SQL WHERE clause (default: |
fiscalyear |
text string value identifying the fiscal year inserted
into a SQL WHERE clause (default: |
projecttypename |
text string value identifying the project type name
inserted into a SQL WHERE clause (default: |
impute |
replace missing (i.e. |
usiteid |
character: User Site IDs |
A data.frame or list with the results.
Stephen Roecker
This function fetches a variety of data associated with named soil series, extracted from the USDA-NRCS Official Series Description text files and detailed soil survey (SSURGO). These data are updated quarterly and made available via SoilWeb. Set extended = TRUE
and see the soilweb.metadata
list element for information on when the source data were last updated.
fetchOSD(soils, colorState = "moist", extended = FALSE)
fetchOSD(soils, colorState = "moist", extended = FALSE)
soils |
a character vector of named soil series; case-insensitive |
colorState |
color state for horizon soil color visualization: "moist" or "dry" |
extended |
if |
The standard set of "site" and "horizon" data are returned as a SoilProfileCollection
object (extended = FALSE
). The "extended" suite of summary data can be requested by setting extended = TRUE
. The resulting object will be a list
with the following elements:
SoilProfileCollection
containing standards "site" and "horizon" data
competing soil series from the SC database snapshot
geographically associated soils, extracted from named section in the OSD
empirical probabilities for geomorphic component, derived from the current SSURGO snapshot
empirical probabilities for hillslope position, derived from the current SSURGO snapshot
empirical probabilities for mountain slope position, derived from the current SSURGO snapshot
empirical probabilities for river terrace position, derived from the current SSURGO snapshot
empirical probabilities for flat landscapes, derived from the current SSURGO snapshot
empirical probabilities for surface shape (across-slope) from the current SSURGO snapshot
empirical probabilities for surface shape (down-slope) from the current SSURGO snapshot
empirical probabilities for parent material kind, derived from the current SSURGO snapshot
empirical probabilities for parent material origin, derived from the current SSURGO snapshot
empirical MLRA membership values, derived from the current SSURGO snapshot
area cross-tabulation of ecoclassid by soil series name, derived from the current SSURGO snapshot, major components only
climate summaries from PRISM stack (CONUS only)
select quantiles of NCCPI and Irrigated NCCPI, derived from the current SSURGO snapshot
metadata associated with SoilWeb cached summaries
When using extended = TRUE
, there are a couple of scenarios in which series morphology contained in SPC
do not fully match records in the associated series summary tables (e.g. competing
).
- Climate summaries are empty data.frames
because these summaries are currently generated from PRISM. We are working on a solution that uses DAYMET.
- Extended summaries are present but morphology missing from SPC
. A warning is issued.
These last two cases are problematic for analysis that makes use of morphology and extended data, such as outlined in this tutorial on competing soil series.
a SoilProfileCollection
object containing basic soil morphology and taxonomic information.
Requests to the SoilWeb API are split into batches of 100 series names from soils
via makeChunks()
.
D.E. Beaudette, A.G. Brown
USDA-NRCS OSD search tools: https://soilseries.sc.egov.usda.gov/
library(aqp) # soils of interest s.list <- c('musick', 'cecil', 'drummer', 'amador', 'pentz', 'reiff', 'san joaquin', 'montpellier', 'grangeville', 'pollasky', 'ramona') # fetch and convert data into an SPC s.moist <- fetchOSD(s.list, colorState='moist') s.dry <- fetchOSD(s.list, colorState='dry') # plot profiles # moist soil colors par(mar=c(0,0,0,0), mfrow=c(2,1)) plot(s.moist, name='hzname', cex.names=0.85, axis.line.offset=-4) plot(s.dry, name='hzname', cex.names=0.85, axis.line.offset=-4) # extended mode: return a list with SPC + summary tables x <- fetchOSD(s.list, extended = TRUE, colorState = 'dry') par(mar=c(0,0,1,1)) plot(x$SPC) str(x, 1)
library(aqp) # soils of interest s.list <- c('musick', 'cecil', 'drummer', 'amador', 'pentz', 'reiff', 'san joaquin', 'montpellier', 'grangeville', 'pollasky', 'ramona') # fetch and convert data into an SPC s.moist <- fetchOSD(s.list, colorState='moist') s.dry <- fetchOSD(s.list, colorState='dry') # plot profiles # moist soil colors par(mar=c(0,0,0,0), mfrow=c(2,1)) plot(s.moist, name='hzname', cex.names=0.85, axis.line.offset=-4) plot(s.dry, name='hzname', cex.names=0.85, axis.line.offset=-4) # extended mode: return a list with SPC + summary tables x <- fetchOSD(s.list, extended = TRUE, colorState = 'dry') par(mar=c(0,0,1,1)) plot(x$SPC) str(x, 1)
Fetch commonly used site/horizon data from a version 5.x PedonPC database, return as a SoilProfileCollection object.
fetchPedonPC(dsn) getHzErrorsPedonPC(dsn, strict = TRUE)
fetchPedonPC(dsn) getHzErrorsPedonPC(dsn, strict = TRUE)
dsn |
The path to a PedonPC version 6.x database |
strict |
Use "strict" horizon error checking? Default: |
a SoilProfileCollection class object
This function attempts to do most of the boilerplate work when
extracting site/horizon data from a PedonPC or local NASIS database. Pedons
that have errors in their horizonation are excluded from the returned
object, however, their IDs are printed on the console. See
getHzErrorsPedonPC
for a simple approach to identifying pedons
with problematic horizonation. Records from the 'taxhistory' table are
selected based on 1) most recent record, or 2) record with the least amount
of missing data.
D. E. Beaudette and J. M. Skovlin
NOTICE: The SoilWeb snapshot of the RaCA data has been deprecated. The latest version of the data, including values measured by the Kellogg Soil Survey Laboratory, and supporting documentation, are available here: https://www.nrcs.usda.gov/resources/data-and-reports/rapid-carbon-assessment-raca. Download link on National Agricultural Library Ag Data Commons: https://data.nal.usda.gov/dataset/rapid-carbon-assessment-raca
Get Rapid Carbon Assessment (RaCA) data by state, geographic bounding-box, RaCA site ID, or soil series query from the SoilWeb API. This interface to the data was an experimental delivery service that does not include the latest soil organic carbon (SOC) measurements.
Please use current RaCA distribution if you need lab measured SOC rather than SOC estimated by VNIR.
This interface will be updated sometime calendar year 2022 to include the latest soil morphology, taxonomic classification, and measured SOC values. More detailed coordinates for sample sites should also be available.
fetchRaCA( series = NULL, bbox = NULL, state = NULL, rcasiteid = NULL, get.vnir = FALSE )
fetchRaCA( series = NULL, bbox = NULL, state = NULL, rcasiteid = NULL, get.vnir = FALSE )
series |
a soil series name; case-insensitive |
bbox |
a bounding box in WGS84 geographic coordinates e.g. |
state |
a two-letter US state abbreviation; case-insensitive |
rcasiteid |
a RaCA site id (e.g. 'C1609C01') |
get.vnir |
logical, should associated VNIR spectra be downloaded? (see details) |
The VNIR spectra associated with RaCA data are quite large (each gzip-compressed VNIR spectra record is about 6.6kb), so requests for these data are disabled by default. Note that VNIR spectra can only be queried by soil series or geographic BBOX.
pedons
:a SoilProfileCollection
object containing site/pedon/horizon data
trees
:a data.frame
object containing tree DBH and height
veg
:a data.frame
object containing plant species
stock
:a data.frame
object containing carbon quantities (stocks) at standardized depths
sample
:a data.frame
object containing sample-level bulk density and soil organic carbon values
spectra
:a numeric matrix
containing VNIR reflectance spectra from 350–2500 nm
D.E. Beaudette, USDA-NRCS staff
https://data.nal.usda.gov/dataset/rapid-carbon-assessment-raca
Query soil/climate data from USDA-NRCS SCAN Stations.
fetchSCAN( site.code = NULL, year = NULL, report = "SCAN", timeseries = c("Daily", "Hourly"), tz = "US/Central", ... ) SCAN_sensor_metadata(site.code) SCAN_site_metadata(site.code = NULL)
fetchSCAN( site.code = NULL, year = NULL, report = "SCAN", timeseries = c("Daily", "Hourly"), tz = "US/Central", ... ) SCAN_sensor_metadata(site.code) SCAN_site_metadata(site.code = NULL)
site.code |
a vector of site codes. If |
year |
a vector of years |
report |
report name, single value only; default |
timeseries |
either |
tz |
Target timezone to convert |
... |
additional arguments. May include |
Possible above and below ground sensor types include: 'SMS' (soil moisture), 'STO' (soil temperature), 'SAL' (salinity), 'TAVG' (daily average air temperature), 'TMIN' (daily minimum air temperature), 'TMAX' (daily maximum air temperature), 'PRCP' (daily precipitation), 'PREC' (daily precipitation), 'SNWD' (snow depth), 'WTEQ' (snow water equivalent),'WDIRV' (wind direction), 'WSPDV' (wind speed), 'LRADT' (solar radiation/langley total).
This function converts below-ground sensor depth from inches to cm. All temperature values are reported as degrees C. Precipitation, snow depth, and snow water content are reported as inches.
The datetime
column in sensor data results is converted to the target time zone specified in tz
argument, the default is "US/Central"
. Use tz = "UTC"
(or other OlsonNames()
that do not use daylight savings, e.g. "US/Arizona"
) to avoid having a mix of time offsets due to daylight savings time.
All Soil Climate Analysis Network (SCAN) sensor measurements are reported hourly.
Element Measured | Sensor Type | Precision |
Air Temperature | Shielded thermistor | 0.1 degrees C |
Barometric Pressure | Silicon capacitive pressure sensor | 1% |
Precipitation | Storage-type gage or tipping bucket | Storage: 0.1 inches; |
Relative Humidity | Thin film capacitance-type sensor | 1% |
Snow Depth | Sonic sensor (not on all stations) | 0.5 inches |
Snow Water Content | Snow pillow device and a pressure transducer (not on all stations) | 0.1 inches |
Soil Moisture | Dielectric constant measuring device. Typical measurements are at 2", 4", 8", 20", and 40" where possible. | 0.50% |
Soil Temperature | Encapsulated thermistor. Typical measurements are at 2", 4", 8", 20", and 40" where possible. | 0.1 degrees C |
Solar Radiation | Pyranometer | 0.01 watts per meter |
Wind Speed and Direction | Propellor-type anemometer | Speed: 0.1 miles per hour; Direction: 1 degree |
All Snow Telemetry (SNOTEL) sensor measurements are reported daily.
Element Measured | Sensor Type | Precision |
Air Temperature | Shielded thermistor | 0.1 degrees C |
Barometric Pressure | Silicon capacitive pressure sensor | 1% |
Precipitation | Storage-type gage or tipping bucket | Storage: 0.1 inches; Tipping bucket: 0.01 inches |
Relative Humidity | Thin film capacitance-type sensor | 1% |
Snow Depth | Sonic sensor | 0.5 inches |
Snow Water Content | Snow pillow device and a pressure transducer | 0.1 inches |
Soil Moisture | Dielectric constant measuring device. Typical measurements are at 2", 4", 8", 20", and 40" where possible. | 0.50% |
Soil Temperature | Encapsulated thermistor. Typical measurements are at 2", 4", 8", 20", and 40" where possible. | 0.1 degrees C |
Solar Radiation | Pyranometer | 0.01 watts per meter |
Wind Speed and Direction | Propellor-type anemometer | Speed: 0.1 miles per hour; Direction: 1 degree |
See the fetchSCAN tutorial for additional usage and visualization examples.
a list
of data.frame
objects, where each element name is a sensor type, plus a metadata
table; different report
types change the types of sensor data returned. SCAN_sensor_metadata()
and SCAN_site_metadata()
return a data.frame
. NULL
on bad request.
D.E. Beaudette, A.G. Brown, J.M. Skovlin
See the Soil Climate Analysis Network home page for more information on the SCAN program, and links to other associated programs such as SNOTEL, at the National Weather and Climate Center. You can get information on available web services, as well as interactive maps of snow water equivalent, precipitation and streamflow.
## Not run: # get data x <- try(fetchSCAN(site.code = c(356, 2072), year = c(2015, 2016))) str(x, 1) # get sensor metadata m <- SCAN_sensor_metadata(site.code = c(356, 2072)) m # get site metadata m <- SCAN_site_metadata(site.code = c(356, 2072)) m # # get hourly data (warning, result is large ~11MB) # x <- try(fetchSCAN(site.code = c(356, 2072), # year = 2015, # timeseries = "Hourly")) # # # data are in US/Central time, standard or daylight savings time based on day of year # unique(format(x$SMS$datetime, '%Z')) # # # the site metadata indicate timeseries data time zone (dataTimeZone) # # for site 356 the timezone is offset of 8 hours behind UTC # # # to obtain all datetime data with a consistent offset use ETC GMT offset # # e.g. "Etc/GMT+8". note the sign is inverted ("GMT+8" vs. `dataTimeZone=-8`) # x <- try(fetchSCAN(site.code = c(356, 2072), # year = 2015, # timeseries = "Hourly", # tz = "Etc/GMT+8")) ## End(Not run)
## Not run: # get data x <- try(fetchSCAN(site.code = c(356, 2072), year = c(2015, 2016))) str(x, 1) # get sensor metadata m <- SCAN_sensor_metadata(site.code = c(356, 2072)) m # get site metadata m <- SCAN_site_metadata(site.code = c(356, 2072)) m # # get hourly data (warning, result is large ~11MB) # x <- try(fetchSCAN(site.code = c(356, 2072), # year = 2015, # timeseries = "Hourly")) # # # data are in US/Central time, standard or daylight savings time based on day of year # unique(format(x$SMS$datetime, '%Z')) # # # the site metadata indicate timeseries data time zone (dataTimeZone) # # for site 356 the timezone is offset of 8 hours behind UTC # # # to obtain all datetime data with a consistent offset use ETC GMT offset # # e.g. "Etc/GMT+8". note the sign is inverted ("GMT+8" vs. `dataTimeZone=-8`) # x <- try(fetchSCAN(site.code = c(356, 2072), # year = 2015, # timeseries = "Hourly", # tz = "Etc/GMT+8")) ## End(Not run)
mukey
, nationalmusym
or areasymbol
This method facilitates queries to Soil Data Access (SDA) mapunit and survey area geometry. Queries are generated based on map unit key (mukey
) and national map unit symbol (nationalmusym
) for mupolygon
(SSURGO) or gsmmupolygon
(STATSGO) geometry OR legend key (lkey
) and area symbols (areasymbol
) for sapolygon
(Soil Survey Area; SSA) geometry).
A Soil Data Access query returns geometry and key identifying information about the map unit or area of interest. Additional columns from the map unit or legend table can be included; see add.fields
argument.
fetchSDA_spatial( x, by.col = "mukey", method = "feature", geom.src = "mupolygon", db = "SSURGO", add.fields = NULL, chunk.size = 10, verbose = TRUE, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
fetchSDA_spatial( x, by.col = "mukey", method = "feature", geom.src = "mupolygon", db = "SSURGO", add.fields = NULL, chunk.size = 10, verbose = TRUE, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
x |
A vector of map unit keys ( |
by.col |
Column name containing map unit identifier |
method |
geometry result type: |
geom.src |
Either |
db |
Default: |
add.fields |
Column names from |
chunk.size |
Number of values of |
verbose |
Print messages? |
as_Spatial |
Return sp classes? e.g. |
This function automatically "chunks" the input vector (using makeChunks()
) of map unit identifiers to minimize the likelihood of exceeding the SDA data request size. The number of chunks varies with the chunk.size
setting and the length of your input vector. If you are working with many map units and/or large extents, you may need to decrease this number in order to have more chunks.
Querying regions with complex mapping may require smaller chunk.size
. Numerically adjacent IDs in the input vector may share common qualities (say, all from same soil survey area or region) which could cause specific chunks to perform "poorly" (slow or error) no matter what the chunk size is. Shuffling the order of the inputs using sample()
may help to eliminate problems related to this, depending on how you obtained your set of MUKEY/nationalmusym to query. One could feasibly use muacres
as a heuristic to adjust for total acreage within chunks.
Note that STATSGO data are fetched where CLIPAREASYMBOL = 'US'
to avoid duplicating state and national subsets of the geometry.
A prototype interface, geom.src="mlrapolygon"
, is provided for obtaining Major Land Resource Area (MLRA) polygon
boundaries. When using this geometry source x
is a vector of MLRARSYM
(MLRA Symbols). The geometry source is
the MLRA Geographic Database v5.2 (2022) which is not (yet) part of Soil Data Access. Instead of SDA, GDAL utilities
are used to read a zipped ESRI Shapefile from a remote URL: https://www.nrcs.usda.gov/sites/default/files/2022-10/MLRA_52_2022.zip.
Therefore, most additional fetchSDA_spatial()
arguments are not currently supported for the MLRA geometry source.
In the future a mlrapolygon
table may be added to SDA (analogous to mupolygon
and sapolygon
),
and the function will be updated accordingly at that time.
an sf
data.frame corresponding to SDA spatial data for all symbols requested. If as_Spatial=TRUE
returns a Spatial*DataFrame
from the sp package via sf::as_Spatial()
for backward compatibility. Default result contains geometry with attribute table containing unique feature ID, symbol and area symbol plus additional fields in result specified with add.fields
.
Andrew G. Brown, Dylan E. Beaudette
# get spatial data for a single mukey single.mukey <- try(fetchSDA_spatial(x = "2924882")) # demonstrate fetching full extent (multi-mukey) of national musym full.extent.nmusym <- try(fetchSDA_spatial(x = "2x8l5", by = "nmusym")) # compare extent of nmusym to single mukey within it if (!inherits(single.mukey, 'try-error') && !inherits(full.extent.nmusym, 'try-error')) { if (requireNamespace("sf")) { plot(sf::st_geometry(full.extent.nmusym), col = "RED", border = 0) plot(sf::st_geometry(single.mukey), add = TRUE, col = "BLUE", border = 0) } } # demo adding a field (`muname`) to attribute table of result head(try(fetchSDA_spatial(x = "2x8l5", by="nmusym", add.fields="muname")))
# get spatial data for a single mukey single.mukey <- try(fetchSDA_spatial(x = "2924882")) # demonstrate fetching full extent (multi-mukey) of national musym full.extent.nmusym <- try(fetchSDA_spatial(x = "2x8l5", by = "nmusym")) # compare extent of nmusym to single mukey within it if (!inherits(single.mukey, 'try-error') && !inherits(full.extent.nmusym, 'try-error')) { if (requireNamespace("sf")) { plot(sf::st_geometry(full.extent.nmusym), col = "RED", border = 0) plot(sf::st_geometry(single.mukey), add = TRUE, col = "BLUE", border = 0) } } # demo adding a field (`muname`) to attribute table of result head(try(fetchSDA_spatial(x = "2x8l5", by="nmusym", add.fields="muname")))
This function obtains SoilGrids 2.0 properties information (250m raster resolution) given a data.frame
containing site IDs, latitudes and longitudes, or a spatial extent (see grid=TRUE
argument).
fetchSoilGrids( x, loc.names = c("id", "lat", "lon"), depth_intervals = c("0-5", "5-15", "15-30", "30-60", "60-100", "100-200"), variables = c("bdod", "cec", "cfvo", "clay", "nitrogen", "phh2o", "sand", "silt", "soc", "ocd", "wv0010", "wv0033", "wv1500"), grid = FALSE, filename = NULL, overwrite = TRUE, target_resolution = c(250, 250), summary_type = c("Q0.05", "Q0.5", "Q0.95", "mean"), endpoint = ifelse(!grid, "https://rest.isric.org/soilgrids/v2.0/properties/query", "https://files.isric.org/soilgrids/latest/data/"), ..., verbose = FALSE, progress = FALSE )
fetchSoilGrids( x, loc.names = c("id", "lat", "lon"), depth_intervals = c("0-5", "5-15", "15-30", "30-60", "60-100", "100-200"), variables = c("bdod", "cec", "cfvo", "clay", "nitrogen", "phh2o", "sand", "silt", "soc", "ocd", "wv0010", "wv0033", "wv1500"), grid = FALSE, filename = NULL, overwrite = TRUE, target_resolution = c(250, 250), summary_type = c("Q0.05", "Q0.5", "Q0.95", "mean"), endpoint = ifelse(!grid, "https://rest.isric.org/soilgrids/v2.0/properties/query", "https://files.isric.org/soilgrids/latest/data/"), ..., verbose = FALSE, progress = FALSE )
x |
A |
loc.names |
Optional: Column names referring to site ID, latitude and longitude. Default: |
depth_intervals |
Default: |
variables |
Default: |
grid |
Download subset of SoilGrids Cloud Optimized GeoTIFF? Default: |
filename |
Only used when |
overwrite |
Only used when |
target_resolution |
Only used when |
summary_type |
Only used when |
endpoint |
Optional: custom API endpoint. Default: |
... |
Additional arguments passed to |
verbose |
Print messages? Default: |
progress |
logical, give progress when iterating over multiple requests; Default: |
SoilGrids API and maps return values as whole (integer) numbers to minimize the storage space used. These values have conversion factors applied by fetchSoilGrids()
to produce conventional units shown in the table below (see Details).
Name | Description | Mapped units | Conversion factor | Conventional units |
bdod | Bulk density of the fine earth fraction | cg/cm^3 | 100 | kg/dm^3 |
cec | Cation Exchange Capacity of the soil | mmol(c)/kg | 10 | cmol(c)/kg |
cfvo | Volumetric fraction of coarse fragments (> 2 mm) | cm^3/dm^3 (vol per mil) | 10 | cm^3/100cm^3 (vol%) |
clay | Proportion of clay particles (< 0.002 mm) in the fine earth fraction | g/kg | 10 | g/100g (%) |
nitrogen | Total nitrogen (N) | cg/kg | 100 | g/kg |
phh2o | Soil pH | pH*10 | 10 | pH |
sand | Proportion of sand particles (> 0.05 mm) in the fine earth fraction | g/kg | 10 | g/100g (%) |
silt | Proportion of silt particles (>= 0.002 mm and <= 0.05 mm) in the fine earth fraction | g/kg | 10 | g/100g (%) |
soc | Soil organic carbon content in the fine earth fraction | dg/kg | 10 | g/kg |
ocd | Organic carbon density | hg/m^3 | 10 | kg/m^3 |
ocs | Organic carbon stocks (0-30cm depth interval only) | t/ha | 10 | kg/m^2 |
wv0010 | Volumetric Water Content at 10kPa | 0.1 v% or 1 mm/m | 10 | volume (%) |
wv0033 | Volumetric Water Content at 33kPa | 0.1 v% or 1 mm/m | 10 | volume (%) |
wv1500 | Volumetric Water Content at 1500kPa | 0.1 v% or 1 mm/m | 10 | volume (%) |
SoilGrids predictions are made for the six standard depth intervals specified in the GlobalSoilMap IUSS working group and its specifications. The default depth
intervals returned are (in centimeters): "0-5"
, "5-15"
, "15-30"
, "30-60"
, "60-100"
, "100-200"
for the properties "bdod"
, "cec"
, "cfvo"
,
"clay"
, "nitrogen"
, "phh2o"
, "sand"
, "silt"
, "soc"
, "ocd"
, "wv0010"
, "wv0033"
, "wv1500"
–each with 5th, 50th, 95th, mean and uncertainty values. Soil organic carbon stocks (0-30cm) (variables="ocs"
) are returned only for depth_intervals="0-30"
. The uncertainty values are the ratio
between the inter-quantile range (90% prediction interval width) and the median : (Q0.95-Q0.05)/Q0.50.
All values are converted from "mapped" to "conventional"
based on above table conversion factors. Point data requests are made through "properties/query"
endpoint of the SoilGrids v2.0 REST API.
Please check ISRIC's data policy, disclaimer and citation: https://www.isric.org/about/data-policy.
Find out more information about the SoilGrids and GlobalSoilMap products here:
A SoilProfileCollection or SpatRaster when grid=TRUE
. Returns try-error
if all requests fail. Any error messages resulting from parsing will be echoed when verbose=TRUE
.
Andrew G. Brown
Common soil chemical and physical properties: Poggio, L., de Sousa, L. M., Batjes, N. H., Heuvelink, G. B. M., Kempen, B., Ribeiro, E., and Rossiter, D.: SoilGrids 2.0: producing soil information for the globe with quantified spatial uncertainty, SOIL, 7, 217–240, 2021. DOI: doi:10.5194/soil-7-217-2021
Soil water content at different pressure heads: Turek, M.E., Poggio, L., Batjes, N. H., Armindo, R. A., de Jong van Lier, Q., de Sousa, L.M., Heuvelink, G. B. M. : Global mapping of volumetric water retention at 100, 330 and 15000 cm suction using the WoSIS database, International Soil and Water Conservation Research, 11-2, 225-239, 2023. DOI: doi:10.1016/j.iswcr.2022.08.001
## Not run: library(aqp) your.points <- data.frame(id = c("A", "B"), lat = c(37.9, 38.1), lon = c(-120.3, -121.5), stringsAsFactors = FALSE) x <- try(fetchSoilGrids(your.points)) if (!inherits(x, 'try-error')) aqp::plotSPC(x, name = NA, color = "socQ50") # organic carbon stocks use 0-30cm interval y <- try(fetchSoilGrids(your.points[1, ], depth_interval = c("0-5", "0-30", "5-15", "15-30"), variables = c("soc", "bdod", "ocd", "ocs"))) # extract horizons from a SoilProfileCollection where horizon 2 overlaps 1, 3, and 4 h <- aqp::horizons(y) # "ocs" (organic carbon stock 0-30cm interval) h[2, ] h$thickness_meters <- ((h$hzdepb - h$hzdept) / 100) # estimate "ocs" from modeled organic carbon and bulk density in 0-5, 5-15, 15-30 intervals # (sum the product of soc, bdod, and thickness in meters) # (1 gram per cubic decimeter = 1 kilogram per cubic meter) sum(h$socmean * h$bdodmean * h$thickness_meters, na.rm = TRUE) # estimate "ocs" from modeled organic carbon density in 0-5, 5-15, 15-30 intervals # (sum the product of "ocd" and thickness in meters) sum(h$ocdmean * h$thickness_meters, na.rm = TRUE) ## End(Not run)
## Not run: library(aqp) your.points <- data.frame(id = c("A", "B"), lat = c(37.9, 38.1), lon = c(-120.3, -121.5), stringsAsFactors = FALSE) x <- try(fetchSoilGrids(your.points)) if (!inherits(x, 'try-error')) aqp::plotSPC(x, name = NA, color = "socQ50") # organic carbon stocks use 0-30cm interval y <- try(fetchSoilGrids(your.points[1, ], depth_interval = c("0-5", "0-30", "5-15", "15-30"), variables = c("soc", "bdod", "ocd", "ocs"))) # extract horizons from a SoilProfileCollection where horizon 2 overlaps 1, 3, and 4 h <- aqp::horizons(y) # "ocs" (organic carbon stock 0-30cm interval) h[2, ] h$thickness_meters <- ((h$hzdepb - h$hzdept) / 100) # estimate "ocs" from modeled organic carbon and bulk density in 0-5, 5-15, 15-30 intervals # (sum the product of soc, bdod, and thickness in meters) # (1 gram per cubic decimeter = 1 kilogram per cubic meter) sum(h$socmean * h$bdodmean * h$thickness_meters, na.rm = TRUE) # estimate "ocs" from modeled organic carbon density in 0-5, 5-15, 15-30 intervals # (sum the product of "ocd" and thickness in meters) sum(h$ocdmean * h$thickness_meters, na.rm = TRUE) ## End(Not run)
This is a higher level wrapper around the get_SRI and get_SRI_layers functions. This function can fetch multiple File Geodatabases (GDB) and returns all the layers within the GDB.
fetchSRI(gdb, ...)
fetchSRI(gdb, ...)
gdb |
A |
... |
Arguments to pass to get_SRI. |
A list.
Josh Erickson
get_SRI()
get_SRI_layers()
## Not run: # fetch Willamette and Winema SRI sri <- fetchSRI(gdb = c('will', 'win'), quiet = TRUE) ## End(Not run)
## Not run: # fetch Willamette and Winema SRI sri <- fetchSRI(gdb = c('will', 'win'), quiet = TRUE) ## End(Not run)
Get vegetation plot data from local NASIS database
fetchVegdata(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_location_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_trhi_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_species_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transect_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transpecies_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transpoints_from_NASIS_db(SS = TRUE, dsn = NULL) get_vegplot_prodquadrats_from_NASIS_db(SS = TRUE, dsn = NULL) get_vegplot_tree_si_summary_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_speciesbasalarea_from_NASIS(SS = TRUE, dsn = NULL) get_vegplot_tree_si_details_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_textnote_from_NASIS_db( SS = TRUE, fixLineEndings = TRUE, stringsAsFactors = NULL, dsn = NULL )
fetchVegdata(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_location_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_trhi_from_NASIS_db(SS = TRUE, stringsAsFactors = NULL, dsn = NULL) get_vegplot_species_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transect_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transpecies_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_transpoints_from_NASIS_db(SS = TRUE, dsn = NULL) get_vegplot_prodquadrats_from_NASIS_db(SS = TRUE, dsn = NULL) get_vegplot_tree_si_summary_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_speciesbasalarea_from_NASIS(SS = TRUE, dsn = NULL) get_vegplot_tree_si_details_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_vegplot_textnote_from_NASIS_db( SS = TRUE, fixLineEndings = TRUE, stringsAsFactors = NULL, dsn = NULL )
SS |
fetch data from the currently loaded selected set in NASIS or from the entire local database (default: |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
fixLineEndings |
Replace |
A named list containing: "vegplot", "vegplotlocation", "vegplotrhi", "vegplotspecies", "vegtransect", "vegtransplantsum", 'vegsiteindexsum', "vegsiteindexdet", and "vegplottext" tables
A function to subset KSSL "geochem" / elemental analysis result table to obtain rows/columns based on: column name, preparation code, major / trace element method.
filter_geochem( geochem, columns = NULL, prep_code = NULL, major_element_method = NULL, trace_element_method = NULL )
filter_geochem( geochem, columns = NULL, prep_code = NULL, major_element_method = NULL, trace_element_method = NULL )
geochem |
geochemical data, as returned by fetchKSSL |
columns |
Column name(s) to include in result |
prep_code |
Character vector of prep code(s) to include in result. |
major_element_method |
Character vector of major element method(s) to include in result. |
trace_element_method |
Character vector of trace element method(s) to include in result. |
A data.frame, subset according to the constraints specified in arguments.
Andrew G. Brown.
IN
statement.Concatenate a vector to SQL IN
-compatible syntax: letters[1:3]
becomes ('a','b','c')
. Values in x
are first passed through unique()
.
format_SQL_in_statement(x)
format_SQL_in_statement(x)
x |
A character vector. |
A character vector (unit length) containing concatenated group syntax for use in SQL IN
, with unique value found in x
.
Only character
output is supported.
format_SQL_in_statement(c(2648889L, 2648890L))
format_SQL_in_statement(c(2648889L, 2648890L))
Get, format, mix, and return color data from a NASIS database.
get_colors_from_NASIS_db(SS = TRUE, mixColors = TRUE, dsn = NULL)
get_colors_from_NASIS_db(SS = TRUE, mixColors = TRUE, dsn = NULL)
SS |
fetch data from Selected Set in NASIS or from the entire local
database (default: |
mixColors |
should mixed colors be calculated (Default: |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A data.frame with the results.
Jay M. Skovlin and Dylan E. Beaudette
simplifyColorData
,
get_hz_data_from_NASIS_db
,
get_site_data_from_NASIS_db
Get, format, mix, and return color data from a PedonPC database.
get_colors_from_pedon_db(dsn)
get_colors_from_pedon_db(dsn)
dsn |
The path to a 'pedon.mdb' database. |
A data.frame with the results.
Dylan E. Beaudette and Jay M. Skovlin
get_hz_data_from_pedon_db
,
get_site_data_from_pedon_db
Get component month data from a local NASIS Database.
get_comonth_from_NASIS_db( SS = TRUE, fill = FALSE, stringsAsFactors = NULL, dsn = NULL )
get_comonth_from_NASIS_db( SS = TRUE, fill = FALSE, stringsAsFactors = NULL, dsn = NULL )
SS |
get data from the currently loaded Selected Set in NASIS or from the entire local database (default: TRUE) |
fill |
should missing "month" rows in the comonth table be filled with NA (FALSE) |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A list with the results.
Stephen Roecker
if(local_NASIS_defined()) { # query text note data cm <- try(get_comonth_from_NASIS_db()) # show structure of component month data str(cm) }
if(local_NASIS_defined()) { # query text note data cm <- try(get_comonth_from_NASIS_db()) # show structure of component month data str(cm) }
Get component data from a local NASIS Database
get_component_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_diaghz_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_restrictions_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_correlation_data_from_NASIS_db( SS = TRUE, dropAdditional = TRUE, dropNotRepresentative = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_cogeomorph_data_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_cogeomorph_data_from_NASIS_db2(SS = TRUE, dsn = NULL) get_component_copm_data_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_esd_data_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_otherveg_data_from_NASIS_db(SS = TRUE, dsn = NULL) get_copedon_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_horizon_data_from_NASIS_db( SS = TRUE, fill = FALSE, dsn = NULL, nullFragsAreZero = TRUE )
get_component_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_diaghz_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_restrictions_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_correlation_data_from_NASIS_db( SS = TRUE, dropAdditional = TRUE, dropNotRepresentative = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_cogeomorph_data_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_cogeomorph_data_from_NASIS_db2(SS = TRUE, dsn = NULL) get_component_copm_data_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_esd_data_from_NASIS_db( SS = TRUE, stringsAsFactors = NULL, dsn = NULL ) get_component_otherveg_data_from_NASIS_db(SS = TRUE, dsn = NULL) get_copedon_from_NASIS_db(SS = TRUE, dsn = NULL) get_component_horizon_data_from_NASIS_db( SS = TRUE, fill = FALSE, dsn = NULL, nullFragsAreZero = TRUE )
SS |
fetch data from the currently loaded selected set in NASIS or from
the entire local database (default: |
nullFragsAreZero |
should surface fragment cover percentages of NULL be interpreted as 0? (default: TRUE) |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
dropAdditional |
Remove map units with "additional" status? Default: |
dropNotRepresentative |
Remove non-representative data map units? Default: |
fill |
Return a single minimal (NA-filled) horizon for components with no horizon records? Default |
a data.frame
Dylan E. Beaudette, Stephen Roecker, and Jay M. Skovlin
if(local_NASIS_defined()) { # query text note data fc <- try(get_component_data_from_NASIS_db()) # show structure of component data returned str(fc) }
if(local_NASIS_defined()) { # query text note data fc <- try(get_component_data_from_NASIS_db()) # show structure of component data returned str(fc) }
Functions to load and flatten commonly used tables and from SSURGO file geodatabases, and create soil profile collection objects (SPC).
get_component_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, childs = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_legend_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL, stats = FALSE ) get_mapunit_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL, stats = FALSE ) fetchGDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, childs = FALSE, droplevels = TRUE, stringsAsFactors = NULL )
get_component_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, childs = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_legend_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL, stats = FALSE ) get_mapunit_from_GDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL, stats = FALSE ) fetchGDB( dsn = "gNATSGO_CONUS.gdb", WHERE = NULL, childs = FALSE, droplevels = TRUE, stringsAsFactors = NULL )
dsn |
data source name (interpretation varies by driver - for some drivers, dsn is a file name, but may also be a folder, or contain the name and access credentials of a database); in case of GeoJSON, dsn may be the character string holding the geojson data. It can also be an open database connection. |
WHERE |
text string formatted as an SQL WHERE clause (default: FALSE) |
childs |
logical; if FALSE parent material and geomorphic child tables are not flattened and appended |
droplevels |
logical: indicating whether to drop unused levels in classifying factors. This is useful when a class has large number of unused classes, which can waste space in tables and figures. |
stringsAsFactors |
deprecated |
stats |
Return statistics (number of mapunit keys per legend; number of components, major components per mapunit, total and hydric component percentage)? Default: |
These functions return data from SSURGO file geodatabases with the use of a
simple text string that formatted as an SQL WHERE clause (e.g. WHERE =
"areasymbol = 'IN001'"
. Any columns within the target table can be
specified (except for fetchGDB() which currently can only target one table
(e.g. legend, mapunit or component) at a time with the WHERE clause).
A data.frame
or SoilProfileCollection
object.
Stephen Roecker
## replace `dsn` with path to your own geodatabase (SSURGO OR gNATSGO) ## ## ## download CONUS gNATSGO from here: ## https://nrcs.app.box.com/v/soils/folder/191790828371 ## # dsn <- "D:/geodata/soils/gNATSGO_CONUS.gdb" # le <- get_legend_from_GDB(dsn = dsn, WHERE = "areasymbol LIKE '%'") # mu <- get_mapunit_from_GDB(dsn = dsn, WHERE = "muname LIKE 'Miami%'") # co <- get_component_from_GDB(dsn, WHERE = "compname = 'Miami' # AND majcompflag = 'Yes'", childs = FALSE) # f_in_GDB <- fetchGDB(WHERE = "areasymbol LIKE 'IN%'")
## replace `dsn` with path to your own geodatabase (SSURGO OR gNATSGO) ## ## ## download CONUS gNATSGO from here: ## https://nrcs.app.box.com/v/soils/folder/191790828371 ## # dsn <- "D:/geodata/soils/gNATSGO_CONUS.gdb" # le <- get_legend_from_GDB(dsn = dsn, WHERE = "areasymbol LIKE '%'") # mu <- get_mapunit_from_GDB(dsn = dsn, WHERE = "muname LIKE 'Miami%'") # co <- get_component_from_GDB(dsn, WHERE = "compname = 'Miami' # AND majcompflag = 'Yes'", childs = FALSE) # f_in_GDB <- fetchGDB(WHERE = "areasymbol LIKE 'IN%'")
Functions to download and flatten commonly used tables and from Soil Data Access, and create soil profile collection objects (SPC).
get_component_from_SDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, droplevels = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL ) get_cointerp_from_SDA( WHERE = NULL, mrulename = NULL, duplicates = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_legend_from_SDA(WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL) get_lmuaoverlap_from_SDA( WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL ) get_mapunit_from_SDA(WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL) get_chorizon_from_SDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, nullFragsAreZero = TRUE, droplevels = TRUE, stringsAsFactors = NULL ) fetchSDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, nullFragsAreZero = TRUE, rmHzErrors = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_cosoilmoist_from_SDA( WHERE = NULL, duplicates = FALSE, impute = TRUE, stringsAsFactors = NULL )
get_component_from_SDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, droplevels = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL ) get_cointerp_from_SDA( WHERE = NULL, mrulename = NULL, duplicates = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_legend_from_SDA(WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL) get_lmuaoverlap_from_SDA( WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL ) get_mapunit_from_SDA(WHERE = NULL, droplevels = TRUE, stringsAsFactors = NULL) get_chorizon_from_SDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, nullFragsAreZero = TRUE, droplevels = TRUE, stringsAsFactors = NULL ) fetchSDA( WHERE = NULL, duplicates = FALSE, childs = TRUE, nullFragsAreZero = TRUE, rmHzErrors = FALSE, droplevels = TRUE, stringsAsFactors = NULL ) get_cosoilmoist_from_SDA( WHERE = NULL, duplicates = FALSE, impute = TRUE, stringsAsFactors = NULL )
WHERE |
text string formatted as an SQL WHERE clause (default: FALSE) |
duplicates |
logical; if TRUE a record is returned for each unique mukey (may be many per nationalmusym) |
childs |
logical; if FALSE parent material and geomorphic child tables are not flattened and appended |
droplevels |
logical: indicating whether to drop unused levels in classifying factors. This is useful when a class has large number of unused classes, which can waste space in tables and figures. |
nullFragsAreZero |
should fragment volumes of NULL be interpreted as 0? (default: TRUE), see details |
stringsAsFactors |
deprecated |
mrulename |
character. Interpretation rule names |
rmHzErrors |
should pedons with horizonation errors be removed from the results? (default: FALSE) |
impute |
replace missing (i.e. |
These functions return data from Soil Data Access with the use of a simple
text string that formatted as an SQL WHERE clause (e.g. WHERE =
"areasymbol = 'IN001'"
. All functions are SQL queries that wrap around
SDAquery()
and format the data for analysis.
Beware SDA includes the data for both SSURGO and STATSGO2. The
areasymbol
for STATSGO2 is US
. For just SSURGO, include
WHERE = "areareasymbol != 'US'"
.
If the duplicates argument is set to TRUE, duplicate components are returned. This is not necessary with data returned from NASIS, which has one unique national map unit. SDA has duplicate map national map units, one for each legend it exists in.
The value of nullFragsAreZero
will have a significant impact on the
rock fragment fractions returned by fetchSDA
. Set
nullFragsAreZero = FALSE
in those cases where there are many
data-gaps and NULL rock fragment values should be interpreted as NULLs. Set
nullFragsAreZero = TRUE
in those cases where NULL rock fragment
values should be interpreted as 0.
Additional examples can be found in the Soil Data Access (SDA) Tutorial
A data.frame or SoilProfileCollection object.
Stephen Roecker
Read and flatten the component soil moisture month tables from a local NASIS Database.
get_cosoilmoist_from_NASIS( SS = TRUE, impute = TRUE, stringsAsFactors = NULL, dsn = NULL )
get_cosoilmoist_from_NASIS( SS = TRUE, impute = TRUE, stringsAsFactors = NULL, dsn = NULL )
SS |
fetch data from the currently loaded selected set in NASIS or from
the entire local database (default: |
impute |
replace missing (i.e. |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
The component soil moisture tables within NASIS house monthly data on
flooding, ponding, and soil moisture status. The soil moisture status is
used to specify the water table depth for components (e.g. status ==
"Moist"
).
A data.frame.
S.M. Roecker
fetchNASIS, get_cosoilmoist_from_NASISWebReport,
get_cosoilmoist_from_SDA, get_comonth_from_SDA
if(local_NASIS_defined()) { # load cosoilmoist (e.g. water table data) test <- try(get_cosoilmoist_from_NASIS()) # inspect if(!inherits(test, 'try-error')) { head(test) } }
if(local_NASIS_defined()) { # load cosoilmoist (e.g. water table data) test <- try(get_cosoilmoist_from_NASIS()) # inspect if(!inherits(test, 'try-error')) { head(test) } }
Gets the Site Ecological Site History data from local NASIS database. Used by get_extended_data_from_NASIS_db()
.
get_ecosite_history_from_NASIS_db( best = TRUE, SS = TRUE, es_classifier = NULL, dsn = NULL )
get_ecosite_history_from_NASIS_db( best = TRUE, SS = TRUE, es_classifier = NULL, dsn = NULL )
best |
Should the "best" ecological site correlation be chosen? Creates field called |
SS |
Use selected set? Default: |
es_classifier |
Optional: character. Vector of classifier names (and corresponding records) to retain in final result. |
dsn |
Path to SQLite data source, or a |
a data.frame
, or NULL
on error
get_extended_data_from_NASIS_db()
Data are accessed via Ecological Dynamics Interpretive Tool (EDIT) web services: https://edit.jornada.nmsu.edu/resources/esd. geoUnit
refers to MLRA codes, possibly with a leading zero and trailing "X" for two digit MLRA symbols.
get_EDIT_ecoclass_by_geoUnit(geoUnit, catalog = c("esd", "esg"))
get_EDIT_ecoclass_by_geoUnit(geoUnit, catalog = c("esd", "esg"))
geoUnit |
A character vector of |
catalog |
Catalog ID. One of: |
A data.frame
containing: geoUnit
, id
, legacyId
, name
. NULL
if no result.
## Not run: get_EDIT_ecoclass_by_geoUnit(c("018X","022A")) ## End(Not run)
## Not run: get_EDIT_ecoclass_by_geoUnit(c("018X","022A")) ## End(Not run)
Get accessory tables and summaries from a local NASIS Database
get_extended_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL )
get_extended_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL )
SS |
get data from the currently loaded Selected Set in NASIS or from
the entire local database (default: |
nullFragsAreZero |
should fragment volumes of NULL be interpreted as 0? (default: TRUE), see details |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A list with the results.
Jay M. Skovlin and Dylan E. Beaudette
get_hz_data_from_NASIS_db
,
get_site_data_from_NASIS_db
if(local_NASIS_defined()) { # query extended data e <- try(get_extended_data_from_NASIS_db()) # show contents of extended data str(e) }
if(local_NASIS_defined()) { # query extended data e <- try(get_extended_data_from_NASIS_db()) # show contents of extended data str(e) }
Get accessory tables and summaries from a local pedonPC Database.
get_extended_data_from_pedon_db(dsn)
get_extended_data_from_pedon_db(dsn)
dsn |
The path to a 'pedon.mdb' database. |
A list with the results.
Jay M. Skovlin and Dylan E. Beaudette
get_hz_data_from_pedon_db
,
get_site_data_from_pedon_db
Get horizon-level data from a local NASIS database.
get_hz_data_from_NASIS_db( SS = TRUE, fill = FALSE, stringsAsFactors = NULL, dsn = NULL )
get_hz_data_from_NASIS_db( SS = TRUE, fill = FALSE, stringsAsFactors = NULL, dsn = NULL )
SS |
fetch data from Selected Set in NASIS or from the entire local database (default: |
fill |
include pedons without horizon data in result? default: |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A data.frame.
NULL
total rock fragment values are assumed to represent an absence of rock fragments, and set to 0.
Jay M. Skovlin and Dylan E. Beaudette
get_hz_data_from_NASIS_db
, get_site_data_from_NASIS_db
Get horizon-level data from a PedonPC database.
get_hz_data_from_pedon_db(dsn)
get_hz_data_from_pedon_db(dsn)
dsn |
The path to a 'pedon.mdb' database. |
A data.frame.
NULL total rock fragment values are assumed to represent an absence of rock fragments, and set to 0.
Dylan E. Beaudette and Jay M. Skovlin
get_colors_from_pedon_db
,
get_site_data_from_pedon_db
Get lab pedon layer-level (horizon-level) data from a local NASIS database.
get_lablayer_data_from_NASIS_db(SS = TRUE, dsn = NULL)
get_lablayer_data_from_NASIS_db(SS = TRUE, dsn = NULL)
SS |
fetch data from the currently loaded selected set in NASIS or from
the entire local database (default: |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A data.frame.
This function queries KSSL laboratory site/horizon data from a local NASIS database from the lab layer data table.
Jay M. Skovlin and Dylan E. Beaudette
get_labpedon_data_from_NASIS_db
Get lab pedon-level data from a local NASIS database.
get_labpedon_data_from_NASIS_db(SS = TRUE, dsn = NULL)
get_labpedon_data_from_NASIS_db(SS = TRUE, dsn = NULL)
SS |
fetch data from the currently loaded selected set in NASIS or from the entire local database (default: TRUE) |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
This function currently works only on Windows, and requires a 'nasis_local' ODBC connection.
A data.frame.
This function queries KSSL laboratory site/horizon data from a local NASIS database from the lab pedon data table.
Jay M. Skovlin and Dylan E. Beaudette
get_lablayer_data_from_NASIS_db
Get Legend, Mapunit and Legend Mapunit Area Overlap Tables
get_mapunit_from_NASIS( SS = TRUE, repdmu = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_legend_from_NASIS( SS = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_lmuaoverlap_from_NASIS( SS = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_projectmapunit_from_NASIS(SS = TRUE, stringsAsFactors = NULL, dsn = NULL)
get_mapunit_from_NASIS( SS = TRUE, repdmu = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_legend_from_NASIS( SS = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_lmuaoverlap_from_NASIS( SS = TRUE, droplevels = TRUE, stringsAsFactors = NULL, areatypename = c("Non-MLRA Soil Survey Area", "MLRA Soil Survey Area"), dsn = NULL ) get_projectmapunit_from_NASIS(SS = TRUE, stringsAsFactors = NULL, dsn = NULL)
SS |
Fetch data from the currently loaded selected set in NASIS or from the entire local database (default: |
repdmu |
Return only "representative" data mapunits? Default: |
droplevels |
Drop unused levels from |
stringsAsFactors |
deprecated |
areatypename |
Used for |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
Retrieve a table containing domain and column names with choice list labels/names/sequences/values from the NASIS 7 metadata tables.
get_NASIS_metadata(dsn = NULL, include_description = FALSE) get_NASIS_column_metadata( x, what = "ColumnPhysicalName", include_description = FALSE, dsn = NULL )
get_NASIS_metadata(dsn = NULL, include_description = FALSE) get_NASIS_column_metadata( x, what = "ColumnPhysicalName", include_description = FALSE, dsn = NULL )
dsn |
Optional: path or DBIConnection to local database containing NASIS table structure; default: |
include_description |
Include "ChoiceDescription" column? Default: |
x |
character vector to match in NASIS metadata |
what |
Column to match |
These data are derived from the MetadataDomainDetail, MetadataDomainMaster, and MetadataTableColumn tables and help with mapping between values stored in the NASIS database and human-readable values. The human-readable values align with the values returned in public facing interfaces such as SSURGO via Soil Data Access and NASIS Web Reports. The data in these tables can also be used to create ordered factors where options for levels of a particular data element follow a logical ChoiceSequence
.
If a local NASIS instance is set up, and this is the first time get_NASIS_metadata()
has been called, the metadata will be obtained from the NASIS local database. Subsequent runs in the same session will use a copy of the data object NASIS.metadata
cached in soilDB.env
which can be accessed with get_soilDB_env()$NASIS.metadata
.
For users without a local NASIS instance, a cached copy of the NASIS metadata are used (data/metadata.rda)
.
See ?soilDB::metadata
for additional details.
a data.frame
containing DomainID, DomainName, DomainRanked, DisplayLabel, ChoiceSequence, ChoiceValue, ChoiceName, ChoiceLabel, ChoiceObsolete, ColumnPhysicalName, ColumnLogicalName and optionally ChoiceDescription when include_description=TRUE
.
a data.frame
containing selected NASIS metadata sorted first on DomainID
and then on ChoiceSequence
get_NASIS_metadata() get_NASIS_column_metadata("texcl")
get_NASIS_metadata() get_NASIS_column_metadata("texcl")
Get a NASIS table key by type and table name
get_NASIS_table_key_by_name( tables, keycol = c("all", "fkey", "pkeyref", "pkey") )
get_NASIS_table_key_by_name( tables, keycol = c("all", "fkey", "pkeyref", "pkey") )
tables |
character vector of table names |
keycol |
One of: "fkey" the foreign key; "pkeyref" the primary key referenced by the foreign key, or "pkey" the primary key. |
The key column name for the specified table name
## Not run: get_NASIS_table_key_by_name(c("site","phorizon_View_1","not_a_table")) ## End(Not run)#'
## Not run: get_NASIS_table_key_by_name(c("site","phorizon_View_1","not_a_table")) ## End(Not run)#'
Retrieve a table containing table and column names with descriptions, help text, units of measure, etc. from NASIS 7 metadata tables.
get_NASIS_table_metadata( table = NULL, column = NULL, what.table = "TablePhysicalName", what.column = "ColumnPhysicalName", query_string = FALSE, dsn = NULL )
get_NASIS_table_metadata( table = NULL, column = NULL, what.table = "TablePhysicalName", what.column = "ColumnPhysicalName", query_string = FALSE, dsn = NULL )
table |
Character vector of table identifiers to match. Default |
column |
Character vector of column identifiers to match. Default |
what.table |
Column to match |
what.column |
Column to match |
query_string |
Default: |
dsn |
Optional: path or DBIConnection to local database containing NASIS table structure; default: |
These data are derived from the MetadataTable and MetadataTableColumn tables and describe the expected contents of standard NASIS tables and columns.
For NASIS choice lists based on domain and column names see get_NASIS_metadata()
and NASISChoiceList()
. This function (get_NASIS_table_metadata()
) is intended for higher-level description of the expected contents of a NASIS database instance, rather than the codes/specific values used within columns.
a data.frame
get_NASIS_metadata()
NASISChoiceList()
uncode()
code()
if (local_NASIS_defined()) str(get_NASIS_table_metadata())
if (local_NASIS_defined()) str(get_NASIS_table_metadata())
Method generalizing concepts of NASIS 7 data model to group tables by "purpose." Most of our more complex queries rely on tables from one or more purposes, so individual higher-level functions might call a function like this to identify the relevant tables from a data source.
get_NASIS_table_name_by_purpose( purpose = c("metadata", "lookup", "nasis", "site", "pedon", "transect", "component", "vegetation", "project", "techsoilservice", "area", "soilseries", "legend", "mapunit", "datamapunit"), SS = FALSE )
get_NASIS_table_name_by_purpose( purpose = c("metadata", "lookup", "nasis", "site", "pedon", "transect", "component", "vegetation", "project", "techsoilservice", "area", "soilseries", "legend", "mapunit", "datamapunit"), SS = FALSE )
purpose |
character. One or more of: "metadata", "lookup", "nasis", "site", "pedon", "transect", "component", "vegetation", "project", "techsoilservice", "area", "soilseries", "legend", "mapunit", "datamapunit" |
SS |
append "_View_1" on appropriate tables? Default: FALSE |
character vector of table names
createStaticNASIS
## Not run: # get the "site" table names get_NASIS_table_name_by_purpose("site") # get the pedon table names get_NASIS_table_name_by_purpose("pedon", SS = TRUE) # metadata and lookup not affected by SS argument, but site and pedon are get_NASIS_table_name_by_purpose(c("metadata", "lookup", "site", "pedon"), SS = TRUE) ## End(Not run)
## Not run: # get the "site" table names get_NASIS_table_name_by_purpose("site") # get the pedon table names get_NASIS_table_name_by_purpose("pedon", SS = TRUE) # metadata and lookup not affected by SS argument, but site and pedon are get_NASIS_table_name_by_purpose(c("metadata", "lookup", "site", "pedon"), SS = TRUE) ## End(Not run)
Obtain daily climatic summary data for a set of station IDs, years, and datatypes.
Note that typically results from the NOAA API are limited to 1000 records. However, by "chunking" up data into individual stationyeardatatypeid combinations, record results generally do not exceed 365 records for daily summaries.
In order to use this function, you must obtain an API token from this website: https://www.ncdc.noaa.gov/cdo-web/token
get_NOAA_GHCND(stations, years, datatypeids, apitoken)
get_NOAA_GHCND(stations, years, datatypeids, apitoken)
stations |
Station ID (e.g. |
years |
One or more years (e.g. 2017:2020) |
datatypeids |
One or more NOAA GHCND data type IDs (e.g |
apitoken |
API key token for NOAA NCDC web services (https://www.ncdc.noaa.gov/cdo-web/token) |
A data.frame containing the GHCND data requested (limit 1000 records)
#' ## in order to use this function, you must obtain an API token from this website: ## https://www.ncdc.noaa.gov/cdo-web/token # get_NOAA_GHCND(c("GHCND:USC00388786", "GHCND:USC00388787"), # years = 2017:2020, # datatypeids = c("PRCP","SNOW"), # apitoken = "yourtokenhere")
#' ## in order to use this function, you must obtain an API token from this website: ## https://www.ncdc.noaa.gov/cdo-web/token # get_NOAA_GHCND(c("GHCND:USC00388786", "GHCND:USC00388787"), # years = 2017:2020, # datatypeids = c("PRCP","SNOW"), # apitoken = "yourtokenhere")
Query the NOAA API to get station data (limit 1000 records) near a point. Default extent is plus or minus 0.5 degrees (bounding box) (with bbox = 1
) around the specified point [lat, lng].
In order to use this function, you must obtain an API token from this website: https://www.ncdc.noaa.gov/cdo-web/token
get_NOAA_stations_nearXY(lat, lng, apitoken, bbox = 1, crs = "EPSG:4326")
get_NOAA_stations_nearXY(lat, lng, apitoken, bbox = 1, crs = "EPSG:4326")
lat |
Latitude or Y coordinate in |
lng |
Longitude or X coordinate in |
apitoken |
API key token for NOAA NCDC web service |
bbox |
Optional: Dimension of the bounding box centered at |
crs |
Coordinate Reference System. Default |
data.frame containing station information for all stations within a bounding box around lat
, lng
.
## in order to use this function, you must obtain an API token from this website: ## https://www.ncdc.noaa.gov/cdo-web/token # stations <- get_NOAA_stations_nearXY(lat = 37, lng = -120, # apitoken = "yourtokenhere")
## in order to use this function, you must obtain an API token from this website: ## https://www.ncdc.noaa.gov/cdo-web/token # stations <- get_NOAA_stations_nearXY(lat = 37, lng = -120, # apitoken = "yourtokenhere")
Get Official Series Description Data from JSON, HTML or TXT sources
get_OSD( series, base_url = NULL, result = c("json", "html", "txt"), fix_ocr_errors = FALSE, verbose = FALSE ) get_OSD_JSON(series, base_url = NULL)
get_OSD( series, base_url = NULL, result = c("json", "html", "txt"), fix_ocr_errors = FALSE, verbose = FALSE ) get_OSD_JSON(series, base_url = NULL)
series |
A character vector of Official Series names e.g. |
base_url |
Optional: alternate JSON/HTML/TXT repository path. Default: |
result |
Select |
fix_ocr_errors |
Default: |
verbose |
Print errors and warning messages related to HTTP requests? Default: |
The default base_url
for result="json"
is to JSON files stored in a GitHub repository that is regularly updated from the official source of Series Descriptions. Using format: https://raw.githubusercontent.com/ncss-tech/SoilKnowledgeBase/main/inst/extdata/OSD/{LETTER}/{SERIES}.json
for JSON. And "https://soilseriesdesc.sc.egov.usda.gov/OSD_Docs/{LETTER}/{SERIES}.html
is for result="html"
(official source).
fix_ocr_errors
by default is turned off (FALSE
). When TRUE
, assume that in color data hue/value/chroma lowercase "L" ("l"
) is a 1, and a capital "O" is interpreted as zero. Also, in horizon designations assume lowercase "L" is a 1
, and a string that starts with 0
starts with the capital letter "O"
.
For JSON result: A data.frame
with 1 row per series, and 1 column per "section" in the OSD as defined in National Soil Survey Handbook. For TXT or HTML result a list of character vectors containing OSD text with 1 element per series and one value per line.
series <- c("Musick", "Hector", "Chewacla") get_OSD(series)
series <- c("Musick", "Hector", "Chewacla") get_OSD(series)
Prepare a list of data.frame
objects with data from the "phrdxfeatures" and "phredoxfcolor" tables. These tables are related by "phrdxfiid" column, and related to horizon data via "phiid".
get_RMF_from_NASIS_db(SS = TRUE, dsn = NULL)
get_RMF_from_NASIS_db(SS = TRUE, dsn = NULL)
SS |
logical, limit query to the selected set |
dsn |
optional path or DBIConnection to local database containing NASIS table structure; default: |
a list
with two data.frame
objects:
RMF
: contents of "phrdxfeatures" table, often >1 row per horizon
RMF_colors
: contents of "phredoxfcolor", usually >1 row per record in "phrdxfeatures"
Get mapunit ecological sites from Soil Data Access
get_SDA_coecoclass( method = "None", areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, ecoclasstypename = c("NRCS Rangeland Site", "NRCS Forestland Site"), ecoclassref = "Ecological Site Description Database", not_rated_value = "Not assigned", miscellaneous_areas = TRUE, include_minors = TRUE, threshold = 0, dsn = NULL )
get_SDA_coecoclass( method = "None", areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, ecoclasstypename = c("NRCS Rangeland Site", "NRCS Forestland Site"), ecoclassref = "Ecological Site Description Database", not_rated_value = "Not assigned", miscellaneous_areas = TRUE, include_minors = TRUE, threshold = 0, dsn = NULL )
method |
aggregation method. One of: |
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
query_string |
Default: |
ecoclasstypename |
Default: |
ecoclassref |
Default: |
not_rated_value |
Default: |
miscellaneous_areas |
logical. Include miscellaneous areas (non-soil components)? |
include_minors |
logical. Include minor components? Default: |
threshold |
integer. Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
When method="Dominant Condition"
an additional field ecoclasspct_r
is returned in the result
with the sum of comppct_r
that have the dominant condition ecoclassid
. The component with the greatest
comppct_r
is returned for the component
and coecosite
level information.
Note that if there are multiple coecoclasskey
per ecoclassid
there may be more than one record per component.
Get Geomorphic/Surface Morphometry Data from Soil Data Access or a local SSURGO data source and summarize by counts and proportions ("probabilities").
get_SDA_cosurfmorph( table = c("cosurfmorphgc", "cosurfmorphhpp", "cosurfmorphss", "cosurfmorphmr"), by = "compname", areasymbols = NULL, mukeys = NULL, WHERE = NULL, miscellaneous_areas = FALSE, db = c("SSURGO", "STATSGO"), dsn = NULL, query_string = FALSE )
get_SDA_cosurfmorph( table = c("cosurfmorphgc", "cosurfmorphhpp", "cosurfmorphss", "cosurfmorphmr"), by = "compname", areasymbols = NULL, mukeys = NULL, WHERE = NULL, miscellaneous_areas = FALSE, db = c("SSURGO", "STATSGO"), dsn = NULL, query_string = FALSE )
table |
Target table to summarize. Default: |
by |
Grouping variable. Default: |
areasymbols |
A vector of soil survey area symbols (e.g. |
mukeys |
A vector of map unit keys (e.g. |
WHERE |
WHERE clause added to SQL query. For example: |
miscellaneous_areas |
Include miscellaneous areas (non-soil components) in results? Default: |
db |
Either |
dsn |
Path to local SSURGO database SQLite database. Default |
query_string |
Return query instead of sending to Soil Data Access / local database. Default: |
Default table="cosurfmorphgc"
summarizes columns geomposmntn
, geomposhill
, geomposflats
, and geompostrce
.
table="cosurfmorphhpp"
summarizes "hillslopeprof"
, table="cosurfmorphss"
summarizes shapeacross
and shapedown
, and table="cosurfmorphmr"
summarizes geomicrorelief
.
Queries are a generalization of now-deprecated functions from sharpshootR package by Dylan Beaudette: geomPosMountainProbability()
, geomPosHillProbability()
, surfaceShapeProbability()
, hillslopeProbability()
Similar summaries of SSURGO component surface morphometry data by series name can be found in fetchOSD(, extended=TRUE)
or downloaded from https://github.com/ncss-tech/SoilWeb-data
Full component data including surface morphometry summaries at the "site" level can be obtained with fetchSDA()
.
a data.frame
containing the grouping variable (by
) and tabular summaries of counts and proportions of geomorphic records.
Dylan E. Beaudette, Andrew G. Brown
fetchSDA()
get_SDA_pmgroupname()
## Not run: # Summarize by 3D geomorphic components by component name (default `by='compname'`) get_SDA_cosurfmorph(WHERE = "areasymbol = 'CA630'") # Whole Soil Survey Area summary (using `by = 'areasymbol'`) get_SDA_cosurfmorph(by = 'areasymbol', WHERE = "areasymbol = 'CA630'") # 2D Hillslope Position summary(using `table = 'cosurfmorphhpp'`) get_SDA_cosurfmorph('cosurfmorphhpp', WHERE = "areasymbol = 'CA630'") # Surface Shape summary (using `table = 'cosurfmorphss'`) get_SDA_cosurfmorph('cosurfmorphss', WHERE = "areasymbol = 'CA630'") # Microrelief summary (using `table = 'cosurfmorphmr'`) get_SDA_cosurfmorph('cosurfmorphmr', WHERE = "areasymbol = 'CA630'") ## End(Not run)
## Not run: # Summarize by 3D geomorphic components by component name (default `by='compname'`) get_SDA_cosurfmorph(WHERE = "areasymbol = 'CA630'") # Whole Soil Survey Area summary (using `by = 'areasymbol'`) get_SDA_cosurfmorph(by = 'areasymbol', WHERE = "areasymbol = 'CA630'") # 2D Hillslope Position summary(using `table = 'cosurfmorphhpp'`) get_SDA_cosurfmorph('cosurfmorphhpp', WHERE = "areasymbol = 'CA630'") # Surface Shape summary (using `table = 'cosurfmorphss'`) get_SDA_cosurfmorph('cosurfmorphss', WHERE = "areasymbol = 'CA630'") # Microrelief summary (using `table = 'cosurfmorphmr'`) get_SDA_cosurfmorph('cosurfmorphmr', WHERE = "areasymbol = 'CA630'") ## End(Not run)
Assess the hydric soils composition of a map unit.
get_SDA_hydric( areasymbols = NULL, mukeys = NULL, WHERE = NULL, method = "MAPUNIT", query_string = FALSE, dsn = NULL )
get_SDA_hydric( areasymbols = NULL, mukeys = NULL, WHERE = NULL, method = "MAPUNIT", query_string = FALSE, dsn = NULL )
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
method |
One of: |
query_string |
Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
The default classes for method="MAPUNIT"
are as follows:
'Nonhydric'
- no hydric components
'Hydric'
- all hydric components
'Predominantly Hydric'
- hydric component percentage is 50% or more
'Partially Hydric'
- one or more of the major components is hydric
'Predominantly Nonhydric'
- hydric component percentage is less than 50%
The default result will also include the following summaries of component percentages: total_comppct
, hydric_majors
and hydric_inclusions
.
Default method
"Mapunit"
produces aggregate summaries of all components in the mapunit. Use "Dominant Component"
and "Dominant Condition"
to get the dominant component (highest percentage) or dominant hydric condition (similar conditions aggregated across components), respectively. Use "None"
for no aggregation (one record per component).
a data.frame
Jason Nemecek, Chad Ferguson, Andrew Brown
Get map unit interpretations from Soil Data Access by rule name
get_SDA_interpretation( rulename, method = c("Dominant Component", "Dominant Condition", "Weighted Average", "None"), areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, not_rated_value = NA_real_, wide_reason = FALSE, dsn = NULL )
get_SDA_interpretation( rulename, method = c("Dominant Component", "Dominant Condition", "Weighted Average", "None"), areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, not_rated_value = NA_real_, wide_reason = FALSE, dsn = NULL )
rulename |
character vector of interpretation rule names (matching |
method |
aggregation method. One of: "Dominant Component", "Dominant Condition", "Weighted Average", "None". If "None" is selected one row will be returned per component, otherwise one row will be returned per map unit. |
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
query_string |
Default: |
not_rated_value |
used where rating class is "Not Rated". Default: |
wide_reason |
Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
cointerp
tableAGR - Avocado Root Rot Hazard (CA)
AGR - California Revised Storie Index (CA)
AGR - Hops Site Suitability (WA)
AGR - Map Unit Cropland Productivity (MN)
AGR - Nitrate Leaching Potential, Nonirrigated (WA)
AGR - No Till (TX)
AGR - Pesticide Loss Potential-Soil Surface Runoff (NE)
AGR - Ridge Till (TX)
AGR - Selenium Leaching Potential (CO)
AGR - Water Erosion Potential (NE)
AGR - Wind Erosion Potential (TX)
AGR - Winter Wheat Yield (MT)
AGR-Pesticide and Nutrient Runoff Potential (ND)
AGR-Rooting Depth (ND)
American Wine Grape Varieties Site Desirability (Long)
American Wine Grape Varieties Site Desirability (Medium)
American Wine Grape Varieties Site Desirability (Very Long)
AWM - Animal Mortality Disposal (Catastrophic) (MO)
AWM - Irrigation Disposal of Wastewater (OH)
AWM - Irrigation Disposal of Wastewater (VT)s
AWM - Land Application of Municipal Biosolids, summer (OR)
AWM - Manure and Food Processing Waste (MD)
AWM - Manure and Food Processing Waste (OH)
AWM - Overland Flow Process Treatment of Wastewater (VT)
AWM - Rapid Infil Disposal of Wastewater (DE)
AWM - Sensitive Soil Features (MN)
AWM - Sensitive Soil Features (WI)
BLM - Fencing
BLM - Fire Damage Susceptibility
BLM - Mechanical Treatment, Rolling Drum
BLM - Rangeland Drill
BLM - Rangeland Seeding, Colorado Plateau Ecoregion
BLM - Rangeland Seeding, Great Basin Ecoregion
BLM-Reclamation Suitability (MT)
CLASS RULE - Depth to lithic bedrock (5 classes) (NPS)
CLASS RULE - Soil Inorganic Carbon kg/m2 to 2m (NPS)
CLASS RULE - Soil Organic Carbon kg/m2 to 2m (NPS)
CLR-pastureland limitation (IN)
Commodity Crop Productivity Index (Soybeans) (TN)
CPI - Alfalfa Hay, NIRR - Palouse, Northern Rocky Mtns. (WA)
CPI - Barley, IRR - Eastern Idaho Plateaus (ID)
CPI - Grass Hay, IRR - Klamath Valleys and Basins (OR)
CPI - Small Grains, IRR - Snake River Plains (ID)
CPI - Wheat, IRR - Eastern Idaho Plateaus (ID)
CZSS - Salinization due to Coastal Saltwater Inundation (CT)
DHS - Catastrophic Event, Large Animal Mortality, Burial
DHS - Catastrophic Mortality, Large Animal Disposal, Pit
DHS - Catastrophic Mortality, Large Animal Disposal, Trench
DHS - Potential for Radioactive Bioaccumulation
DHS - Potential for Radioactive Sequestration
DHS - Suitability for Composting Medium and Final Cover
ENG - Construction Materials; Gravel Source
ENG - Construction Materials; Gravel Source (AK)
ENG - Construction Materials; Gravel Source (ID)
ENG - Construction Materials; Gravel Source (OH)
ENG - Construction Materials; Gravel Source (VT)
ENG - Construction Materials; Gravel Source (WA)
ENG - Construction Materials; Roadfill (OH)
ENG - Construction Materials; Sand Source (OR)
ENG - Construction Materials; Sand Source (WA)
ENG - Construction Materials; Topsoil (GA)
ENG - Construction Materials; Topsoil (MD)
ENG - Daily Cover for Landfill
ENG - Daily Cover for Landfill (AK)
ENG - Disposal Field Suitability Class (NJ)
ENG - Dwellings W/O Basements (OH)
ENG - Dwellings with Basements (AK)
ENG - Large Animal Disposal, Pit (CT)
ENG - Lawn, landscape, golf fairway (CT)
ENG - Lined Retention Systems
ENG - Local Roads and Streets (OH)
ENG - On-Site Waste Water Absorption Fields (MO)
ENG - Septic Tank Absorption Fields
ENG - Septic Tank Absorption Fields (MD)
ENG - Septic Tank Absorption Fields (TX)
ENG - Septic Tank, Gravity Disposal (TX)
ENG - Sewage Lagoons
ENG - Small Commercial Buildings (OH)
ENG - Soil Potential Ratings of SSDS (CT)
FOR (USFS) - Road Construction/Maintenance (Natural Surface)
FOR - Compaction Potential (WA)
FOR - Conservation Tree/Shrub Groups (MT)
FOR - Damage by Fire (OH)
FOR - General Harvest Season (VT)
FOR - Hand Planting Suitability
FOR - Hand Planting Suitability, MO13 (DE)
FOR - Hand Planting Suitability, MO13 (MD)
FOR - Log Landing Suitability
FOR - Log Landing Suitability (ME)
FOR - Log Landing Suitability (VT)
FOR - Log Landing Suitability (WA)
FOR - Mechanical Planting Suitability (CT)
FOR - Mechanical Planting Suitability, MO13 (MD)
FOR - Mechanical Site Preparation (Deep)
FOR - Mechanical Site Preparation (Deep) (DE)
FOR - Mechanical Site Preparation (Surface) (DE)
FOR - Mechanical Site Preparation (Surface) (MI)
FOR - Mechanical Site Preparation; Surface (ME)
FOR - Potential Erosion Hazard, Road/Trail, Spring Thaw (AK)
FOR - Potential Seedling Mortality (PIA)
FOR - Potential Seedling Mortality(ME)
FOR - Puddling Hazard
FOR - Road Suitability (Natural Surface) (ME)
FOR - Road Suitability (Natural Surface) (WA)
FOR - Soil Rutting Hazard (OH)
FOR - Soil Sustainability Forest Biomass Harvesting (CT)
FOR - White Oak Suitability (MO)
FOR-Biomass Harvest (WI)
FOTG - Indiana Corn Yield Calculation (IN)
GRL - Excavations to 24 inches for Plastic Pipelines (TX)
GRL - Fencing, 24 inch Post Depth (MT)
GRL - NV range seeding (Wind C = 100) (NV)
GRL - NV range seeding (Wind C = 40) (NV)
GRL - NV range seeding (Wind C = 60) (NV)
GRL - NV range seeding (Wind C = 80) (NV)
GRL - NV range seeding (Wind C >= 160) (NV)
GRL - Rangeland Planting by Mechanical Seeding (TX)
GRL - Rangeland Root Plowing (TX)
Hybrid Wine Grape Varieties Site Desirability (Long)
Low Pressure Pipe Septic System (DE)
MIL - Bivouac Areas (DOD)
MIL - Excavations Crew-Served Weapon Fighting Position (DOD)
MIL - Excavations for Individual Fighting Position (DOD)
MIL - Trafficability Veh. Type 1 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 2 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 4 1-pass wet season (DOD)
MIL - Trafficability Veh. Type 4 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 6 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 7 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 7 dry season (DOD)
NCCPI - Irrigated National Commodity Crop Productivity Index
Nitrogen Loss Potential (ND)
Potential Windthrow Hazard (TN)
REC - Foot and ATV Trails (AK)
REC - Playgrounds (AK)
Reclamation Suitability (ND)
RSK-risk assessment for manure application (OH)
SAS - CMECS Substrate Origin
SAS - CMECS Substrate Subclass/Group/Subgroup
SAS - Mooring Anchor - Deadweight
Septic System A/B Soil System (Alternate) (PA)
Septic System CO-OP RFS III w/Spray Irrigation (PA)
Septic System Dual Field Trench (conventional) (WV)
Septic System Elevated Field (alternative) (WV)
Septic System In Ground Trench (conventional) (PA)
Septic System In Ground Trench (conventional) (WV)
AGR - Filter Strips (TX)
AGR - Hops Site Suitability (ID)
AGR - Mulch Till (TX)
AGR - Nitrate Leaching Potential, Nonirrigated (MT)
AGR - Nitrate Leaching Potential, Nonirrigated (WV)
AGR - No Till (VT)
AGR - Oats Yield (MT)
AGR - Pesticide Loss Potential-Leaching
AGR - Pesticide Loss Potential-Leaching (NE)
AGR - Rutting Hazard =< 10,000 Pounds per Wheel (TX)
AGR - S. Highbush Blueberry Suitability MLRA 153 (SC)
AGR - Wind Erosion Potential (NE)
AGR-Available Water Capacity (ND)
AGR-Physical Limitations (ND)
AGR-Sodicity (ND)
AGR-Surface Crusting (ND)
AGR-Wind Erosion (ND)
AWM - Irrigation Disposal of Wastewater (DE)
AWM - Land App of Municipal Sewage Sludge (DE)
AWM - Land App of Municipal Sewage Sludge (MD)
AWM - Land Application of Milk (CT)
AWM - Land Application of Municipal Biosolids, spring (OR)
AWM - Land Application of Municipal Sewage Sludge
AWM - Land Application of Municipal Sewage Sludge (OH)
AWM - Land Application of Municipal Sewage Sludge (VT)
AWM - Large Animal Disposal, Pit (MN)
AWM - Manure and Food Processing Waste
AWM - Manure and Food Processing Waste (VT)
AWM - Rapid Infil Disposal of Wastewater (MD)
AWM - Rapid Infiltration Disposal of Wastewater (VT)
AWM - Slow Rate Process Treatment of Wastewater (VT)
BLM - Chaining Suitability
BLM - Fugitive Dust Resistance
BLM - Soil Restoration Potential
BLM - Yellow Star-thistle Invasion Susceptibility
CLASS RULE - Depth to non-lithic bedrock (5 classes) (NPS)
CLR-cropland limitation for corn and soybeans (IN)
Commodity Crop Productivity Index (Corn) (WI)
CPI - Grass Hay, NIRR - Klamath Valleys and Basins (OR)
CPI - Potatoes Productivity Index (AK)
CPI - Potatoes, IRR - Eastern Idaho Plateaus (ID)
CPI - Small Grains, NIRR - Palouse Prairies (ID)
DHS - Emergency Animal Mortality Disposal by Shallow Burial
DHS - Rubble and Debris Disposal, Large-Scale Event
ENG - Aquifer Assessment - 7081 (MN)
ENG - Construction Materials - Gravel Source (MN)
ENG - Construction Materials; Gravel Source (MI)
ENG - Construction Materials; Gravel Source (OR)
ENG - Construction Materials; Reclamation
ENG - Construction Materials; Reclamation (OH)
ENG - Construction Materials; Sand Source
ENG - Construction Materials; Sand Source (AK)
ENG - Construction Materials; Sand Source (ID)
ENG - Construction Materials; Sand Source (IN)
ENG - Construction Materials; Sand Source (OH)
ENG - Construction Materials; Topsoil
ENG - Construction Materials; Topsoil (WA)
ENG - Ground-based Solar Arrays, Soil-based Anchor Systems
ENG - Local Roads and Streets
ENG - New Ohio Septic Rating (OH)
ENG - Sanitary Landfill (Trench) (OH)
ENG - Septic Tank Absorption Fields (AK)
ENG - Septic Tank Absorption Fields (DE)
ENG - Septic Tank Absorption Fields (NY)
ENG - Sewage Lagoons (OH)
ENG - Shallow Excavations (AK)
ENG - Shallow Excavations (MI)
ENG - Unpaved Local Roads and Streets
FOR - Black Walnut Suitability Index (MO)
FOR - Conservation Tree and Shrub Groups (TX)
FOR - Construction Limitations - Haul Roads/Log Landing (OH)
FOR - Construction Limitations For Haul Roads (MI)
FOR - Hand Planting Suitability (ME)
FOR - Harvest Equipment Operability (MD)
FOR - Harvest Equipment Operability (OH)
FOR - Harvest Equipment Operability (VT)
FOR - Mechanical Planting Suitability
FOR - Mechanical Planting Suitability (ME)
FOR - Mechanical Planting Suitability, MO13 (DE)
FOR - Potential Erosion Hazard (Off-Road/Off-Trail)
FOR - Potential Erosion Hazard (Road/Trail) (PIA)
FOR - Potential Seedling Mortality (VT)
FOR - Potential Windthrow Hazard (NY)
FOR - Potential Windthrow Hazard (VT)
FOR - Puddling Potential (WA)
FOR - Road Suitability (Natural Surface)
FOR - Road Suitability (Natural Surface) (OH)
FOR - Road Suitability (Natural Surface) (OR)
FOR - Rutting Hazard by Season
FOR - Shortleaf pine littleleaf disease susceptibility
FOR - Soil Compactibility Risk
FOR - Soil Rutting Hazard (ME)
FOR - Windthrow Hazard
FOR-Construction Limitations for Haul Roads/Log Landings(ME)
FOTG - Indiana Slippage Potential (IN)
Gravity Full Depth Septic System (DE)
GRL - Fencing, Post Depth =<36 inches
GRL - NV range seeding (Wind C = 50) (NV)
GRL - Ranch Access Roads (TX)
GRL - Rangeland Roller Chopping (TX)
Ground Penetrating Radar Penetration
Ground-based Solar Arrays_bedrock(ME)
Ground-based Solar Arrays_bedrock_slope_ballast(ME)
Hybrid Wine Grape Varieties Site Desirability (Short)
ISDH Septic Tank Interpretation (IN)
Land Application of Municipal Sewage Sludge (PA)
MIL - Helicopter Landing Zones (DOD)
MIL - Trafficability Veh. Type 2 1-pass wet season (DOD)
MIL - Trafficability Veh. Type 5 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 5 dry season (DOD)
MIL - Trafficability Veh. Type 7 1-pass wet season (DOD)
NCCPI - National Commodity Crop Productivity Index (Ver 3.0)
REC - Camp and Picnic Areas (AK)
REC - Picnic Areas (CT)
REC - Playgrounds (CT)
SAS - CMECS Substrate Subclass
Septic System Drip Irrigation (Alternate) (PA)
Septic System Free Access Sand Filter w/Drip Irrigation (PA)
Septic System In Ground Bed (conventional) (PA)
Septic System Peat Based Option1 (UV & At-Grade Bed)Alt (PA)
Septic System Peat Sys Opt3 w/Subsurface Sand Filter (PA)
Septic System Sand Mound Bed or Trench (PA)
Septic System Shallow Placement Pressure Dosed (Alt.) (PA)
SOH - Aggregate Stability (ND)
SOH - Agricultural Organic Soil Subsidence
SOH - Dynamic Soil Properties Response to Biochar
SOH - Organic Matter Depletion
SOIL HEALTH ASSESSMENT (NJ)
URB - Commercial Brick Bldg; w/Reinforced Concrete Slab (TX)
URB - Reinforced Concrete Slab (TX)
URB/REC - Camp Areas
URB/REC - Camp Areas (OH)
URB/REC - Off-Road Motorcycle Trails (OH)
URB/REC - Paths and Trails (OH)
URB/REC - Picnic Areas
URB/REC - Playgrounds
URB/REC - Playgrounds (GA)
Vinifera Wine Grape Site Desirability (Short to Medium)
WLF - Irr. Domestic Grasses & Legumes for Food & Cover (TX)
WLF - Upland Coniferous Trees (TX)
WLF - Upland Deciduous Trees (TX)
WLF - Upland Desertic Shrubs & Trees (TX)
WLF - Upland Native Herbaceous Plants (TX)
WLF - Upland Shrubs & Vines (TX)
WLF-Soil Suitability - Karner Blue Butterfly (WI)
WMS - Drainage (IL)
WMS - Drainage - (MI)
WMS - Embankments, Dikes, and Levees
WMS - Embankments, Dikes, and Levees (OH)
WMS - Grassed Waterways - (MI)
AGR - Air Quality; PM10 (TX)
AGR - Air Quality; PM2_5 (TX)
AGR - Aronia Berry Suitability (SD)
AGR - Farmland of Statewide Importance (TX)
AGR - Index for alfalfa hay, irrigated (NV)
AGR - Nitrate Leaching Potential, Nonirrigated (MA)
AGR - Rangeland Grass/Herbaceous Productivity Index (TX)
AGR - Rutting Hazard > 10,000 Pounds per Wheel (TX)
AGR - Water Erosion Potential (TX)
AGR - Wine Grape Site Suitability (WA)
AGR-Natural Fertility (ND)
AGR-Subsurface Salinity (ND)
AWM - Filter Group (OH)
AWM - Irrigation Disposal of Wastewater
AWM - Land Application of Dry and Slurry Manure (TX)
AWM - Land Application of Municipal Biosolids, winter (OR)
AWM - Overland Flow Process Treatment of Wastewater
AWM - Rapid Infiltration Disposal of Wastewater
AWM - Vegetated Treatment Area (PIA)
AWM - Waste Field Storage Area (VT)
BLM - Mechanical Treatment, Shredder
BLM - Medusahead Invasion Susceptibility
BLM - Soil Compaction Resistance
Capping Fill Gravity Septic System (DE)
CLASS RULE - Depth to any bedrock kind (5 classes) (NPS)
CPI - Alfalfa Hay, IRR - Eastern Idaho Plateaus (ID)
CPI - Alfalfa Hay, IRR - Klamath Valley and Basins (OR)
CPI - Alfalfa Hay, IRR - Snake River Plains (ID)
CPI - Alfalfa Hay, NIRR- Eastern Idaho Plateaus (ID)
CPI - Grass Hay, NIRR - Palouse, Northern Rocky Mtns. (WA)
CPI - Small Grains Productivity Index (AK)
DHS - Catastrophic Event, Large Animal Mortality, Incinerate
DHS - Emergency Land Disposal of Milk
DHS - Site for Composting Facility - Subsurface
DHS - Suitability for Clay Liner Material
ENG - Cohesive Soil Liner (MN)
ENG - Construction Materials - Sand Source (MN)
ENG - Construction Materials; Gravel Source (CT)
ENG - Construction Materials; Gravel Source (NY)
ENG - Construction Materials; Reclamation (DE)
ENG - Construction Materials; Roadfill
ENG - Construction Materials; Roadfill (AK)
ENG - Construction Materials; Sand Source (NY)
ENG - Construction Materials; Sand Source (VT)
ENG - Construction Materials; Topsoil (AK)
ENG - Construction Materials; Topsoil (DE)
ENG - Construction Materials; Topsoil (MI)
ENG - Construction Materials; Topsoil (OR)
ENG - Conventional On-Site Septic Systems (TN)
ENG - Deep Infiltration Systems
ENG - Disposal Field Gravity (DE)
ENG - Dwellings With Basements (OH)
ENG - Ground-based Solar Arrays, Ballast Anchor Systems
ENG - Large Animal Disposal, Trench (CT)
ENG - Lawn, Landscape, Golf Fairway (MI)
ENG - Lawn, Landscape, Golf Fairway (VT)
ENG - Sanitary Landfill (Area) (OH)
ENG - Sanitary Landfill (Trench)
ENG - Sanitary Landfill (Trench) (AK)
ENG - Septage Application - Surface (MN)
ENG - Septic Tank Absorption Fields - At-Grade (MN)
ENG - Septic Tank Absorption Fields - Mound (MN)
ENG - Septic Tank Leaching Chamber (TX)
ENG - Septic Tank, Subsurface Drip Irrigation (TX)
ENG - Shallow Excavations
ENG - Shallow Infiltration Systems
ENG - Small Commercial Buildings
ENG - Soil Potential of Road Salt Applications (CT)
ENG - Source of Caliche (TX)
ENG - Stormwater Management / Ponds (NY)
ENG - Unlined Retention Systems
Farm and Garden Composting Facility - Surface
FOR - Biomass Harvest (MA)
FOR - Black Walnut Suitability Index (KS)
FOR - Displacement Potential (WA)
FOR - Drought Vulnerable Soils
FOR - General Harvest Season (ME)
FOR - Harvest Equipment Operability
FOR - Mechanical Site Preparation (Deep) (MD)
FOR - Mechanical Site Preparation (Surface)
FOR - Mechanical Site Preparation; Deep (CT)
FOR - Potential Erosion Hazard (Road/Trail)
FOR - Potential Fire Damage Hazard
FOR - Potential Seedling Mortality
FOR - Potential Seedling Mortality (MI)
FOR - Potential Windthrow Hazard (ME)
FOR - Potential Windthrow Hazard (MI)
FOR - Road Suitability (Natural Surface) (ID)
FOR - Rutting Hazard by Month
FOR - Windthrow Hazard (WA)
FOTG - NLI Interp Calculation - (IN)
Fragile Soil Index
GRL - Juniper Encroachment Potential (NM)
GRL - NV range seeding (Wind C = 20) (NV)
GRL - Pasture and Hayland SG (OH)
GRL - Rangeland Prescribed Burning (TX)
GRL - Rangeland Soil Seed Bank Suitability (NM)
GRL-FSG-NP-W (MT)
GRL-SHSI Soil Health Sustainability Index (MT)
Ground-based Solar Arrays_saturationt(ME)
Ground-based Solar Arrays_slope(ME)
Inland Wetlands (CT)
IRR-restrictive features for irrigation (OH)
MIL - Excavations for Vehicle Fighting Position (DOD)
MIL - Trafficability Veh. Type 1 1-pass wet season (DOD)
MIL - Trafficability Veh. Type 2 dry season (DOD)
MIL - Trafficability Veh. Type 3 50-passes wet season (DOD)
MIL - Trafficability Veh. Type 6 1-pass wet season (DOD)
MIL - Trafficability Veh. Type 6 dry season (DOD)
Muscadine Wine Grape Site Desirability (Very Long)
NCCPI - NCCPI Cotton Submodel (II)
Permafrost Sensitivity (AK)
Pressure Dose Capping Fill Septic System (DE)
REC - Camp Areas (CT)
REC - Off-Road Motorcycle Trails (CT)
SAS - CMECS Substrate Class
SAS - CMECS Substrate Subclass/Group
SAS - Eelgrass Restoration Suitability
SAS - Land Utilization of Dredged Materials
SAS - Northern Quahog (Hard Clam) Habitat Suitability
Septic System At Grade Shallow Field (alternative) (WV)
Septic System At-Grade Bed (Alternate) (PA)
Septic System CO-OP RFS III w/Drip Irrigation (PA)
Septic System Drip Irrigation (alternative) (WV)
Septic System Free Access Sand Filterw/Spray Irrigation (PA)
Septic System Peat Based Option1 w/At-Grade Bed (Alt.) (PA)
Septic System Spray Irrigation (PA)
Septic System Steep Slope Sand Mound (Alternate) (PA)
Shallow Infiltration Systems
SOH - Organic Matter Depletion Potential, Irrigated (CA)
SOH - Soil Surface Sealing
TROP - Plantains Productivity
URB/REC - Camp Areas (GA)
URB/REC - Camp Areas (MI)
URB/REC - Golf Fairways (OH)
URB/REC - Off-Road Motorcycle Trails
URB/REC - Paths and Trails (MI)
URB/REC - Playgrounds (OH)
Vinifera Wine Grape Site Desirability (Long to Medium)
WLF - Chufa for Turkey Forage (LA)
WLF - Food Plots for Upland Wildlife < 2 Acres (TX)
WLF - Freshwater Wetland Plants (TX)
WLF - Irrigated Saline Water Wetland Plants (TX)
WLF - Riparian Herbaceous Plants (TX)
WLF - Riparian Shrubs, Vines, & Trees (TX)
WLF - Saline Water Wetland Plants (TX)
WLF - Upland Mixed Deciduous & Coniferous Trees (TX)
WMS - Constructing Grassed Waterways (TX)
WMS - Constructing Terraces and Diversions (OH)
WMS - Embankments, Dikes, and Levees (VT)
WMS - Irrigation, Sprinkler (close spaced outlet drops)
WMS - Irrigation, Sprinkler (general)
WMS - Pond Reservoir Area (GA)
WMS-Subsurface Water Management, Installation (ND)
WMS-Subsurface Water Management, Outflow Quality (ND)
AGR - Barley Yield (MT)
AGR - Conventional Tillage (TX)
AGR - Grape non-irrigated (MO)
AGR - Industrial Hemp for Fiber and Seed Production
AGR - Nitrate Leaching Potential, Irrigated (WA)
AGR - Pasture hayland (MO)
AGR - Pesticide Loss Potential-Soil Surface Runoff
AGR - Prime Farmland (TX)
AGR - Spring Wheat Yield (MT)
AGR-Agronomic Concerns (ND)
AGR-Pesticide and Nutrient Leaching Potential, NIRR (ND)
AGR-Surface Salinity (ND)
AGR-Water Erosion Potential (ND)
Alaska Exempt Wetland Potential (AK)
American Wine Grape Varieties Site Desirability (Short)
AWM - Irrigation Disposal of Wastewater (MD)
AWM - Manure and Food Processing Waste (DE)
AWM - Manure Stacking - Site Evaluation (TX)
AWM - Phosphorus Management (TX)
AWM - Slow Rate Process Treatment of Wastewater
BLM - Pygmy Rabbit Habitat Potential
BLM - Rangeland Tillage
BLM - Site Degradation Susceptibility
CA Prime Farmland (CA)
CLASS RULE - Depth to root limiting layer (5 classes) (NPS)
Commodity Crop Productivity Index (Corn) (TN)
CPI - Alfalfa Hay, NIRR - Palouse, Northern Rocky Mtns. (ID)
CPI - Barley, NIRR - Eastern Idaho Plateaus (ID)
CPI - Grass Hay, IRR - Eastern Idaho Plateaus (ID)
CPI - Grass Hay, NIRR - Palouse, Northern Rocky Mtns. (ID)
CPI - Potatoes, IRR - Snake River Plains (ID)
CPI - Small Grains, NIRR - Palouse Prairies (OR)
CPI - Small Grains, NIRR - Palouse Prairies (WA)
CPI - Small Grains, NIRR - Snake River Plains (ID)
CPI - Wheat, NIRR - Eastern Idaho Plateaus (ID)
CPI - Wild Hay, NIRR - Eastern Idaho Plateaus (ID)
CPI - Wild Hay, NIRR - Palouse, Northern Rocky Mtns. (ID)
CPI - Wild Hay, NIRR - Palouse, Northern Rocky Mtns. (WA)
Deep Infiltration Systems
DHS - Site for Composting Facility - Surface
Elevated Sand Mound Septic System (DE)
ENG - Animal Disposal by Composting (Catastrophic) (WV)
ENG - Application of Municipal Sludge (TX)
ENG - Closed-Loop Horizontal Geothermal Heat Pump (CT)
ENG - Construction Materials; Gravel Source (IN)
ENG - Construction Materials; Gravel Source (NE)
ENG - Construction Materials; Reclamation (MD)
ENG - Construction Materials; Reclamation (MI)
ENG - Construction Materials; Roadfill (GA)
ENG - Construction Materials; Sand Source (CT)
ENG - Construction Materials; Sand Source (GA)
ENG - Construction Materials; Topsoil (ID)
ENG - Construction Materials; Topsoil (OH)
ENG - Daily Cover for Landfill (OH)
ENG - Disposal Field (NJ)
ENG - Disposal Field Type Inst (NJ)
ENG - Dwellings W/O Basements
ENG - Dwellings With Basements
ENG - Dwellings without Basements (AK)
ENG - Lawn and Landscape (OH)
ENG - Lawn, Landscape, Golf Fairway
ENG - Local Roads and Streets (AK)
ENG - Local Roads and Streets (GA)
ENG - On-Site Waste Water Lagoons (MO)
ENG - Pier Beam Building Foundations (TX)
ENG - Sanitary Landfill (Area)
ENG - Sanitary Landfill (Area) (AK)
ENG - Septage Application - Incorporation or Injection (MN)
ENG - Septic System; Disinfection, Surface Application (TX)
ENG - Septic Tank Absorption Fields (FL)
ENG - Septic Tank Absorption Fields (OH)
ENG - Septic Tank Absorption Fields - Trench (MN)
ENG - Sewage Lagoons (AK)
ENG - Shallow Excavations (OH)
ENG - Soil Suitability for SLAMM Marsh Migration (CT)
ENG - Stormwater Management / Infiltration (NY)
ENG - Stormwater Management / Wetlands (NY)
FOR - Black Walnut Suitability (WI)
FOR - Black Walnut Suitability (WV)
FOR - Construction Limitations for Haul Roads/Log Landings
FOR - Displacement Hazard
FOR - Harvest Equipment Operability (DE)
FOR - Harvest Equipment Operability (ME)
FOR - Harvest Equipment Operability (MI)
FOR - Log Landing Suitability (ID)
FOR - Log Landing Suitability (MI)
FOR - Log Landing Suitability (OR)
FOR - Mechanical Planting Suitability (OH)
FOR - Mechanical Site Preparation (Surface) (MD)
FOR - Mechanical Site Preparation (Surface) (OH)
FOR - Mechanical Site Preparation; Surface (CT)
FOR - Potential Erosion Hazard (Off-Road/Off-Trail) (MI)
FOR - Potential Erosion Hazard (Off-Road/Off-Trail) (OH)
FOR - Potential Seedling Mortality (FL)
FOR - Potential Seedling Mortality (OH)
FOR - Road Suitability (Natural Surface) (VT)
FOR - Soil Rutting Hazard
FOTG - Indiana Soy Bean Yield Calculation (IN)
FOTG - Indiana Wheat Yield Calculation (IN)
FOTG - NLI report Calculation - (IN)
GRL - Fencing, Post Depth =<24 inches
GRL - Fencing, Post Depth Less Than 24 inches (TX)
GRL - Fencing, Post Depth Less Than 36 inches (TX)
GRL - NV range seeding (Wind C = 10) (NV)
GRL - NV range seeding (Wind C = 30) (NV)
GRL - Rangeland Chaining (TX)
GRL - Rangeland Disking (TX)
GRL - Rangeland Dozing/Grubbing (TX)
GRL - Utah Juniper Encroachment Potential
GRL - Western Juniper Encroachment Potential (OR)
Ground-based Solar Arrays_bedrock_slope_anchor(ME)
Ground-based Solar Arrays_saturation_flooding_Frost(ME)
Hybrid Wine Grape Varieties Site Desirability (Medium)
Lined Retention Systems
MIL - Trafficability Veh. Type 1 dry season (DOD)
MIL - Trafficability Veh. Type 3 1-pass wet season (DOD)
MIL - Trafficability Veh. Type 3 dry season (DOD)
MIL - Trafficability Veh. Type 4 dry season (DOD)
MIL - Trafficability Veh. Type 5 1-pass wet season (DOD)
NCCPI - NCCPI Corn Submodel (I)
NCCPI - NCCPI Small Grains Submodel (II)
NCCPI - NCCPI Soybeans Submodel (I)
Peony Flowers Site Suitability (AK)
Pressure Dose Full Depth Septic System (DE)
REC - Camp Areas; Primitive (AK)
REC - Paths and Trails (CT)
Salinity Risk Index (ND)
SAS - Eastern Oyster Habitat Restoration Suitability
SAS - Mooring Anchor - Mushroom
Septic System CO-OP RFS III w/At-Grade Bed (PA)
Septic System Free Access Sand Filter w/At-Grade Bed (PA)
Septic System Modified Subsurface Sand Filter (Alt.) (PA)
Septic System Shallow In Ground Trench (conventional) (WV)
Septic System Subsurface Sand Filter Bed (conventional) (PA)
Septic System Subsurface Sand Filter Trench (standard) (PA)
SOH - Limitations for Aerobic Soil Organisms
URB - Concrete Driveways and Sidewalks (TX)
URB - Dwellings on Concrete Slab (TX)
URB - Lawns and Ornamental Plantings (TX)
URB/REC - Paths and Trails
URB/REC - Paths and Trails (GA)
URB/REC - Playgrounds (MI)
Vinifera Wine Grape Site Desirability (Long)
WLF - Crawfish Aquaculture (TX)
WLF - Desertic Herbaceous Plants (TX)
WLF - Gopher Tortoise Burrowing Suitability
WLF - Grain & Seed Crops for Food and Cover (TX)
WMS - Constructing Grassed Waterways (OH)
WMS - Irrigation, Surface (graded)
WMS - Subsurface Drains - Installation (VT)
WMS - Subsurface Water Management, System Performance
WMS - Surface Drains (TX)
WMS - Surface Irrigation Intake Family (TX)
Septic System Low Pressure Pipe (alternative) (WV)
Septic System Mound (alternative) (WV)
Septic System Peat Based Option2 w/Spray Irrigation (PA)
Septic System Steep Slope Mound (alternative) (WV)
SOH - Concentration of Salts- Soil Surface
SOH - Soil Susceptibility to Compaction
Soil Habitat for Saprophyte Stage of Coccidioides
Unlined Retention Systems
URB - Commercial Metal Bldg; w/Reinforced Concrete Slab (TX)
URB/REC - Picnic Areas (GA)
URB/REC - Picnic Areas (MI)
URB/REC - Picnic Areas (OH)
Vinifera Wine Grape Site Desirability (Short)
WLF - Burrowing Mammals & Reptiles (TX)
WLF - Desert Tortoise (CA)
WLF - Domestic Grasses & Legumes for Food and Cover (TX)
WLF - Irrigated Grain & Seed Crops for Food & Cover (TX)
WMS - Excavated Ponds (Aquifer-fed)
WMS - Excavated Ponds (Aquifer-fed) (VT)
WMS - Irrigation, General
WMS - Irrigation, Micro (above ground)
WMS - Irrigation, Micro (above ground) (VT)
WMS - Irrigation, Micro (subsurface drip)
WMS - Irrigation, Sprinkler (general) (VT)
WMS - Pond Reservoir Area
WMS - Pond Reservoir Area (OH)
WMS - Subsurface Water Management, System Installation
WMS - Constructing Terraces & Diversions (TX)
WMS - Drainage (OH)
WMS - Excavated Ponds (Aquifer-fed) (OH)
WMS - Grape Production with Drip Irrigation (TX)
WMS - Irrigation, Micro (subsurface drip) (VT)
WMS - Irrigation, Surface (level)
WMS - Pond Reservoir Area (MI)
WMS - Pond Reservoir Area (VT)
WMS - Sprinkler Irrigation (MT)
WMS - Sprinkler Irrigation RDC (IL)
WMS - Subsurface Drains - Performance (VT)
WMS - Subsurface Water Management, Outflow Quality
WMS - Surface Water Management, System
WMS-Subsurface Water Management, Performance (ND)
a data.frame
Jason Nemecek, Chad Ferguson, Andrew Brown
# get two forestry interpretations for CA630 get_SDA_interpretation(c("FOR - Potential Seedling Mortality", "FOR - Road Suitability (Natural Surface)"), method = "Dominant Condition", areasymbols = "CA630")
# get two forestry interpretations for CA630 get_SDA_interpretation(c("FOR - Potential Seedling Mortality", "FOR - Road Suitability (Natural Surface)"), method = "Dominant Condition", areasymbols = "CA630")
Obtain pre-calculated tabular reports of usage, activities, areas of interest (AOI), exports, ecological sites, ratings and reports for specific areas, times and intervals.
get_SDA_metrics(query_name, query_frequency, query_year, state = NULL)
get_SDA_metrics(query_name, query_frequency, query_year, state = NULL)
query_name |
One or more of: |
query_frequency |
One or more of: |
query_year |
Integer. One or more years e.g. |
state |
Optional: State abbreviation; Default: |
A data.frame
containing query results
Jason Nemecek
## Not run: get_SDA_metrics('SDA_Usage', 'CY', 2019:2021) ## End(Not run)
## Not run: get_SDA_metrics('SDA_Usage', 'CY', 2019:2021) ## End(Not run)
Get map unit aggregate attribute information from Soil Data Access
get_SDA_muaggatt( areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, dsn = NULL )
get_SDA_muaggatt( areasymbols = NULL, mukeys = NULL, WHERE = NULL, query_string = FALSE, dsn = NULL )
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
query_string |
Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
a data.frame
Jason Nemecek, Chad Ferguson, Andrew Brown
Get map unit parent material group information from Soil Data Access
get_SDA_pmgroupname( areasymbols = NULL, mukeys = NULL, WHERE = NULL, method = "DOMINANT COMPONENT", simplify = TRUE, miscellaneous_areas = FALSE, query_string = FALSE, dsn = NULL )
get_SDA_pmgroupname( areasymbols = NULL, mukeys = NULL, WHERE = NULL, method = "DOMINANT COMPONENT", simplify = TRUE, miscellaneous_areas = FALSE, query_string = FALSE, dsn = NULL )
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
method |
One of: |
simplify |
logical; group into generalized parent material groups? Default |
miscellaneous_areas |
Include miscellaneous areas (non-soil components) in results? Default: |
query_string |
Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
Default method
is "Dominant Component"
to get the dominant component (highest percentage). Use "Dominant Condition"
or dominant parent material condition (similar conditions aggregated across components). Use "None"
for no aggregation (one record per component).
a data.frame
Jason Nemecek, Chad Ferguson, Andrew Brown
Get map unit properties from Soil Data Access
get_SDA_property( property, method = c("Dominant Component (Category)", "Weighted Average", "Min/Max", "Dominant Component (Numeric)", "Dominant Condition", "None"), areasymbols = NULL, mukeys = NULL, WHERE = NULL, top_depth = 0, bottom_depth = 200, FUN = NULL, include_minors = FALSE, miscellaneous_areas = FALSE, query_string = FALSE, dsn = NULL )
get_SDA_property( property, method = c("Dominant Component (Category)", "Weighted Average", "Min/Max", "Dominant Component (Numeric)", "Dominant Condition", "None"), areasymbols = NULL, mukeys = NULL, WHERE = NULL, top_depth = 0, bottom_depth = 200, FUN = NULL, include_minors = FALSE, miscellaneous_areas = FALSE, query_string = FALSE, dsn = NULL )
property |
character vector of labels from property dictionary tables (see details) OR physical column names from |
method |
one of: "Dominant Component (Category)", "Dominant Component (Numeric)", "Weighted Average", "MIN", "MAX", "Dominant Condition", or "None". If "None" is selected, the number of rows returned will depend on whether a component or horizon level property was selected, otherwise the result will be 1:1 with the number of map units. |
areasymbols |
vector of soil survey area symbols |
mukeys |
vector of map unit keys |
WHERE |
character containing SQL WHERE clause specified in terms of fields in |
top_depth |
Default: |
bottom_depth |
Default: |
FUN |
Optional: character representing SQL aggregation function either "MIN" or "MAX" used only for method="min/max"; this argument is calculated internally if you specify |
include_minors |
Include minor components in "Weighted Average" or "MIN/MAX" results? Default: |
miscellaneous_areas |
Include miscellaneous areas (non-soil components) in results? Default: |
query_string |
Default: |
dsn |
Path to local SQLite database or a DBIConnection object. If |
The property
argument refers to one of the property names or columns specified in the tables below. Note that property
can be specified as either a character vector of labeled properties, such as "Bulk Density 0.33 bar H2O - Rep Value"
, OR physical column names such as "dbthirdbar_r"
. To get "low" and "high" values for a particular property, replace the _r
with _l
or _h
in the physical column name; for example property = c("dbthirdbar_l","dbthirdbar_r","dbthirdbar_h")
. You can view exhaustive lists of component and component horizon level properties in the Soil Data Access "Tables and Columns Report".
Property (Component) | Column |
Range Production - Favorable Year | rsprod_h |
Range Production - Normal Year | rsprod_r |
Range Production - Unfavorable Year | rsprod_l |
Corrosion of Steel | corsteel |
Corrosion of Concrete | corcon |
Drainage Class | drainagecl |
Hydrologic Group | hydgrp |
Taxonomic Class Name | taxclname |
Taxonomic Order | taxorder |
Taxonomic Suborder | taxsuborder |
Taxonomic Temperature Regime | taxtempregime |
Wind Erodibility Group | weg |
Wind Erodibility Index | wei |
t Factor | tfact |
Property (Horizon) | Column |
0.1 bar H2O - Rep Value | wtenthbar_r |
0.33 bar H2O - Rep Value | wthirdbar_r |
15 bar H2O - Rep Value | wfifteenbar_r |
Available Water Capacity - Rep Value | awc_r |
Bray 1 Phosphate - Rep Value | pbray1_r |
Bulk Density 0.1 bar H2O - Rep Value | dbtenthbar_r |
Bulk Density 0.33 bar H2O - Rep Value | dbthirdbar_r |
Bulk Density 15 bar H2O - Rep Value | dbfifteenbar_r |
Bulk Density oven dry - Rep Value | dbovendry_r |
CaCO3 Clay - Rep Value | claysizedcarb_r |
Calcium Carbonate - Rep Value | caco3_r |
Cation Exchange Capacity - Rep Value | cec7_r |
Coarse Sand - Rep Value | sandco_r |
Coarse Silt - Rep Value | siltco_r |
Effective Cation Exchange Capacity - Rep Value | ecec_r |
Electrial Conductivity 1:5 by volume - Rep Value | ec15_r |
Electrical Conductivity - Rep Value | ec_r |
Exchangeable Sodium Percentage - Rep Value | esp_r |
Extract Aluminum - Rep Value | extral_r |
Extractable Acidity - Rep Value | extracid_r |
Fine Sand - Rep Value | sandfine_r |
Fine Silt - Rep Value | siltfine_r |
Free Iron - Rep Value | freeiron_r |
Gypsum - Rep Value | gypsum_r |
Kf | kffact |
Ki | kifact |
Kr | krfact |
Kw | kwfact |
LEP - Rep Value | lep_r |
Liquid Limit - Rep Value | ll_r |
Medium Sand - Rep Value | sandmed_r |
Organic Matter - Rep Value | om_r |
Oxalate Aluminum - Rep Value | aloxalate_r |
Oxalate Iron - Rep Value | feoxalate_r |
Oxalate Phosphate - Rep Value | poxalate_r |
Plasticity Index - Rep Value | pi_r |
Rock Fragments 3 - 10 inches - Rep Value | frag3to10_r |
Rock Fragments > 10 inches - Rep Value | fraggt10_r |
Rubbed Fiber % - Rep Value | fiberrubbedpct_r |
Satiated H2O - Rep Value | wsatiated_r |
Saturated Hydraulic Conductivity - Rep Value | ksat_r |
Sodium Adsorption Ratio - Rep Value | sar_r |
Sum of Bases - Rep Value | sumbases_r |
Total Clay - Rep Value | claytotal_r |
Total Phosphate - Rep Value | ptotal_r |
Total Sand - Rep Value | sandtotal_r |
Total Silt - Rep Value | silttotal_r |
Unrubbed Fiber % - Rep Value | fiberunrubbedpct_r |
Very Coarse Sand - Rep Value | sandvc_r |
Very Fine Sand - Rep Value | sandvf_r |
Water Soluble Phosphate - Rep Value | ph2osoluble_r |
no. 10 sieve - Rep Value | sieveno10_r |
no. 200 sieve - Rep Value | sieveno200_r |
no. 4 sieve - Rep Value | sieveno4_r |
no. 40 sieve - Rep Value | sieveno40_r |
pH .01M CaCl2 - Rep Value | ph01mcacl2_r |
pH 1:1 water - Rep Value | ph1to1h2o_r |
pH Oxidized - Rep Value | phoxidized_r |
a data.frame with result
Jason Nemecek, Chad Ferguson, Andrew Brown
# get 1/3 bar bulk density [0,25] centimeter depth weighted average from dominant component get_SDA_property(property = c("dbthirdbar_l","dbthirdbar_r","dbthirdbar_h"), method = "Dominant Component (Numeric)", areasymbols = "CA630", top_depth = 0, bottom_depth = 25)
# get 1/3 bar bulk density [0,25] centimeter depth weighted average from dominant component get_SDA_property(property = c("dbthirdbar_l","dbthirdbar_r","dbthirdbar_h"), method = "Dominant Component (Numeric)", areasymbols = "CA630", top_depth = 0, bottom_depth = 25)
Get Soil Data Viewer Attribute Information
get_SDV_legend_elements( WHERE, alpha = 255, notratedcolor = rgb(1, 1, 1, 0), simplify = TRUE )
get_SDV_legend_elements( WHERE, alpha = 255, notratedcolor = rgb(1, 1, 1, 0), simplify = TRUE )
WHERE |
WHERE clause for query of Soil Data Access |
alpha |
transparency value applied in calculation of hexadecimal color. Default: |
notratedcolor |
Used to add 'Not rated' color entries where applicable. Default: |
simplify |
Return a data.frame when |
A list with a data.frame element for each element of WHERE
containing "attributekey"
, "attributename"
, "attributetype"
, "attributetablename"
, "attributecolumnname"
, "attributedescription"
, "nasisrulename"
, "label"
, "order"
, "value"
, "lower_value"
, "upper_value"
,"red"
, "green"
, "blue"
and "hex"
columns.
Get site-level data from a local NASIS database.
get_site_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL )
get_site_data_from_NASIS_db( SS = TRUE, nullFragsAreZero = TRUE, stringsAsFactors = NULL, dsn = NULL )
SS |
fetch data from Selected Set in NASIS or from the entire local
database (default: |
nullFragsAreZero |
should surface fragment cover percentages of NULL be interpreted as 0? (default: TRUE) |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
When multiple "site bedrock" entries are present, only the shallowest is returned by this function.
A data.frame
Jay M. Skovlin and Dylan E. Beaudette
Get site-level data from a PedonPC database.
get_site_data_from_pedon_db(dsn)
get_site_data_from_pedon_db(dsn)
dsn |
The path to a 'pedon.mdb' database. |
A data.frame.
Dylan E. Beaudette and Jay M. Skovlin
get_hz_data_from_pedon_db
,
get_veg_from_AK_Site
,
These functions return records from the Series Classification (SC) database, either from the local NASIS database (all series) or via web report (named series only).
get_competing_soilseries_from_NASIS():
Get Soil Series from NASIS Matching Taxonomic Class Name
get_soilseries_from_NASIS( stringsAsFactors = NULL, dsn = NULL, delimiter = " over ", SS = FALSE ) get_soilseries_from_NASISWebReport(soils, stringsAsFactors = NULL) get_competing_soilseries_from_NASIS( x, what = "taxclname", dsn = NULL, SS = FALSE )
get_soilseries_from_NASIS( stringsAsFactors = NULL, dsn = NULL, delimiter = " over ", SS = FALSE ) get_soilseries_from_NASISWebReport(soils, stringsAsFactors = NULL) get_competing_soilseries_from_NASIS( x, what = "taxclname", dsn = NULL, SS = FALSE )
stringsAsFactors |
deprecated |
dsn |
Optional: path or DBIConnection to local database containing NASIS table structure; default: |
delimiter |
character. Used to collapse |
SS |
logical. Fetch data from the currently loaded selected set in NASIS or from the entire local database (default: |
soils |
A vector of soil series names |
x |
Taxonomic Class Name (or other field specified by |
what |
Column name to match |
A data.frame
Stephen Roecker
This function calls ECOSHARE (zip files) to get Soil Inventory Resource (SRI) data for USFS Region 6. These datasets contain both spatial and non-spatial data in the form of a File Geodatabase (GDB).
get_SRI(gdb, layers = "MapUnits", quiet = FALSE, simplify = TRUE)
get_SRI(gdb, layers = "MapUnits", quiet = FALSE, simplify = TRUE)
gdb |
A |
layers |
A |
quiet |
A |
simplify |
A |
Due to the fact that many Region 6 Forests do not have NRCS SSURGO surveys (at a scale of 1:24,000, these are the highest-resolution soils data generally available), Region 6 initiated a project in 2012 to bring these legacy SRI soils data into digital databases to facilitate their use in regional planning activities. The datasets available on this page are the results of that effort.
The SRI were originally compiled in 20 volumes, with the original year of publication ranging from 1969 to 1979. The Gifford-Pinchot SRI was redone following the eruption of Mt Saint Helens, and that version was published in 1992. The Olympic NF also produced two versions, the original version being published in 1969, with an update in 1982. The Colville National Forest was the only Region 6 forest that did not compile a SRI.
The data are organized into one single regional GDB, together with twenty individual forest-level GDBs. The regional database contains polygons from all twenty SRIs together with a common set of attributes for the two or three soil layers delineated in the individual mapping unit descriptions, such as texture, depth, color, rock content, etc. In general, the regional database contains physical soil attributes that could be compiled more or less completely and consistently across all forests. The individual forest-level databases contain the polygons for each individual SRI, together with various tables of management interpretations and laboratory data, together with a variety of miscellaneous tables. The information contained in these forest-level databases varies widely from forest to forest, which is why they were not merged into a regional view. Full metadata are included with each database, and scans of the original SRI volumes are provided for reference as well. A Forest Service General Technical Report that fully describes the available data is currently in preparation.
The GDB's currently available:
Region6
Deschutes
Fremont
GiffordPinchot
Malheur
MtBaker
MtHood
Ochoco
Okanogan
Olympic
RogueRiver
Siskiyou
Siuslaw
Umatilla
Umpqua
WallowaWhitman
Wenatchee
Willamette
Winema
An sf
or data.frame
object.
Please use get_SRI_layers
to get the layer id information needed for the layer argument. This will
help with joining sf
and data.frame
objects.
Josh Erickson
get_SRI_layers()
## Not run: # get Deschutes SRI sri_deschutes <- get_SRI('Deschutes') # get multiple layers in a list sri_deschutes_multiple <- get_SRI(gdb = 'Deschutes', layers = c('MapUnits', 'ErosionAndHydro', 'SampleSites_MaterialsTesting')) ## End(Not run)
## Not run: # get Deschutes SRI sri_deschutes <- get_SRI('Deschutes') # get multiple layers in a list sri_deschutes_multiple <- get_SRI(gdb = 'Deschutes', layers = c('MapUnits', 'ErosionAndHydro', 'SampleSites_MaterialsTesting')) ## End(Not run)
Get SRI Layers
get_SRI_layers(gdb)
get_SRI_layers(gdb)
gdb |
A |
A list of metadata about the GDB
Refer to get_SRI
for information on File Geodatabase (GDB) availability.
Josh Erickson
## Not run: sri_layers <- get_SRI_layers('Willamette') ## End(Not run)
## Not run: sri_layers <- get_SRI_layers('Willamette') ## End(Not run)
Get text note data from a local NASIS Database
get_text_notes_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL) get_mutext_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL) get_cotext_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL)
get_text_notes_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL) get_mutext_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL) get_cotext_from_NASIS_db(SS = TRUE, fixLineEndings = TRUE, dsn = NULL)
SS |
get data from the currently loaded Selected Set in NASIS or from
the entire local database (default: |
fixLineEndings |
convert line endings from |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A list
with the results.
Dylan E. Beaudette and Jay M. Skovlin
get_hz_data_from_pedon_db
,
get_site_data_from_pedon_db
if(local_NASIS_defined()) { # query text note data t <- try(get_text_notes_from_NASIS_db()) # show contents text note data, includes: siteobs, site, pedon, horizon level text notes data. str(t) # view text categories for site text notes if(!inherits(t, 'try-error')) { table(t$site_text$textcat) } }
if(local_NASIS_defined()) { # query text note data t <- try(get_text_notes_from_NASIS_db()) # show contents text note data, includes: siteobs, site, pedon, horizon level text notes data. str(t) # view text categories for site text notes if(!inherits(t, 'try-error')) { table(t$site_text$textcat) } }
Get vegetation data from a local NASIS Database. Result includes two data.frames corresponding to the "Plot Plant Inventory" and "Vegetation Transect" child tables of "Vegetation Plot".
get_veg_data_from_NASIS_db(SS = TRUE, dsn = NULL)
get_veg_data_from_NASIS_db(SS = TRUE, dsn = NULL)
SS |
get data from the currently loaded Selected Set in NASIS or from
the entire local database (default: |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
A list of data.frame
Jay M. Skovlin and Dylan E. Beaudette
if(local_NASIS_defined()) { # query text note data v <- try(get_veg_from_NASIS_db()) # show contents veg data returned str(v) }
if(local_NASIS_defined()) { # query text note data v <- try(get_veg_from_NASIS_db()) # show contents veg data returned str(v) }
Get Vegetation Data from an AK Site Database
get_veg_from_AK_Site(dsn)
get_veg_from_AK_Site(dsn)
dsn |
file path the the AK Site access database |
A data.frame with vegetation data in long format, linked to site ID.
Dylan E. Beaudette
get_hz_data_from_pedon_db
,
get_site_data_from_pedon_db
Get Site and Plot-level data from a Montana RangeDB database.
get_veg_from_MT_veg_db(dsn)
get_veg_from_MT_veg_db(dsn)
dsn |
The name of the Montana RangeDB front-end database connection (see details). |
A data.frame.
Jay M. Skovlin
get_veg_species_from_MT_veg_db
,
get_veg_other_from_MT_veg_db
Used to extract species, stratum, and cover vegetation data from a backend NPS PLOTS Database. Currently works for any Microsoft Access database with an .mdb file format.
get_veg_from_NPS_PLOTS_db(dsn)
get_veg_from_NPS_PLOTS_db(dsn)
dsn |
file path to the NPS PLOTS access database on your system. |
A data.frame with vegetation data in a long format with linkage to NRCS soil pedon data via the site_id key field.
This function currently only works on Windows.
Jay M. Skovlin
Get cover composition data from a Montana RangeDB database.
get_veg_other_from_MT_veg_db(dsn)
get_veg_other_from_MT_veg_db(dsn)
dsn |
The name of the Montana RangeDB front-end database connection (see details). |
A data.frame.
Jay M. Skovlin
get_veg_from_MT_veg_db
,
get_veg_species_from_MT_veg_db
Get species-level data from a Montana RangeDB database.
get_veg_species_from_MT_veg_db(dsn)
get_veg_species_from_MT_veg_db(dsn)
dsn |
The name of the Montana RangeDB front-end database connection (see details). |
A data.frame.
Jay M. Skovlin
get_veg_from_MT_veg_db
,
get_veg_other_from_MT_veg_db
Get Logic Errors in NASIS/PedonPC Pedon Horizon
getHzErrorsNASIS(strict = TRUE, SS = TRUE, dsn = NULL)
getHzErrorsNASIS(strict = TRUE, SS = TRUE, dsn = NULL)
strict |
how strict should horizon boundaries be checked for consistency: TRUE=more | FALSE=less |
SS |
fetch data from the currently loaded selected set in NASIS or from the entire local database (default: TRUE) |
dsn |
Optional: path to local SQLite database containing NASIS table structure; default: NULL |
A data.frame containing problematic records with columns: 'peiid','pedon_id','hzdept','hzdepb','hzname'
Intermediate-scale gridded (800m) soil property and interpretation maps from aggregated SSURGO and STATSGO data. These maps were developed by USDA-NRCS-SPSD staff in collaboration with UCD-LAWR. Originally for educational use and interactive thematic maps, these data are a suitable alternative to gridded STATSGO-derived thematic soil maps. The full size grids can be downloaded here.
ISSR800.wcs(aoi, var, res = 800, quiet = FALSE)
ISSR800.wcs(aoi, var, res = 800, quiet = FALSE)
aoi |
area of interest (AOI) defined using a |
var |
ISSR-800 grid name (case insensitive), see details |
res |
grid resolution, units of meters. The native resolution of ISSR-800 grids (this WCS) is 800m. |
quiet |
logical, passed to |
aoi
should be specified as a SpatRaster
, Spatial*
, RasterLayer
, SpatRaster
/SpatVector
, sf
, sfc
, or bbox
object or a list
containing:
aoi
bounding-box specified as (xmin, ymin, xmax, ymax) e.g. c(-114.16, 47.65, -114.08, 47.68)
crs
coordinate reference system of BBOX, e.g. 'OGC:CRS84' (EPSG:4326, WGS84 Longitude/Latitude)
The WCS query is parameterized using a rectangular extent derived from the above AOI specification, after conversion to the native CRS (EPSG:5070) of the ISSR-800 grids.
Variables available from this WCS can be queried using WCS_details(wcs = 'ISSR800')
.
A SpatRaster (or RasterLayer) object containing indexed map unit keys and associated raster attribute table or a try-error if request fails. By default, spatial classes from the terra
package are returned. If the input object class is from the raster
or sp
packages a RasterLayer is returned.
There are still some issues to be resolved related to the encoding of NA Variables with a natural zero (e.g. SAR) have 0 set to NA.
D.E. Beaudette and A.G. Brown
## Not run: library(terra) # see WCS_details() for variable options WCS_details(wcs = 'ISSR800') # get wind erodibility group res <- ISSR800.wcs(list(aoi = c(-116, 35, -115.5, 35.5), crs = "EPSG:4326"), var = 'weg', res = 800) plot(res) ## End(Not run)
## Not run: library(terra) # see WCS_details() for variable options WCS_details(wcs = 'ISSR800') # get wind erodibility group res <- ISSR800.wcs(list(aoi = c(-116, 35, -115.5, 35.5), crs = "EPSG:4326"), var = 'weg', res = 800) plot(res) ## End(Not run)
Water retention curve modeling via van Genuchten model and KSSL data.
KSSL_VG_model(VG_params, phi_min = 10^-6, phi_max = 10^8, pts = 100)
KSSL_VG_model(VG_params, phi_min = 10^-6, phi_max = 10^8, pts = 100)
VG_params |
|
phi_min |
lower limit for water potential in kPa |
phi_max |
upper limit for water potential in kPa |
pts |
number of points to include in estimated water retention curve |
This function was developed to work with measured or estimated parameters of the van Genuchten model, as generated by the Rosetta model. As such, VG_params
should have the following format and conventions:
saturated water content, values should be in the range of {0, 1}
residual water content, values should be in the range of {0, 1}
related to the inverse of the air entry suction, function expects log10-transformed values with units of 1/cm
index of pore size distribution, function expects log10-transformed values (dimensionless)
A list with the following components:
estimated water retention curve: paired estimates of water potential (phi) and water content (theta)
spline function for converting water potential (phi, units of kPa) to estimated volumetric water content (theta, units of percent, range: {0, 1})
spline function for converting volumetric water content (theta, units of percent, range: {0, 1}) to estimated water potential (phi, units of kPa)
A practical example is given in the fetchSCAN tutorial.
D.E. Beaudette
water retention curve estimation
# basic example d <- data.frame( theta_r = 0.0337216, theta_s = 0.4864061, alpha = -1.581517, npar = 0.1227247 ) vg <- KSSL_VG_model(d) str(vg)
# basic example d <- data.frame( theta_r = 0.0337216, theta_s = 0.4864061, alpha = -1.581517, npar = 0.1227247 ) vg <- KSSL_VG_model(d) str(vg)
SoilProfilecollection
Objects Returned by fetchNASIS
.Several examples of soil profile collections returned by
fetchNASIS(from='pedons')
as SoilProfileCollection
objects.
# load example dataset data("gopheridge") # what kind of object is this? class(gopheridge) # how many profiles? length(gopheridge) # there are 60 profiles, this calls for a split plot par(mar=c(0,0,0,0), mfrow=c(2,1)) # plot soil colors plot(gopheridge[1:30, ], name='hzname', color='soil_color') plot(gopheridge[31:60, ], name='hzname', color='soil_color') # need a larger top margin for legend par(mar=c(0,0,4,0), mfrow=c(2,1)) # generate colors based on clay content plot(gopheridge[1:30, ], name='hzname', color='clay') plot(gopheridge[31:60, ], name='hzname', color='clay') # single row and no labels par(mar=c(0,0,0,0), mfrow=c(1,1)) # plot soils sorted by depth to contact plot(gopheridge, name='', print.id=FALSE, plot.order=order(gopheridge$bedrckdepth)) # plot first 10 profiles plot(gopheridge[1:10, ], name='hzname', color='soil_color', label='pedon_id', id.style='side') # add rock fragment data to plot: addVolumeFraction(gopheridge[1:10, ], colname='total_frags_pct') # add diagnostic horizons addDiagnosticBracket(gopheridge[1:10, ], kind='argillic horizon', col='red', offset=-0.4) ## loafercreek data("loafercreek") # plot first 10 profiles plot(loafercreek[1:10, ], name='hzname', color='soil_color', label='pedon_id', id.style='side') # add rock fragment data to plot: addVolumeFraction(loafercreek[1:10, ], colname='total_frags_pct') # add diagnostic horizons addDiagnosticBracket(loafercreek[1:10, ], kind='argillic horizon', col='red', offset=-0.4)
# load example dataset data("gopheridge") # what kind of object is this? class(gopheridge) # how many profiles? length(gopheridge) # there are 60 profiles, this calls for a split plot par(mar=c(0,0,0,0), mfrow=c(2,1)) # plot soil colors plot(gopheridge[1:30, ], name='hzname', color='soil_color') plot(gopheridge[31:60, ], name='hzname', color='soil_color') # need a larger top margin for legend par(mar=c(0,0,4,0), mfrow=c(2,1)) # generate colors based on clay content plot(gopheridge[1:30, ], name='hzname', color='clay') plot(gopheridge[31:60, ], name='hzname', color='clay') # single row and no labels par(mar=c(0,0,0,0), mfrow=c(1,1)) # plot soils sorted by depth to contact plot(gopheridge, name='', print.id=FALSE, plot.order=order(gopheridge$bedrckdepth)) # plot first 10 profiles plot(gopheridge[1:10, ], name='hzname', color='soil_color', label='pedon_id', id.style='side') # add rock fragment data to plot: addVolumeFraction(gopheridge[1:10, ], colname='total_frags_pct') # add diagnostic horizons addDiagnosticBracket(gopheridge[1:10, ], kind='argillic horizon', col='red', offset=-0.4) ## loafercreek data("loafercreek") # plot first 10 profiles plot(loafercreek[1:10, ], name='hzname', color='soil_color', label='pedon_id', id.style='side') # add rock fragment data to plot: addVolumeFraction(loafercreek[1:10, ], colname='total_frags_pct') # add diagnostic horizons addDiagnosticBracket(loafercreek[1:10, ], kind='argillic horizon', col='red', offset=-0.4)
nasis_local
ODBC data sourceCheck for presence of a NASIS data source. This function always returns FALSE
when the odbc
package is not available (regardless of whether you have an ODBC data source properly set up).
local_NASIS_defined(dsn = NULL)
local_NASIS_defined(dsn = NULL)
dsn |
Optional: path to local SQLite database, or a DBIConnection, containing NASIS table structure; default: NULL |
If dsn
is specified as a character vector it is assumed to refer to a SQLite data source. The result will be TRUE
or FALSE
depending on the result of RSQLite::dbCanConnect()
.
If dsn
is specified as a DBIConnection
the function returns the value of DBI::dbExistsTable("MetadataDomainMaster")
logical
if(local_NASIS_defined()) { # use fetchNASIS or some other lower-level fetch function } else { message('could not find `nasis_local` ODBC data source') }
if(local_NASIS_defined()) { # use fetchNASIS or some other lower-level fetch function } else { message('could not find `nasis_local` ODBC data source') }
Construct a URL for Ecological Dynamics Interpretive Tool (EDIT) web services (https://edit.jornada.nmsu.edu/services/...
) to return PDF, TXT or JSON results.
make_EDIT_service_URL( src = c("descriptions", "downloads", "plant-community-tables", "models", "keys"), catalog = c("esd", "esg"), geoUnit = NULL, ecoclass = NULL, landuse = NULL, state = NULL, community = NULL, key = NULL, endpoint = NULL, querystring = NULL )
make_EDIT_service_URL( src = c("descriptions", "downloads", "plant-community-tables", "models", "keys"), catalog = c("esd", "esg"), geoUnit = NULL, ecoclass = NULL, landuse = NULL, state = NULL, community = NULL, key = NULL, endpoint = NULL, querystring = NULL )
src |
One of: |
catalog |
Catalog ID. One of: |
geoUnit |
Geographic unit ID. For example: |
ecoclass |
Ecological class ID. For example: |
landuse |
Optional: Used only for |
state |
Optional: Used only for |
community |
Optional: Used only for |
key |
Optional: Key number. All keys will be returned if not specified. |
endpoint |
Optional: Specific endpoint e.g. |
querystring |
Optional: Additional request parameters specified as a query string |
See the following official EDIT developer resources to see which endpoints are available for Ecological Site Description (ESD) or Ecological Site Group (ESG) catalogs:
A character vector containing URLs with specified parameters. This function is vectorized.
get_EDIT_ecoclass_by_geoUnit
# url for all geoUnit keys as PDF make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X") # url for a single key within geoUnit as PDF make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", key = "1") # query for "full" description in JSON desc <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", endpoint = "R039XA109AZ.json") # query for "overview" desc_ov <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", ecoclass = "R039XA109AZ", endpoint = "overview.json") # query for specific section, e.g. "water features" desc_wf <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", ecoclass = "R039XA109AZ", endpoint = "water-features.json") # construct the URLs -- that is a query essentially # then download the result with read_json #full <- jsonlite::read_json(desc) #overview <- jsonlite::read_json(desc_ov) #waterfeature <- jsonlite::read_json(desc_wf)
# url for all geoUnit keys as PDF make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X") # url for a single key within geoUnit as PDF make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", key = "1") # query for "full" description in JSON desc <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", endpoint = "R039XA109AZ.json") # query for "overview" desc_ov <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", ecoclass = "R039XA109AZ", endpoint = "overview.json") # query for specific section, e.g. "water features" desc_wf <- make_EDIT_service_URL(src = "descriptions", catalog = "esd", geoUnit = "039X", ecoclass = "R039XA109AZ", endpoint = "water-features.json") # construct the URLs -- that is a query essentially # then download the result with read_json #full <- jsonlite::read_json(desc) #overview <- jsonlite::read_json(desc_ov) #waterfeature <- jsonlite::read_json(desc_wf)
Generate chunk labels for splitting data
makeChunks(ids, size = 100)
makeChunks(ids, size = 100)
ids |
vector of IDs |
size |
chunk (group) size |
A numeric vector
# split the lowercase alphabet into 2 chunks aggregate(letters, by = list(makeChunks(letters, size=13)), FUN = paste0, collapse=",")
# split the lowercase alphabet into 2 chunks aggregate(letters, by = list(makeChunks(letters, size=13)), FUN = paste0, collapse=",")
NASIS 7 Metadata from MetadataDomainDetail, MetadataDomainMaster, and MetadataTableColumn tables
A data.frame
with the following columns:
DomainID
- Integer. ID that uniquely identifies a domain in a data model, not just within a database.
DomainName
- Character. Domain Name.
DomainRanked
- Integer. Is domain ranked? 0
= No; 1
= Yes
DisplayLabel
- Character. Domain Display Label.
ChoiceSequence
- Integer. Order or sequence of Choices.
ChoiceValue
- Integer. Value of choice level.
ChoiceName
- Character. Name of choice level.
ChoiceLabel
- Character. Label of choice level.
ChoiceObsolete
- Integer. Is choice level obsolete? 0
= No; 1
= Yes
ColumnPhysicalName
- Character. Physical column name.
ColumnLogicalName
- Character. Logical column name.
mukey
) grid from SoilWeb Web Coverage Service (WCS)Download chunks of the gNATSGO, gSSURGO, RSS, and STATSGO2 map unit key grid via bounding-box from the SoilWeb WCS.
mukey.wcs( aoi, db = c("gNATSGO", "gSSURGO", "RSS", "STATSGO", "PR_SSURGO", "HI_SSURGO"), res = 30, quiet = FALSE )
mukey.wcs( aoi, db = c("gNATSGO", "gSSURGO", "RSS", "STATSGO", "PR_SSURGO", "HI_SSURGO"), res = 30, quiet = FALSE )
aoi |
area of interest (AOI) defined using either a |
db |
name of the gridded map unit key grid to access, should be either 'gNATSGO', 'gSSURGO', 'STATSGO', 'HI_SSURGO', or 'PR_SSURGO' (case insensitive) |
res |
grid resolution, units of meters. The native resolution of gNATSGO and gSSURGO (this WCS) is 30m; STATSGO (this WCS) is 300m; and Raster Soil Surveys (RSS) are at 10m resolution. If |
quiet |
logical, passed to |
aoi
should be specified as one of: SpatRaster
, Spatial*
, RasterLayer
, sf
, sfc
, bbox
object, OR a list
containing:
aoi
bounding-box specified as (xmin, ymin, xmax, ymax) e.g. c(-114.16, 47.65, -114.08, 47.68)
crs
coordinate reference system of BBOX, e.g. 'OGC:CRS84' (EPSG:4326, WGS84 Longitude/Latitude)
The WCS query is parameterized using a rectangular extent derived from the above AOI specification, after conversion to the native CRS (EPSG:5070) of the WCS grids.
Databases available from this WCS can be queried using WCS_details(wcs = 'mukey')
.
A SpatRaster (or RasterLayer) object containing indexed map unit keys and associated raster attribute table or a try-error if request fails. By default, spatial classes from the terra
package are returned. If the input object class is from the raster
or sp
packages a RasterLayer is returned.
The gNATSGO grid includes raster soil survey map unit keys which are not in SDA.
D.E. Beaudette and A.G. Brown
## Not run: library(terra) res <- mukey.wcs(list(aoi = c(-116.7400, 35.2904, -116.7072, 35.3026), crs = "EPSG:4326"), db = 'gNATSGO', res = 30) m <- unique(values(res)) prp <- setNames( get_SDA_property( c("ph1to1h2o_r", "claytotal_r"), "weighted average", mukeys = m, top_depth = 0, bottom_depth = 25, include_minors = TRUE, miscellaneous_areas = FALSE )[, c("mukey", "ph1to1h2o_r", "claytotal_r")], c("ID", "pH1to1_0to25", "clay_0to25") ) levels(res) <- prp res2 <- catalyze(res) res2 plot(res2[['pH1to1_0to25']]) ## End(Not run)
## Not run: library(terra) res <- mukey.wcs(list(aoi = c(-116.7400, 35.2904, -116.7072, 35.3026), crs = "EPSG:4326"), db = 'gNATSGO', res = 30) m <- unique(values(res)) prp <- setNames( get_SDA_property( c("ph1to1h2o_r", "claytotal_r"), "weighted average", mukeys = m, top_depth = 0, bottom_depth = 25, include_minors = TRUE, miscellaneous_areas = FALSE )[, c("mukey", "ph1to1h2o_r", "claytotal_r")], c("ID", "pH1to1_0to25", "clay_0to25") ) levels(res) <- prp res2 <- catalyze(res) res2 plot(res2[['pH1to1_0to25']]) ## End(Not run)
This dataset contains NASIS 7 Tables, Columns and Foreign Keys
Create (ordered) factors and interchange between choice names, values and labels for lists of input vectors.
NASISChoiceList( x = NULL, colnames = names(x), what = "ColumnPhysicalName", choice = c("ChoiceName", "ChoiceValue", "ChoiceLabel"), obsolete = FALSE, factor = TRUE, droplevels = FALSE, ordered = TRUE, simplify = TRUE, dsn = NULL )
NASISChoiceList( x = NULL, colnames = names(x), what = "ColumnPhysicalName", choice = c("ChoiceName", "ChoiceValue", "ChoiceLabel"), obsolete = FALSE, factor = TRUE, droplevels = FALSE, ordered = TRUE, simplify = TRUE, dsn = NULL )
x |
A named list of vectors to use as input for NASIS Choice List lookup |
colnames |
vector of values of the column specified by |
what |
passed to |
choice |
one of: |
obsolete |
Include "obsolete" choices? Default: |
factor |
Convert result to factor? Default: |
droplevels |
Drop unused factor levels? Default: |
ordered |
Should the result be an ordered factor? Default: |
simplify |
Should list result with length 1 be reduced to a single vector? Default: |
dsn |
Optional: path or DBIConnection to local database containing NASIS table structure; default: NULL |
A list of "choices" based on the input x
that have been converted to a consistent target set of levels (specified by choice
) via NASIS 7 metadata.
When factor=TRUE
the result is a factor, possibly ordered when ordered=TRUE
and the target domain is a "ranked" domain (i.e. ChoiceSequence
has logical meaning).
When factor=FALSE
the result is a character or numeric vector. Numeric vectors are always returned when choice
is "ChoiceValue"
.
NASISChoiceList(1:3, "texcl") NASISChoiceList(1:3, "pondfreqcl") NASISChoiceList("Clay loam", "texcl", choice = "ChoiceValue") NASISChoiceList("Silty clay loam", "texcl", choice = "ChoiceName")
NASISChoiceList(1:3, "texcl") NASISChoiceList(1:3, "pondfreqcl") NASISChoiceList("Clay loam", "texcl", choice = "ChoiceValue") NASISChoiceList("Silty clay loam", "texcl", choice = "ChoiceName")
Set package option soilDB.NASIS.DomainsAsFactor
for returning coded NASIS domains as factors.
NASISDomainsAsFactor(x = NULL)
NASISDomainsAsFactor(x = NULL)
x |
logical; default |
logical, result of getOption("soilDB.NASIS.DomainsAsFactor")
## Not run: NASISDomansAsFactor(TRUE) ## End(Not run)
## Not run: NASISDomansAsFactor(TRUE) ## End(Not run)
This is a guide on using databases that follow the NASIS schema. Most of the time users are querying an instance of the Microsoft SQL Server NASIS local transactional database running on their computer. It is possible to create file-based "snapshots" of a local instance of the NASIS database using SQLite. See [createStaticNASIS()]
for details. These file-based snapshots, or other custom connections, can generally be specified to NASIS-related functions via the dsn
argument.
Some values (choice lists) in NASIS are conventionally stored using numeric codes. The codes are defined by "domain" and allow for both "names" and "labels" as well as other descriptive information to be provided for each choice list element. See get_NASIS_column_metadata()
for details.
Many soilDB functions call the function uncode()
internally to handle conversion to human-readable values using official NASIS domains. If writing queries directly against the database source, such as a connection created with NASIS()
or query run with dbQueryNASIS()
, you call uncode()
on the data.frame result of your query. Conversion of internal values to choice list names is based on domains associated with result column names.
When using a custom SQLite database, sometimes values in the database are delivered pre-decoded to make the database more directly usable. An example of this would be the Kellogg Soil Survey Laboratory morphologic database, the NASIS data corresponding to the laboratory analyses available through the Lab Data Mart (LDM).
To avoid issues with offsets between internal storage value and external readable value (for data such as farmland classification or Munsell color value and chroma), you should not call uncode()
multiple times. Also, you can disable the "decoding" behavior made internally in soilDB functions by setting options(soilDB.NASIS.skip_uncode = TRUE)
.
This is the R interface to OSD search by Section and OSD Search APIs provided by SoilWeb.
OSD records are searched with the PostgreSQL fulltext indexing and query system (syntax details). Each search field (except for the "brief narrative" and MLRA) corresponds with a section header in an OSD. The results may not include every OSD due to formatting errors and typos. Results are scored based on the number of times search terms match words in associated sections.
OSDquery( everything = NULL, mlra = "", taxonomic_class = "", typical_pedon = "", brief_narrative = "", ric = "", use_and_veg = "", competing_series = "", geog_location = "", geog_assoc_soils = "" )
OSDquery( everything = NULL, mlra = "", taxonomic_class = "", typical_pedon = "", brief_narrative = "", ric = "", use_and_veg = "", competing_series = "", geog_location = "", geog_assoc_soils = "" )
everything |
search entire OSD text (default is NULL), |
mlra |
a comma-delimited string of MLRA to search ('17,18,22A') |
taxonomic_class |
search family level classification |
typical_pedon |
search typical pedon section |
brief_narrative |
search brief narrative |
ric |
search range in characteristics section |
use_and_veg |
search use and vegetation section |
competing_series |
search competing series section |
geog_location |
search geographic setting section |
geog_assoc_soils |
search geographically associated soils section |
See this webpage for more information.
family level taxa are derived from SC database, not parsed OSD records
MLRA are derived via spatial intersection (SSURGO x MLRA polygons)
MLRA-filtering is only possible for series used in the current SSURGO snapshot (component name)
logical AND: &
logical OR: |
wildcard, e.g. rhy-something rhy:*
search terms with spaces need doubled single quotes: ”san joaquin”
combine search terms into a single expression: (grano:* | granite)
Related documentation can be found in the following tutorials
a data.frame
object containing soil series names that match patterns supplied as arguments.
SoilWeb maintains a snapshot of the Official Series Description data.
D.E. Beaudette
USDA-NRCS OSD search tools: https://soilseries.sc.egov.usda.gov/
# find all series that list Pardee as a geographically associated soil. s <- OSDquery(geog_assoc_soils = 'pardee') # get data for these series x <- fetchOSD(s$series, extended = TRUE, colorState = 'dry') # simple figure par(mar=c(0,0,1,1)) plot(x$SPC)
# find all series that list Pardee as a geographically associated soil. s <- OSDquery(geog_assoc_soils = 'pardee') # get data for these series x <- fetchOSD(s$series, extended = TRUE, colorState = 'dry') # simple figure par(mar=c(0,0,1,1)) plot(x$SPC)
Parse contents of a web report, based on supplied arguments.
parseWebReport(url, args, index = 1)
parseWebReport(url, args, index = 1)
url |
Base URL to a LIMS/NASIS web report. |
args |
List of named arguments to send to report, see details. |
index |
Integer index specifying the table to return, or, NULL for a list of tables |
Report argument names can be inferred by inspection of the HTML source associated with any given web report.
A data.frame
object in the case of a single integer index
, otherwise a list
Most web reports are for internal use only.
D.E. Beaudette and S.M. Roecker
This is a helper function commonly used with SDA_query
to extract
WKT (well-known text) representation of geometry to an sf
or sp
object.
processSDA_WKT(d, g = "geom", crs = 4326, p4s = NULL, as_sf = TRUE)
processSDA_WKT(d, g = "geom", crs = 4326, p4s = NULL, as_sf = TRUE)
d |
|
g |
name of column in |
crs |
CRS definition (e.g. an EPSG code). Default |
p4s |
Deprecated: PROJ4 CRS definition |
as_sf |
Return an |
The SDA website can be found at https://sdmdataaccess.nrcs.usda.gov. See the SDA Tutorial for detailed examples.
The SDA website can be found at https://sdmdataaccess.nrcs.usda.gov. See the SDA Tutorial for detailed examples.
An sf
object or if as_sf
is FALSE
a Spatial*
object.
This function requires the sf
package.
D.E. Beaudette, A.G. Brown
A simple interface to the ROSETTA model for predicting hydraulic parameters from soil properties. The ROSETTA API was developed by Dr. Todd Skaggs (USDA-ARS) and links to the work of Zhang and Schaap, (2017). See the related tutorial for additional examples.
ROSETTA( x, vars, v = c("1", "2", "3"), include.sd = FALSE, chunkSize = 10000, conf = NULL )
ROSETTA( x, vars, v = c("1", "2", "3"), include.sd = FALSE, chunkSize = 10000, conf = NULL )
x |
a |
vars |
character vector of column names in |
v |
ROSETTA model version number: '1', '2', or '3', see details and references. |
include.sd |
logical, include bootstrap standard deviation for estimated parameters |
chunkSize |
number of records per API call |
conf |
configuration passed to |
Soil properties supplied in x
must be described, in order, via vars
argument. The API does not use the names but column ordering must follow: sand, silt, clay, bulk density, volumetric water content at 33kPa (1/3 bar), and volumetric water content at 1500kPa (15 bar).
The ROSETTA model relies on a minimum of 3 soil properties, with increasing (expected) accuracy as additional properties are included:
required, sand, silt, clay: USDA soil texture separates (percentages) that sum to 100 percent
optional, bulk density (any moisture basis): mass per volume after accounting for >2mm fragments, units of gm/cm3
optional, volumetric water content at 33 kPa: roughly "field capacity" for most soils, units of cm^3/cm^3
optional, volumetric water content at 1500 kPa: roughly "permanent wilting point" for most plants, units of cm^3/cm^3
The Rosetta pedotransfer function predicts five parameters for the van Genuchten model of unsaturated soil hydraulic properties
theta_r : residual volumetric water content
theta_s : saturated volumetric water content
log10(alpha) : retention shape parameter [log10(1/cm)]
log10(npar) : retention shape parameter
log10(ksat) : saturated hydraulic conductivity [log10(cm/d)]
Column names not specified in vars
are retained in the output.
Three versions of the ROSETTA model are available, selected using "v = 1", "v = 2", or "v = 3".
version 1 - Schaap, M.G., F.J. Leij, and M.Th. van Genuchten. 2001. ROSETTA: a computer program for estimating soil hydraulic parameters with hierarchical pedotransfer functions. Journal of Hydrology 251(3-4): 163-176. doi: doi:10.1016/S0022-1694(01)00466-8.
version 2 - Schaap, M.G., A. Nemes, and M.T. van Genuchten. 2004. Comparison of Models for Indirect Estimation of Water Retention and Available Water in Surface Soils. Vadose Zone Journal 3(4): 1455-1463. doi: doi:10.2136/vzj2004.1455.
version 3 - Zhang, Y., and M.G. Schaap. 2017. Weighted recalibration of the Rosetta pedotransfer model with improved estimates of hydraulic parameter distributions and summary statistics (Rosetta3). Journal of Hydrology 547: 39-53. doi: doi:10.1016/j.jhydrol.2017.01.004.
D.E. Beaudette, Todd Skaggs (ARS), Richard Reid
Consider using the interactive version, with copy/paste functionality at: https://www.handbook60.org/rosetta.
Rosetta Model Home Page: https://www.ars.usda.gov/pacific-west-area/riverside-ca/agricultural-water-efficiency-and-salinity-research-unit/docs/model/rosetta-model/.
Python ROSETTA model: https://pypi.org/project/rosetta-soil/.
Yonggen Zhang, Marcel G. Schaap. 2017. Weighted recalibration of the Rosetta pedotransfer model with improved estimates of hydraulic parameter distributions and summary statistics (Rosetta3). Journal of Hydrology. 547: 39-53. doi:10.1016/j.jhydrol.2017.01.004.
Kosugi, K. 1999. General model for unsaturated hydraulic conductivity for soils with lognormal pore-size distribution. Soil Sci. Soc. Am. J. 63:270-277.
Mualem, Y. 1976. A new model predicting the hydraulic conductivity of unsaturated porous media. Water Resour. Res. 12:513-522.
Schaap, M.G. and W. Bouten. 1996. Modeling water retention curves of sandy soils using neural networks. Water Resour. Res. 32:3033-3040.
Schaap, M.G., Leij F.J. and van Genuchten M.Th. 1998. Neural network analysis for hierarchical prediction of soil water retention and saturated hydraulic conductivity. Soil Sci. Soc. Am. J. 62:847-855.
Schaap, M.G., and F.J. Leij, 1998. Database Related Accuracy and Uncertainty of Pedotransfer Functions, Soil Science 163:765-779.
Schaap, M.G., F.J. Leij and M. Th. van Genuchten. 1999. A bootstrap-neural network approach to predict soil hydraulic parameters. In: van Genuchten, M.Th., F.J. Leij, and L. Wu (eds), Proc. Int. Workshop, Characterization and Measurements of the Hydraulic Properties of Unsaturated Porous Media, pp 1237-1250, University of California, Riverside, CA.
Schaap, M.G., F.J. Leij, 1999, Improved prediction of unsaturated hydraulic conductivity with the Mualem-van Genuchten, Submitted to Soil Sci. Soc. Am. J.
van Genuchten, M.Th. 1980. A closed-form equation for predicting the hydraulic conductivity of unsaturated soils. Soil Sci. Am. J. 44:892-898.
Schaap, M.G., F.J. Leij, and M.Th. van Genuchten. 2001. ROSETTA: a computer program for estimating soil hydraulic parameters with hierarchical pedotransfer functions. Journal of Hydrology 251(3-4): 163-176. doi: doi:10.1016/S0022-1694(01)00466-8.
Schaap, M.G., A. Nemes, and M.T. van Genuchten. 2004. Comparison of Models for Indirect Estimation of Water Retention and Available Water in Surface Soils. Vadose Zone Journal 3(4): 1455-1463. doi: doi:10.2136/vzj2004.1455.
Zhang, Y., and M.G. Schaap. 2017. Weighted recalibration of the Rosetta pedotransfer model with improved estimates of hydraulic parameter distributions and summary statistics (Rosetta3). Journal of Hydrology 547: 39-53. doi: doi:10.1016/j.jhydrol.2017.01.004.
These metadata are a work in progress.
A data.frame
with 1186 SCAN, CSCAN, SNOTEL, and SNOWLITE station metadata records
Submit a query to the Soil Data Access (SDA) REST/JSON web-service and return the results as a data.frame. There is a 100,000 record and 32Mb JSON serialization limit per query. Queries should contain a WHERE clause or JOIN condition to limit the number of rows affected / returned. Consider wrapping calls to SDA_query()
in a function that can iterate over logical chunks (e.g. areasymbol, mukey, cokey, etc.). The function makeChunks()
can help with such iteration. All usages of SDA_query()
should handle the possibility of a try-error
result in case the web service connection is down or if an invalid query is passed to the endpoint.
SDA_query(q, dsn = NULL)
SDA_query(q, dsn = NULL)
q |
character. A valid T-SQL query surrounded by double quotes. |
dsn |
character. Default: |
The SDA website can be found at https://sdmdataaccess.nrcs.usda.gov and query examples can be found at https://sdmdataaccess.nrcs.usda.gov/QueryHelp.aspx. A library of query examples can be found at https://nasis.sc.egov.usda.gov/NasisReportsWebSite/limsreport.aspx?report_name=SDA-SQL_Library_Home.
SSURGO (detailed soil survey) and STATSGO (generalized soil survey) data are stored together within SDA. This means that queries that don't specify an area symbol may result in a mixture of SSURGO and STATSGO records. See the examples below and the SDA Tutorial for details.
A data.frame result for queries that return a single table. A list of data.frame for queries that return multiple tables. NULL
if result is empty, and try-error
on error.
This function requires the httr
, jsonlite
, and xml2
packages
D.E. Beaudette, A.G Brown
## get SSURGO export date for all soil survey areas in California # there is no need to filter STATSGO # because we are filtering on SSURGO area symbols q <- "SELECT areasymbol, saverest FROM sacatalog WHERE areasymbol LIKE 'CA%';" x <- SDA_query(q) head(x) ## get SSURGO component data associated with the ## Amador series / major component only # this query must explicitly filter out STATSGO data q <- "SELECT cokey, compname, comppct_r FROM legend INNER JOIN mapunit mu ON mu.lkey = legend.lkey INNER JOIN component co ON mu.mukey = co.mukey WHERE legend.areasymbol != 'US' AND compname = 'Amador';" res <- SDA_query(q) str(res) ## get component-level data for a specific soil survey area (Yolo county, CA) # there is no need to filter STATSGO because the query contains # an implicit selection of SSURGO data by areasymbol q <- "SELECT component.mukey, cokey, comppct_r, compname, taxclname, taxorder, taxsuborder, taxgrtgroup, taxsubgrp FROM legend INNER JOIN mapunit ON mapunit.lkey = legend.lkey LEFT OUTER JOIN component ON component.mukey = mapunit.mukey WHERE legend.areasymbol = 'CA113' ;" res <- SDA_query(q) str(res) ## get tabular data based on result from spatial query # there is no need to filter STATSGO because # SDA_Get_Mukey_from_intersection_with_WktWgs84() implies SSURGO p <- wk::as_wkt(wk::rct(-120.9, 37.7, -120.8, 37.8)) q <- paste0("SELECT mukey, cokey, compname, comppct_r FROM component WHERE mukey IN (SELECT DISTINCT mukey FROM SDA_Get_Mukey_from_intersection_with_WktWgs84('", p, "')) ORDER BY mukey, cokey, comppct_r DESC") x <- SDA_query(q) str(x)
## get SSURGO export date for all soil survey areas in California # there is no need to filter STATSGO # because we are filtering on SSURGO area symbols q <- "SELECT areasymbol, saverest FROM sacatalog WHERE areasymbol LIKE 'CA%';" x <- SDA_query(q) head(x) ## get SSURGO component data associated with the ## Amador series / major component only # this query must explicitly filter out STATSGO data q <- "SELECT cokey, compname, comppct_r FROM legend INNER JOIN mapunit mu ON mu.lkey = legend.lkey INNER JOIN component co ON mu.mukey = co.mukey WHERE legend.areasymbol != 'US' AND compname = 'Amador';" res <- SDA_query(q) str(res) ## get component-level data for a specific soil survey area (Yolo county, CA) # there is no need to filter STATSGO because the query contains # an implicit selection of SSURGO data by areasymbol q <- "SELECT component.mukey, cokey, comppct_r, compname, taxclname, taxorder, taxsuborder, taxgrtgroup, taxsubgrp FROM legend INNER JOIN mapunit ON mapunit.lkey = legend.lkey LEFT OUTER JOIN component ON component.mukey = mapunit.mukey WHERE legend.areasymbol = 'CA113' ;" res <- SDA_query(q) str(res) ## get tabular data based on result from spatial query # there is no need to filter STATSGO because # SDA_Get_Mukey_from_intersection_with_WktWgs84() implies SSURGO p <- wk::as_wkt(wk::rct(-120.9, 37.7, -120.8, 37.8)) q <- paste0("SELECT mukey, cokey, compname, comppct_r FROM component WHERE mukey IN (SELECT DISTINCT mukey FROM SDA_Get_Mukey_from_intersection_with_WktWgs84('", p, "')) ORDER BY mukey, cokey, comppct_r DESC") x <- SDA_query(q) str(x)
Query SDA (SSURGO / STATSGO) records via spatial intersection with supplied geometries. Input can be SpatialPoints, SpatialLines, or SpatialPolygons objects with a valid CRS. Map unit keys, overlapping polygons, or the spatial intersection of geom
+ SSURGO / STATSGO polygons can be returned. See details.
SDA_spatialQuery( geom, what = "mukey", geomIntersection = FALSE, geomAcres = TRUE, db = c("SSURGO", "STATSGO", "SAPOLYGON"), byFeature = FALSE, idcol = "gid", query_string = FALSE, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
SDA_spatialQuery( geom, what = "mukey", geomIntersection = FALSE, geomAcres = TRUE, db = c("SSURGO", "STATSGO", "SAPOLYGON"), byFeature = FALSE, idcol = "gid", query_string = FALSE, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
geom |
an |
what |
a character vector specifying what to return. |
geomIntersection |
logical; |
geomAcres |
logical; |
db |
a character vector identifying the Soil Geographic Databases ( |
byFeature |
Iterate over features, returning a combined data.frame where each feature is uniquely identified by value in |
idcol |
Unique IDs used for individual features when |
query_string |
Default: |
as_Spatial |
Return sp classes? e.g. |
Queries for map unit keys are always more efficient vs. queries for overlapping or intersecting (i.e. least efficient) features. geom
is converted to GCS / WGS84 as needed. Map unit keys are always returned when using what = "mupolygon"
.
SSURGO (detailed soil survey, typically 1:24,000 scale) and STATSGO (generalized soil survey, 1:250,000 scale) data are stored together within SDA. This means that queries that don't specify an area symbol may result in a mixture of SSURGO and STATSGO records. See the examples below and the SDA Tutorial for details.
A data.frame
if what = 'mukey'
, otherwise an sf
object. A try-error
in the event the request cannot be made or if there is an error in the query.
Row-order is not preserved across features in geom
and returned object. Use byFeature
argument to iterate over features and return results that are 1:1 with the inputs. Polygon area in acres is computed server-side when what = 'mupolygon'
and geomIntersection = TRUE
.
D.E. Beaudette, A.G. Brown, D.R. Schlaepfer
## Not run: if (requireNamespace("aqp") && requireNamespace("sf")) { library(aqp) library(sf) ## query at a point # example point p <- sf::st_as_sf(data.frame(x = -119.72330, y = 36.92204), coords = c('x', 'y'), crs = 4326) # query map unit records at this point res <- SDA_spatialQuery(p, what = 'mukey') # convert results into an SQL "IN" statement # useful when there are multiple intersecting records mu.is <- format_SQL_in_statement(res$mukey) # composite SQL WHERE clause sql <- sprintf("mukey IN %s", mu.is) # get commonly used map unit / component / chorizon records # as a SoilProfileCollection object # request that results contain `mukey` with `duplicates = TRUE` x <- fetchSDA(sql, duplicates = TRUE) # safely set texture class factor levels # by making a copy of this column # this will save in lieu of textures in the original # `texture` column horizons(x)$texture.class <- factor(x$texture, levels = SoilTextureLevels()) # graphical depiction of the result plotSPC(x, color = 'texture.class', label = 'compname', name = 'hzname', cex.names = 1, width = 0.25, plot.depth.axis = FALSE, hz.depths = TRUE, name.style = 'center-center') ## query mukey + geometry that intersect with a bounding box # define a bounding box: xmin, xmax, ymin, ymax # # +-------------------(ymax, xmax) # | | # | | # (ymin, xmin) ----------------+ b <- c(-119.747629, -119.67935, 36.912019, 36.944987) # convert bounding box to WKT bbox.sp <- sf::st_as_sf(wk::rct( xmin = b[1], xmax = b[2], ymin = b[3], ymax = b[4], crs = sf::st_crs(4326) )) # results contain associated map unit keys (mukey) # return SSURGO polygons, after intersection with provided BBOX ssurgo.geom <- SDA_spatialQuery( bbox.sp, what = 'mupolygon', db = 'SSURGO', geomIntersection = TRUE ) # return STATSGO polygons, after intersection with provided BBOX statsgo.geom <- SDA_spatialQuery( bbox.sp, what = 'mupolygon', db = 'STATSGO', geomIntersection = TRUE ) # inspect results par(mar = c(0,0,3,1)) plot(sf::st_geometry(ssurgo.geom), border = 'royalblue') plot(sf::st_geometry(statsgo.geom), lwd = 2, border = 'firebrick', add = TRUE) plot(sf::st_geometry(bbox.sp), lwd = 3, add = TRUE) legend( x = 'topright', legend = c('BBOX', 'STATSGO', 'SSURGO'), lwd = c(3, 2, 1), col = c('black', 'firebrick', 'royalblue'), ) # quick reminder that STATSGO map units often contain many components # format an SQL IN statement using the first STATSGO mukey mu.is <- format_SQL_in_statement(statsgo.geom$mukey[1]) # composite SQL WHERE clause sql <- sprintf("mukey IN %s", mu.is) # get commonly used map unit / component / chorizon records # as a SoilProfileCollection object x <- fetchSDA(sql) # tighter figure margins par(mar = c(0,0,3,1)) # organize component sketches by national map unit symbol # color horizons via awc # adjust legend title # add alternate label (vertical text) containing component percent # move horizon names into the profile sketches # make profiles wider aqp::groupedProfilePlot(x, groups = 'nationalmusym', label = 'compname', color = 'awc_r', col.label = 'Available Water Holding Capacity (cm / cm)', alt.label = 'comppct_r', name.style = 'center-center', width = 0.3 ) mtext( 'STATSGO (1:250,000) map units contain a lot of components!', side = 1, adj = 0, line = -1.5, at = 0.25, font = 4 ) } ## End(Not run)
## Not run: if (requireNamespace("aqp") && requireNamespace("sf")) { library(aqp) library(sf) ## query at a point # example point p <- sf::st_as_sf(data.frame(x = -119.72330, y = 36.92204), coords = c('x', 'y'), crs = 4326) # query map unit records at this point res <- SDA_spatialQuery(p, what = 'mukey') # convert results into an SQL "IN" statement # useful when there are multiple intersecting records mu.is <- format_SQL_in_statement(res$mukey) # composite SQL WHERE clause sql <- sprintf("mukey IN %s", mu.is) # get commonly used map unit / component / chorizon records # as a SoilProfileCollection object # request that results contain `mukey` with `duplicates = TRUE` x <- fetchSDA(sql, duplicates = TRUE) # safely set texture class factor levels # by making a copy of this column # this will save in lieu of textures in the original # `texture` column horizons(x)$texture.class <- factor(x$texture, levels = SoilTextureLevels()) # graphical depiction of the result plotSPC(x, color = 'texture.class', label = 'compname', name = 'hzname', cex.names = 1, width = 0.25, plot.depth.axis = FALSE, hz.depths = TRUE, name.style = 'center-center') ## query mukey + geometry that intersect with a bounding box # define a bounding box: xmin, xmax, ymin, ymax # # +-------------------(ymax, xmax) # | | # | | # (ymin, xmin) ----------------+ b <- c(-119.747629, -119.67935, 36.912019, 36.944987) # convert bounding box to WKT bbox.sp <- sf::st_as_sf(wk::rct( xmin = b[1], xmax = b[2], ymin = b[3], ymax = b[4], crs = sf::st_crs(4326) )) # results contain associated map unit keys (mukey) # return SSURGO polygons, after intersection with provided BBOX ssurgo.geom <- SDA_spatialQuery( bbox.sp, what = 'mupolygon', db = 'SSURGO', geomIntersection = TRUE ) # return STATSGO polygons, after intersection with provided BBOX statsgo.geom <- SDA_spatialQuery( bbox.sp, what = 'mupolygon', db = 'STATSGO', geomIntersection = TRUE ) # inspect results par(mar = c(0,0,3,1)) plot(sf::st_geometry(ssurgo.geom), border = 'royalblue') plot(sf::st_geometry(statsgo.geom), lwd = 2, border = 'firebrick', add = TRUE) plot(sf::st_geometry(bbox.sp), lwd = 3, add = TRUE) legend( x = 'topright', legend = c('BBOX', 'STATSGO', 'SSURGO'), lwd = c(3, 2, 1), col = c('black', 'firebrick', 'royalblue'), ) # quick reminder that STATSGO map units often contain many components # format an SQL IN statement using the first STATSGO mukey mu.is <- format_SQL_in_statement(statsgo.geom$mukey[1]) # composite SQL WHERE clause sql <- sprintf("mukey IN %s", mu.is) # get commonly used map unit / component / chorizon records # as a SoilProfileCollection object x <- fetchSDA(sql) # tighter figure margins par(mar = c(0,0,3,1)) # organize component sketches by national map unit symbol # color horizons via awc # adjust legend title # add alternate label (vertical text) containing component percent # move horizon names into the profile sketches # make profiles wider aqp::groupedProfilePlot(x, groups = 'nationalmusym', label = 'compname', color = 'awc_r', col.label = 'Available Water Holding Capacity (cm / cm)', alt.label = 'comppct_r', name.style = 'center-center', width = 0.3 ) mtext( 'STATSGO (1:250,000) map units contain a lot of components!', side = 1, adj = 0, line = -1.5, at = 0.25, font = 4 ) } ## End(Not run)
This function downloads a generalized representations of a soil series extent from SoilWeb, derived from the current SSURGO snapshot. Data can be returned as vector outlines (sf
object) or gridded representation of area proportion falling within 800m cells (SpatRaster
object). Gridded series extent data are only available in CONUS. Vector representations are returned with a GCS/WGS84 coordinate reference system and raster representations are returned with an Albers Equal Area / NAD83 coordinate reference system (EPSG:5070
).
seriesExtent( s, type = c("vector", "raster"), timeout = 60, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
seriesExtent( s, type = c("vector", "raster"), timeout = 60, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
s |
a soil series name, case-insensitive |
type |
series extent representation, |
timeout |
time that we are willing to wait for a response, in seconds |
as_Spatial |
Return sp ( |
An R spatial object, class depending on type
and as_Spatial
arguments
D.E. Beaudette
https://casoilresource.lawr.ucdavis.edu/see/
## Not run: # specify a soil series name s <- 'magnor' # return an sf object x <- seriesExtent(s, type = 'vector') # return a terra SpatRasters y <- seriesExtent(s, type = 'raster') library(terra) if (!is.null(x) && !is.null(y)) { x <- terra::vect(x) # note that CRS are different terra::crs(x) terra::crs(y) # transform vector representation to CRS of raster x <- terra::project(x, terra::crs(y)) # graphical comparison par(mar = c(1, 1 , 1, 3)) plot(y, axes = FALSE) plot(x, add = TRUE) } ## End(Not run)
## Not run: # specify a soil series name s <- 'magnor' # return an sf object x <- seriesExtent(s, type = 'vector') # return a terra SpatRasters y <- seriesExtent(s, type = 'raster') library(terra) if (!is.null(x) && !is.null(y)) { x <- terra::vect(x) # note that CRS are different terra::crs(x) terra::crs(y) # transform vector representation to CRS of raster x <- terra::project(x, terra::crs(y)) # graphical comparison par(mar = c(1, 1 , 1, 3)) plot(y, axes = FALSE) plot(x, add = TRUE) } ## End(Not run)
Look up siblings and cousins for a given soil series from the current fiscal year SSURGO snapshot via SoilWeb.
The siblings of any given soil series are defined as those soil components (major and minor) that share a parent map unit with the named series (as a major component). Component names are filtered using a snapshot of the Soil Classification database to ensure that only valid soil series names are included. Cousins are siblings of siblings. Data are sourced from SoilWeb which maintains a copy of the current SSURGO snapshot. Visualizations of soil "siblings"-related concepts can be found in the "Sibling Summary" tab of Soil Data Explorer app: https://casoilresource.lawr.ucdavis.edu/sde/.
Additional resources:
siblings(s, only.major = FALSE, component.data = FALSE, cousins = FALSE)
siblings(s, only.major = FALSE, component.data = FALSE, cousins = FALSE)
s |
character vector, the name of a single soil series, case-insensitive. |
only.major |
logical, should only return siblings that are major components |
component.data |
logical, should component data for siblings (and optionally cousins) be returned? |
cousins |
logical, should siblings-of-siblings (cousins) be returned? |
A list
containing:
sib: data.frame
containing siblings, major component flag, and number of co-occurrences
sib.data: data.frame
containing sibling component data (only when component.data = TRUE
)
cousins: data.frame
containing cousins, major component flag, and number of co-occurrences (only when cousins = TRUE
)
cousin.data: data.frame
containing cousin component data (only when cousins = TRUE, component.data = TRUE
)
D.E. Beaudette
O'Geen, A., Walkinshaw, M. and Beaudette, D. (2017), SoilWeb: A Multifaceted Interface to Soil Survey Information. Soil Science Society of America Journal, 81: 853-862. doi:10.2136/sssaj2016.11.0386n
# basic usage x <- siblings('zook') x$sib # restrict to siblings that are major components # e.g. the most likely siblings x <- siblings('zook', only.major = TRUE) x$sib
# basic usage x <- siblings('zook') x$sib # restrict to siblings that are major components # e.g. the most likely siblings x <- siblings('zook', only.major = TRUE) x$sib
Simplify multiple coarse fraction (>2mm) records by horizon.
simplifyArtifactData( art, id.var, vol.var = "huartvol", nullFragsAreZero = nullFragsAreZero, ... ) simplifyFragmentData( rf, id.var, vol.var = "fragvol", prefix = "frag", nullFragsAreZero = TRUE, msg = "rock fragment volume", ... )
simplifyArtifactData( art, id.var, vol.var = "huartvol", nullFragsAreZero = nullFragsAreZero, ... ) simplifyFragmentData( rf, id.var, vol.var = "fragvol", prefix = "frag", nullFragsAreZero = TRUE, msg = "rock fragment volume", ... )
art |
a |
id.var |
character vector with the name of the column containing an ID
that is unique among all horizons in |
vol.var |
character vector with the name of the column containing the coarse fragment volume. Default |
nullFragsAreZero |
should fragment volumes of NULL be interpreted as 0? (default: |
... |
Additional arguments passed to sieving function (e.g. |
rf |
a |
prefix |
a character vector prefix for input |
msg |
Identifier of data being summarized. Default is |
This function is mainly intended for processing of NASIS pedon/component
data which contains multiple coarse fragment descriptions per horizon.
simplifyFragmentData
will "sieve out" coarse fragments into the USDA
classes, split into hard and para- fragments. Likewise, simplifyArtifactData
will sieve out human artifacts, and split total volume into "cohesive", "penetrable", "innocuous", and "persistent".
These functions can be applied to data sources other than NASIS by careful use of the id.var
and vol.var
arguments.
rf
must contain rock or other fragment volumes in the column "fragvol" (or be specified with vol.var
), fragment size (mm) in columns "fragsize_l", "fragsize_r", "fragsize_h", fragment cementation class in "fraghard" and flat/non-flat in "fragshp".
art
must contain artifact volumes in the column "huartvol" (or be specified with vol.var
), fragment size (mm) in columns "huartsize_l", "huartsize_r", "huartsize_h", artifact cementation class in "huarthard" and flat/non-flat in "huartshp".
Examples:
D.E. Beaudette, A.G Brown
Simplify multiple Munsell color observations associated with each horizon.
This function is mainly intended for the processing of NASIS pedon/horizon
data which may or may not contain multiple colors per horizon/moisture
status combination. simplifyColorData
will "mix" multiple colors
associated with horizons in d
, according to IDs specified by
id.var
, using "weights" (area percentages) specified by the wt
argument to mix_and_clean_colors
.
Note that this function doesn't actually simulate the mixture of pigments on a surface, rather, "mixing" is approximated via weighted average in the CIELAB colorspace.
The simplifyColorData
function can be applied to data sources other
than NASIS by careful use of the id.var
and wt
arguments.
However, d
must contain Munsell colors split into columns named
"colorhue", "colorvalue", and "colorchroma". In addition, the moisture state
("Dry" or "Moist") must be specified in a column named "colormoistst".
The mix_and_clean_colors
function can be applied to arbitrary data
sources as long as x
contains sRGB coordinates in columns named "r",
"g", and "b". This function should be applied to chunks of rows within which
color mixtures make sense.
Examples:
simplifyColorData(d, id.var = "phiid", wt = "colorpct", bt = FALSE)
simplifyColorData(d, id.var = "phiid", wt = "colorpct", bt = FALSE)
d |
a |
id.var |
character vector with the name of the column containing an ID
that is unique among all horizons in |
wt |
a character vector with the name of the column containing color weights for mixing |
bt |
logical, should the mixed sRGB representation of soil color be
transformed to closest Munsell chips? This is performed by |
D.E. Beaudette
Moist soil colors, 2022.
soilColor.wcs(aoi, var, res = 270, quiet = FALSE)
soilColor.wcs(aoi, var, res = 270, quiet = FALSE)
aoi |
area of interest (AOI) defined using a |
var |
soil color grid name (case insensitive), see details |
res |
grid resolution, units of meters, typically '270', or '30', depending on |
quiet |
logical, passed to |
aoi
should be specified as a SpatRaster
, Spatial*
, RasterLayer
, SpatRaster
/SpatVector
, sf
, sfc
, or bbox
object or a list
containing:
aoi
bounding-box specified as (xmin, ymin, xmax, ymax) e.g. c(-114.16, 47.65, -114.08, 47.68)
crs
coordinate reference system of BBOX, e.g. 'OGC:CRS84' (EPSG:4326, WGS84 Longitude/Latitude)
The WCS query is parameterized using a rectangular extent derived from the above AOI specification, after conversion to the native CRS (EPSG:5070) of the soil color grids.
Variables available from this WCS can be queried using WCS_details(wcs = 'soilColor')
. The full resolution version of the soil color grids use a hr
suffix, e.g. 'sc025cm_hr'.
A SpatRaster
(or RasterLayer
) object containing indexed map unit keys and associated raster attribute table or a try-error if request fails. By default, spatial classes from the terra
package are returned. If the input object class is from the raster
or sp
packages a RasterLayer
is returned.
D.E. Beaudette and A.G. Brown
## Not run: library(terra) # see WCS_details() for variable options WCS_details(wcs = 'soilColor') # moist soil color at 25cm, 270m version res <- soilColor.wcs(list(aoi = c(-116, 35, -115.5, 35.5), crs = "EPSG:4326"), var = 'sc025cm', res = 270) # note colors and other metadata are stored # in raster attribute table plot(res, col = cats(res)[[1]]$col, axes = FALSE, legend = FALSE) ## End(Not run)
## Not run: library(terra) # see WCS_details() for variable options WCS_details(wcs = 'soilColor') # moist soil color at 25cm, 270m version res <- soilColor.wcs(list(aoi = c(-116, 35, -115.5, 35.5), crs = "EPSG:4326"), var = 'sc025cm', res = 270) # note colors and other metadata are stored # in raster attribute table plot(res, col = cats(res)[[1]]$col, axes = FALSE, legend = FALSE) ## End(Not run)
The soilDB package uses an environment to store variables that are created as side effects of various data access and processing routines.
get_soilDB_env()
provides a method to access this environment from the global (user) environment.
soilDB.env get_soilDB_env()
soilDB.env get_soilDB_env()
An object of class environment
of length 0.
a environment
object
get_soilDB_env()
get_soilDB_env()
Get SSURGO Data via Spatial Query to SoilWeb
Data are currently available from SoilWeb. These data are a snapshot of the "official" data. The snapshot date is encoded in the "soilweb_last_update" column in the function return value. Planned updates to this function will include a switch to determine the data source: "official" data via USDA-NRCS servers, or a "snapshot" via SoilWeb.
SoilWeb_spatial_query( bbox = NULL, coords = NULL, what = "mapunit", source = "soilweb" )
SoilWeb_spatial_query( bbox = NULL, coords = NULL, what = "mapunit", source = "soilweb" )
bbox |
a bounding box in WGS84 geographic coordinates, see examples |
coords |
a coordinate pair in WGS84 geographic coordinates, see examples |
what |
data to query, currently ignored |
source |
the data source, currently ignored |
The data returned from this function will depend on the query style. See examples below.
SDA now supports spatial queries, consider using SDA_spatialQuery()
instead.
D.E. Beaudette
# query by bbox SoilWeb_spatial_query(bbox=c(-122.05, 37, -122, 37.05)) # query by coordinate pair SoilWeb_spatial_query(coords=c(-121, 38))
# query by bbox SoilWeb_spatial_query(bbox=c(-122.05, 37, -122, 37.05)) # query by coordinate pair SoilWeb_spatial_query(coords=c(-121, 38))
Graphical Description of US Soil Taxonomy Soil Temperature Regimes
STRplot(mast, msst, mwst, permafrost = FALSE, pt.cex = 2.75, leg.cex = 0.85)
STRplot(mast, msst, mwst, permafrost = FALSE, pt.cex = 2.75, leg.cex = 0.85)
mast |
single value or vector of mean annual soil temperature (deg C) |
msst |
single value or vector of mean summer soil temperature (deg C) |
mwst |
single value of mean winter soil temperature (deg C) |
permafrost |
logical: permafrost presence / absence |
pt.cex |
symbol size |
leg.cex |
legend size |
Soil Temperature Regime Evaluation Tutorial
D.E. Beaudette
Soil Survey Staff. 2015. Illustrated guide to soil taxonomy. U.S. Department of Agriculture, Natural Resources Conservation Service, National Soil Survey Center, Lincoln, Nebraska.
par(mar=c(4,1,0,1)) STRplot(mast = 0:25, msst = 10, mwst = 1)
par(mar=c(4,1,0,1)) STRplot(mast = 0:25, msst = 10, mwst = 1)
This function is a front-end to the REST query functionality of the Henry Mount Soil Temperature and Water Database.
summarizeSoilTemperature(soiltemp.data) month2season(x) fetchHenry( what = "all", usersiteid = NULL, project = NULL, sso = NULL, gran = "day", start.date = NULL, stop.date = NULL, pad.missing.days = TRUE, soiltemp.summaries = TRUE, tz = "" )
summarizeSoilTemperature(soiltemp.data) month2season(x) fetchHenry( what = "all", usersiteid = NULL, project = NULL, sso = NULL, gran = "day", start.date = NULL, stop.date = NULL, pad.missing.days = TRUE, soiltemp.summaries = TRUE, tz = "" )
soiltemp.data |
A |
x |
character vector containing month abbreviation e.g. |
what |
type of data to return: 'sensors': sensor metadata only | 'soiltemp': sensor metadata + soil temperature data | 'soilVWC': sensor metadata + soil moisture data | 'airtemp': sensor metadata + air temperature data | 'waterlevel': sensor metadata + water level data |'all': sensor metadata + all sensor data |
usersiteid |
(optional) filter results using a NASIS user site ID |
project |
(optional) filter results using a project ID |
sso |
(optional) filter results using a soil survey office code |
gran |
data granularity: "hour" (if available), "day", "week", "month", "year"; returned data are averages |
start.date |
(optional) starting date filter |
stop.date |
(optional) ending date filter |
pad.missing.days |
should missing data ("day" granularity) be filled with NA? see details |
soiltemp.summaries |
should soil temperature ("day" granularity only) be summarized? see details |
tz |
Used for custom timezone. Default |
Filling missing days with NA is useful for computing and index of how complete the data are, and for estimating (mostly) unbiased MAST and seasonal mean soil temperatures. Summaries are computed by first averaging over Julian day, then averaging over all days of the year (MAST) or just those days that occur within "summer" or "winter". This approach makes it possible to estimate summaries in the presence of missing data. The quality of summaries should be weighted by the number of "functional years" (number of years with non-missing data after combining data by Julian day) and "complete years" (number of years of data with >= 365 days of non-missing data).
See:
a list containing:
sensors |
a |
soiltemp |
a
|
soilVWC |
a |
airtemp |
a |
waterlevel |
a |
This function and the back-end database are very much a work in progress.
D.E. Beaudette
This function downloads a generalized representation of the geographic extent of any single taxon from the top 4 levels of Soil Taxonomy, or taxa matching a given formative element used in Great Group or subgroup taxa. Data are provided by SoilWeb, ultimately sourced from the current SSURGO snapshot. Data are returned as raster
objects representing area proportion falling within 800m cells. Currently area proportions are based on major components only. Data are only available in CONUS and returned using an Albers Equal Area / NAD83(2011) coordinate reference system (EPSG: 5070).
taxaExtent( x, level = c("order", "suborder", "greatgroup", "subgroup"), formativeElement = FALSE, timeout = 60, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
taxaExtent( x, level = c("order", "suborder", "greatgroup", "subgroup"), formativeElement = FALSE, timeout = 60, as_Spatial = getOption("soilDB.return_Spatial", default = FALSE) )
x |
single taxon label (e.g. |
level |
the taxonomic level within the top 4 tiers of Soil Taxonomy, one of |
formativeElement |
logical, search using formative elements instead of taxon label |
timeout |
time that we are willing to wait for a response, in seconds |
as_Spatial |
Return raster ( |
See the Geographic Extent of Soil Taxa tutorial for more detailed examples.
Taxon labels can be conveniently extracted from the "ST_unique_list"
sample data, provided by the SoilTaxonomy package.
The following labels are used to access taxa containing the following formative elements (in parentheses)
acr: (acro/acr) extreme weathering
alb: (alb) presence of an albic horizon
anhy: (anhy) very dry
anthra: (anthra) presence of an anthropic epipedon
aqu: (aqui/aqu) wetness
argi: (argi) presence of an argillic horizon
calci: (calci) presence of a calcic horizon
cry: (cryo/cry) cryic STR
dur: (duri/dur) presence of a duripan
dystr: (dystro/dystr) low base saturation
endo: (endo) ground water table
epi: (epi) perched water table
eutr: (eutro/eutr) high base saturation
ferr: (ferr) presence of Fe
fibr: (fibr) least decomposed stage
fluv: (fluv) flood plain
fol: (fol) mass of leaves
fragi: (fragi) presence of a fragipan
fragloss: (fragloss) presence of a fragipan and glossic horizon
frasi: (frasi) not salty
fulv: (fulvi/fulv) dark brown with organic carbon
glac: (glac) presence of ice lenses
gloss: (glosso/gloss) presence of a glossic horizon
gypsi: (gypsi) presence of a gypsic horizon
hal: (hal) salty
hemi: (hemi) intermediate decomposition
hist: (histo/hist) organic soil material
hum: (humi/hum) presence of organic carbon
hydr: (hydro/hydr) presence of water
kandi: (kandi) presence of a kandic horizon
kanhap: (kanhaplo/kanhap) thin kandic horizon
luvi: (luvi) illuvial organic material
melan: (melano/melan) presence of a melanic epipedon
moll: (molli/moll) presence of a mollic epipedon
natr: (natri/natr) presence of a natric horizon
pale: (pale) excessive development
petr: (petro/petr) petrocalcic horizon
plac: (plac) presence of a thin pan
plagg: (plagg) presence of a plaggen epipedon
plinth: (plinth) presence of plinthite
psamm: (psammo/psamm) sandy texture
quartzi: (quartzi) high quartz content
rhod: (rhodo/rhod) dark red colors
sal: (sali/sal) presence of a salic horizon
sapr: (sapr) most decomposed stage
sombri: (sombri) presence of a sombric horizon
sphagno: (sphagno) presence of sphagnum moss
sulf: (sulfo/sulfi/sulf) presence of sulfides or their oxidation products
torri: (torri) torric/aridic SMR
ud: (udi/ud) udic SMR
umbr: (umbri/umbr) presence of an umbric epipedon
ust: (usti/ust) ustic SMR
verm: (verm) wormy, or mixed by animals
vitr: (vitri/vitr) presence of glass
xer: (xero/xer) xeric SMR
The following labels are used to access taxa containing the following formative elements (in parenthesis).
abruptic: (abruptic) abrupt textural change
acric: (acric) low apparent CEC
aeric: (aeric) more aeration than typic subgroup
albaquic: (albaquic) presence of albic minerals, wetter than typic subgroup
albic: (albic) presence of albic minerals
alfic: (alfic) presence of an argillic or kandic horizon
alic: (alic) high extractable Al content
anionic: (anionic) low CEC or positively charged
anthraquic: (anthraquic) human controlled flooding as in paddy rice culture
anthropic: (anthropic) an anthropic epipedon
aquic: (aquic) wetter than typic subgroup
arenic: (arenic) 50-100cm sandy textured surface
argic: (argic) argillic horizon
aridic: (aridic) more aridic than typic subgroup
calcic: (calcic) presence of a calcic horizon
chromic: (chromic) high chroma colors
cumulic: (cumulic) thickened epipedon
duric: (duric) presence of a duripan
durinodic: (durinodic) presence of durinodes
dystric: (dystric) lower base saturation percentage
entic: (entic) minimal surface/subsurface development
eutric: (eutric) higher base saturation percentage
fibric: (fibric) >25cm of fibric material
fluvaquentic: (fluvaquentic) wetter than typic subgroup, evidence of stratification
fragiaquic: (fragiaquic) presence of fragic properties, wetter than typic subgroup
fragic: (fragic) presence of fragic properties
glacic: (glacic) presence of ice lenses or wedges
glossaquic: (glossaquic) interfingered horizon boundaries, wetter than typic subgroup
glossic: (glossic) interfingered horizon boundaries
grossarenic: (grossarenic) >100cm sandy textured surface
gypsic: (gypsic) presence of gypsic horizon
halic: (halic) salty
haplic: (haplic) central theme of subgroup concept
hemic: (hemic) >25cm of hemic organic material
humic: (humic) higher organic matter content
hydric: (hydric) presence of water
kandic: (kandic) low activity clay present
lamellic: (lamellic) presence of lamellae
leptic: (leptic) thinner than typic subgroup
limnic: (limnic) presence of a limnic layer
lithic: (lithic) shallow lithic contact present
natric: (natric) presence of sodium
nitric: (nitric) presence of nitrate salts
ombroaquic: (ombroaquic) surface wetness
oxyaquic: (oxyaquic) water saturated but not reduced
pachic: (pachic) epipedon thicker than typic subgroup
petrocalcic: (petrocalcic) presence of a petrocalcic horizon
petroferric: (petroferric) presence of petroferric contact
petrogypsic: (petrogypsic) presence of a petrogypsic horizon
petronodic: (petronodic) presence of concretions and/or nodules
placic: (placic) presence of a placic horizon
plinthic: (plinthic) presence of plinthite
rhodic: (rhodic) darker red colors than typic subgroup
ruptic: (ruptic) intermittent horizon
salic: (salic) presence of a salic horizon
sapric: (sapric) >25cm of sapric organic material
sodic: (sodic) high exchangeable Na content
sombric: (sombric) presence of a sombric horizon
sphagnic: (sphagnic) sphagnum organic material
sulfic: (sulfic) presence of sulfides
terric: (terric) mineral substratum within 1 meter
thapto: (thaptic/thapto) presence of a buried soil horizon
turbic: (turbic) evidence of cryoturbation
udic: (udic) more humid than typic subgroup
umbric: (umbric) presence of an umbric epipedon
ustic: (ustic) more ustic than typic subgroup
vermic: (vermic) animal mixed material
vitric: (vitric) presence of glassy material
xanthic: (xanthic) more yellow than typic subgroup
xeric: (xeric) more xeric than typic subgroup
a SpatRaster
object (or RasterLayer
when as_Spatial=TRUE
)
D.E. Beaudette and A.G. Brown
## Not run: library(terra) # soil order taxa <- 'vertisols' x <- taxaExtent(taxa, level = 'order') # suborder taxa <- 'ustalfs' x <- taxaExtent(taxa, level = 'suborder') # greatgroup taxa <- 'haplohumults' x <- taxaExtent(taxa, level = 'greatgroup') # subgroup taxa <- 'Typic Haploxerepts' x <- taxaExtent(taxa, level = 'subgroup') # greatgroup formative element taxa <- 'psamm' x <- taxaExtent(taxa, level = 'greatgroup', formativeElement = TRUE) # subgroup formative element taxa <- 'abruptic' x <- taxaExtent(taxa, level = 'subgroup', formativeElement = TRUE) # coarsen for faster plotting a <- terra::aggregate(x, fact = 5, na.rm = TRUE) # quick evaluation of the result terra::plot(a, axes = FALSE) ## End(Not run)
## Not run: library(terra) # soil order taxa <- 'vertisols' x <- taxaExtent(taxa, level = 'order') # suborder taxa <- 'ustalfs' x <- taxaExtent(taxa, level = 'suborder') # greatgroup taxa <- 'haplohumults' x <- taxaExtent(taxa, level = 'greatgroup') # subgroup taxa <- 'Typic Haploxerepts' x <- taxaExtent(taxa, level = 'subgroup') # greatgroup formative element taxa <- 'psamm' x <- taxaExtent(taxa, level = 'greatgroup', formativeElement = TRUE) # subgroup formative element taxa <- 'abruptic' x <- taxaExtent(taxa, level = 'subgroup', formativeElement = TRUE) # coarsen for faster plotting a <- terra::aggregate(x, fact = 5, na.rm = TRUE) # quick evaluation of the result terra::plot(a, axes = FALSE) ## End(Not run)
These functions convert the coded values returned from NASIS or SDA to factors (e.g. 1 = Alfisols) using the metadata tables from NASIS. For SDA the metadata is pulled from a static snapshot in the soilDB package (/data/metadata.rda).
uncode( df, invert = FALSE, db = "NASIS", droplevels = FALSE, stringsAsFactors = NULL, dsn = NULL ) code(df, db = NULL, droplevels = FALSE, stringsAsFactors = NULL, dsn = NULL)
uncode( df, invert = FALSE, db = "NASIS", droplevels = FALSE, stringsAsFactors = NULL, dsn = NULL ) code(df, db = NULL, droplevels = FALSE, stringsAsFactors = NULL, dsn = NULL)
df |
data.frame |
invert |
converts the code labels back to their coded values ( |
db |
label specifying the soil database the data is coming from, which indicates whether or not to query metadata from local NASIS database ("NASIS") or use soilDB-local snapshot ("LIMS" or "SDA") |
droplevels |
logical: indicating whether to drop unused levels in classifying factors. This is useful when a class has large number of unused classes, which can waste space in tables and figures. |
stringsAsFactors |
deprecated |
dsn |
Optional: path to local SQLite database containing NASIS
table structure; default: |
These functions convert the coded values returned from NASIS into their plain text representation. It duplicates the functionality of the CODELABEL function found in NASIS. This function is primarily intended to be used internally by other soilDB R functions, in order to minimize the need to manually convert values.
The function works by iterating through the column names in a data frame and looking up whether they match any of the ColumnPhysicalNames found in the metadata domain tables. If matches are found then the columns coded values are converted to their corresponding factor levels. Therefore it is not advisable to reuse column names from NASIS unless the contents match the range of values and format found in NASIS. Otherwise uncode() will convert their values to NA.
When data is being imported from NASIS, the metadata tables are sourced directly from NASIS. When data is being imported from SDA or the NASIS Web Reports, the metadata is pulled from a static snapshot in the soilDB package.
Set options(soilDB.NASIS.skip_uncode = TRUE)
to bypass decoding logic; for instance when using soilDB NASIS functions with custom NASIS snapshots that have already been decoded.
A data.frame
with the results.
Stephen Roecker
# convert column name `fraghard` (fragment hardness) codes to labels uncode(data.frame(fraghard = 1:10)) # convert column name `fragshp` (fragment shape) labels to codes code(data.frame(fragshp = c("flat", "nonflat")))
# convert column name `fraghard` (fragment hardness) codes to labels uncode(data.frame(fraghard = 1:10)) # convert column name `fragshp` (fragment shape) labels to codes code(data.frame(fragshp = c("flat", "nonflat")))
This dataset contains the years of each US Soil Survey was published.
A data.frame with 5209 observations on the following 5 variables.
"ssa"
: Soil Survey name, a character vector
"year"
: Year of publication, a numeric vector
"pdf"
: Does a manuscript PDF document exist? a logical vector
"state"
: State abbreviation, a character vector
This data was web scraped from the NRCS Soils Website. The scraping procedure and a example plot are included in the examples section below.
https://www.nrcs.usda.gov/wps/portal/nrcs/soilsurvey/soils/survey/state/
Compute "water" day and year, based on the end of the typical or legal dry season. This is September 30 in California.
waterDayYear(d, end = "09-30", format = "%Y-%m-%d", tz = "UTC")
waterDayYear(d, end = "09-30", format = "%Y-%m-%d", tz = "UTC")
d |
anything the can be safely converted to |
end |
"MM-DD" notation for end of water year |
format |
Used in POSIXlt conversion. Default |
tz |
Used in POSIXlt conversion for custom timezone. Default is |
This function doesn't know about leap-years. Probably worth checking.
A data.frame
object with the following
wy |
the "water year" |
wd |
the "water day" |
D.E. Beaudette
# try it waterDayYear('2019-01-01')
# try it waterDayYear('2019-01-01')
List variables or databases provided by soilDB web coverage service (WCS) abstraction. These lists will be expanded in future versions.
WCS_details(wcs = c("mukey", "ISSR800", "soilColor"))
WCS_details(wcs = c("mukey", "ISSR800", "soilColor"))
wcs |
a WCS label ('mukey', 'ISSR800', or 'soilColor') |
a data.frame
WCS_details(wcs = 'ISSR800')
WCS_details(wcs = 'ISSR800')