Skip to content

Commit 79b64a4

Browse files
committed
get_site_data_from_NASIS_db: add obs_date to alias deprecation
warning, fix `site_id` alias
1 parent 74d72a4 commit 79b64a4

5 files changed

+8
-2
lines changed

R/get_site_data_from_NASIS_db.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ get_site_data_from_NASIS_db <- function(SS = TRUE,
4545
.soilDB_warn_deprecated_aliases(
4646
c(
4747
"upedonid" = "pedon_id",
48+
"obs_date" = "obsdate",
4849
"longstddecimaldegrees" = "x_std",
4950
"latstddecimaldegrees" = "y_std",
5051
"descname" = "describer",
@@ -61,9 +62,9 @@ get_site_data_from_NASIS_db <- function(SS = TRUE,
6162
NASISDomainsAsFactor(stringsAsFactors)
6263
}
6364

64-
q <- paste0("SELECT siteiid, siteobsiid, usiteid,
65+
q <- paste0("SELECT siteiid, siteobsiid, usiteid, usiteid AS site_id,
6566
", ifelse(include_pedon, "peiid, CAST(upedonid AS varchar(60)) as pedon_id, upedonid, ", ""), "
66-
obsdate, utmzone, utmeasting, utmnorthing, horizdatnm,
67+
obsdate, obsdate AS obs_date, utmzone, utmeasting, utmnorthing, horizdatnm,
6768
longstddecimaldegrees, latstddecimaldegrees, gpspositionalerror,
6869
", ifelse(include_pedon, "descname AS describer, descname, pedonpurpose, pedontype, pedlabsampnum, labdatadescflag,
6970
tsectstopnum, tsectinterval, utransectid, tsectkind, tsectselmeth, erocl,", ""), "

data-raw/NASIS_SoilProfileCollections.R

+5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ write.csv(restrictions(p), "data-raw/spc-restrictions.csv", row.names = FALSE)
2020

2121
recent1822a <- read.csv("data-raw/spc-horizons.csv")
2222
depths(recent1822a) <- peiid ~ hzdept + hzdepb
23+
2324
site(recent1822a) <- read.csv("data-raw/spc-site.csv")
2425
diagnostic_hz(recent1822a) <- read.csv("data-raw/spc-diagnostic_hz.csv")
2526
restrictions(recent1822a) <- read.csv("data-raw/spc-restrictions.csv")
2627

28+
# TODO: PATCH for obs_date
29+
# recent1822a$obs_date <- recent1822a$obsdate
30+
# recent1822a$site_id <- recent1822a$usiteid
31+
2732
# ensure that phiid is set as hzID
2833
hzidname(recent1822a) <- "phiid"
2934
hzdesgnname(recent1822a) <- "hzname"

data/gopheridge.rda

16 Bytes
Binary file not shown.

data/loafercreek.rda

60 Bytes
Binary file not shown.

data/mineralKing.rda

12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)