ncss-tech / SoilKnowledgeBase

Unified descriptions and structures for USDA-NRCS / National Cooperative Soil Survey / Soil and Plant Science Division standards.
https://ncss-tech.github.io/SoilKnowledgeBase/
7 stars 1 forks source link

parseOSD: exclude first line of TYPICAL PEDON section in horizon index #34

Closed dylanbeaudette closed 3 years ago

dylanbeaudette commented 3 years ago

There are a few cases like in the MENDEL OSD, where a spurious horizon is detected in the first line of the TYPICAL PEDON section.

TYPICAL PEDON: Mendel very cobbly coarse sandy loam on a south facing (165 degree), 4 percent slope under a cover of timber oatgrass, dwarf bilberry, and scattered Sierra lodgepole pine at an elevation of 3221 meters. (Colors are for dry soils unless otherwise noted. When described on August 3, 2015 the soil was moist to 66 cm, wet, non-satiated from 66-105 cm, and wet, satiated from 66-150 cm. A water table was observed at 95 cm.)

name top bottom dry_hue dry_value dry_chroma moist_hue moist_value moist_chroma
A 0 13 10YR 5 2 10YR 3 2
Bw1 13 35 10YR 6 4 10YR 4 4
Bw2 35 52 10YR 6 6 10YR 4 6
Bw3 52 66 10YR 6 6 10YR 4 6
BC 66 105 2.5Y 6 4 2.5Y 4 4
C1 105 135 2.5Y 7 3 2.5Y 5 4
C2 135 150 2.5Y 7 2 2.5Y 5 3
66 105 NA NA NA NA NA NA NA

Proposed fix, pending some more testing.

## the first line of the TYPICAL PEDON section should not appear in this index
  # first.line.flag <- which(hz.idx == 1)
  # if(length(first.line.flag) > 0) {
  #   hz.idx <- hz.idx[-first.line.flag]
  # }
brownag commented 3 years ago

I haven't tried to test this fix yet, but it seems like it would work fine.

It appears that this is the result of generalizing of the the REGEX I did in https://github.com/ncss-tech/SoilKnowledgeBase/commit/38264d7b5d6852b8f2e793f800a7d188c1dbe001.

I think there is nothing wrong with proposed fix removing first line when it matches the horizon pattern... but considering that allowing "-" in lieu of "to" is non-standard--perhaps we should be flagging those OSDs as they should be using"to" between top and bottom depths in horizon narratives.

dylanbeaudette commented 3 years ago

OK, thanks. I'm working on some new code that will find specific problems in the OSDs for a more detailed "TODO" list sent to RO staff. I like your idea to include the use of one or more '-' as something to fix. I've seen some cases where there are 1, 2, 3, and even 5 '-' used to delimit depths.

As far as I can tell, there is a lot of support among SRSS to fix these kind of errors. A more polished report might make the process simpler.