fetchNASIS: Fetch commonly used site/pedon/horizon or component data from...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/fetchNASIS.R

Description

Fetch commonly used site/pedon/horizon data or component from a local NASIS database, return as a SoilProfileCollection object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
fetchNASIS(from = 'pedons', ...)

fetchNASIS_pedons(SS=TRUE, rmHzErrors=TRUE, nullFragsAreZero=TRUE, 
                  soilColorState='moist', lab=FALSE, 
                  stringsAsFactors = default.stringsAsFactors()
                  )
fetchNASIS_components(SS=TRUE, rmHzErrors=TRUE, fill = FALSE, 
                      stringsAsFactors = default.stringsAsFactors()
                      )
getHzErrorsNASIS(strict=TRUE)

Arguments

from

determines what objects should fetched? ('pedons' | 'components')

...

arguments passed to fetchNASIS_pedons() or fetchNASIS_components()

SS

fetch data from the currently loaded selected set in NASIS or from the entire local database (default: TRUE)

stringsAsFactors

logical: should character vectors be converted to factors? This argument is passed to the uncode() function. It does not convert those vectors that have been set outside of uncode() (i.e. hard coded). The 'factory-fresh' default is TRUE, but this can be changed by setting options(stringsAsFactors = FALSE)

rmHzErrors

should pedons with horizonation errors be removed from the results? (default: TRUE)

nullFragsAreZero

should fragment volumes of NULL be interpreted as 0? (default: TRUE), see details

soilColorState

which colors should be used to generate the convenience field 'soil_color'? ('moist' | 'dry')

lab

should the phlabresults child table be fetched with site/pedon/horizon data (default: FALSE)

fill

toggle inclusion of components that are missing horizon data (FALSE)

strict

how strict should horizon boundaries be checked for consistency: TRUE=more | FALSE=less

Details

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 interpretated as NULLs. 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. Pedons that are missing horizon data, or have errors in their horizonation are excluded from the returned object, however, their IDs 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.

See getHzErrorsNASIS for a simple approach to identifying pedons with problematic horizonation.

See the NASIS component tutorial, and NASIS pedon tutorial for more information.

Value

a SoilProfileCollection class object

Note

This function currently works only on Windows, and requires a 'nasis_local' ODBC connection.

Author(s)

D. E. Beaudette and J. M. Skovlin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# query depends on some pedon data, queried against the national database
# note that you must setup this connection ahead of time
f <- fetchNASIS(from = 'pedons')

# plot only those profiles with densic contact
plot(f[which(f$densic.contact), ], name='hzname')

# get basic component data from local NASIS, after performing a 
# DMU-* query against the national database
fc <- fetchNASIS(from = 'components')

## End(Not run)

soilDB documentation built on Nov. 19, 2018, 5:06 p.m.