Data Summaries

Submitted by dylan on Fri, 2007-09-28 20:39.

 
Notes

  • ...

 
Lab Textures

The lab texture (sand, silt, clay fractions) is visualized below on the soil texture triangle. Texture classes as reported in the Soil Veg database are used to color the symbols. Note that there are some cases where mistakes in the lab texture class results in multiple colors per texture class (on the triangle), or in colors from one class "mixing" into other classes (on the triangle).

 
Sample R Code


##
library(plotrix)
library(Rdbi)
library(RdbiPgSQL)
library(Cairo)
##
conn <- dbConnect(PgSQL(), host="localhost", dbname="xxx", user="xxx")
## only select horizons with valid textures
## sand + silt + clay = 100
##
##
query <- dbSendQuery(conn, "SELECT validation_status.pedon_id, a.hz_name, a.hz_top, a.hz_bottom, a.sand, a.silt, a.coarse_clay as clay ,  (a.sand + a.silt + a.coarse_clay) as ssc, a.lab_texture from validation_status join chemical as a on validation_status.pedon_id = a.pedon_id where validation_status.validated = 't' and a.sand is not NULL and a.silt is not NULL and a.coarse_clay is not NULL and a.hz_top is not NULL and lab_texture is not NULL order by validation_status.pedon_id, a.hz_top asc ;" )
## fetch results
x <- dbGetResult(query)
## only results with valid textures
x <- subset(x, subset=ssc == 100)
## make a list of colors:
cols <- t(col2rgb(as.numeric(factor(x$lab_texture)), alpha=TRUE))
## plot results to png file:
Cairo(type='png', file='texture_test.png', bg='white', width=600, height=600)
## make triangle
soil.texture(x[,5:7], show.lines=T, show.names=T, col.symbol=rgb(cols[,1], cols[,2], cols[,3], alpha=150, max=255), pch=16, cex=0.75, main=paste("Soil Veg Summary", length(unique(x$pedon_id)), "pedons", length(x$pedon_id), "horizons"))
## close output device
dev.off()
 

 
Horizons per Day


SELECT count(horizon_id) AS horizons_per_day, extract(doy FROM modification_date) AS doy
FROM validation_status JOIN chemical
ON validation_status.pedon_id = chemical.pedon_id
GROUP BY doy
ORDER BY doy;
 

horizons_per_day doy
334 127
139 270
41 271
63 274
88 275
128 278
136 281
91 282
114 283
157 284
29 285
132 288
62 289
74 290
86 291
60 292
62 295
107 297
99 298
130 299
140 302
122 303
92 304
139 305
26 306
9 315
51 316

(27 rows)


( categories: | )