Skip to content

Commit

Permalink
Merge pull request #67 from ncss-tech/parse-eff-class
Browse files Browse the repository at this point in the history
Parse effervescence classes from typical pedon horizon narratives
  • Loading branch information
brownag authored Oct 19, 2023
2 parents 028e4b1 + b357b35 commit da71f53
Show file tree
Hide file tree
Showing 24,481 changed files with 141,739 additions and 2 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 24 additions & 2 deletions R/parseOSD_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
#' @importFrom stringi stri_match
.parse_pH_class <- function(text) {

# mineral texture classes
# reaction classes
pH_classes <- c('ultra acid', 'extremely acid', 'very strongly acid', 'strongly acid', 'moderately acid', 'slightly acid', 'neutral', 'slightly alkaline', 'mildly alkaline', 'moderately alkaline', 'strongly alkaline', 'very strongly alkaline')

## 2019-05-29: generalized for all non-greedy, exact matching
Expand All @@ -202,6 +202,27 @@
}



# vectorized parsing of effervescence class
#' @importFrom stringi stri_match
.parse_eff_class <- function(text) {

# mineral texture classes
.classes <- c('noneffervescent', 'very slightly effervescent', 'slightly effervescent', 'strongly effervescent', 'violently effervescent')

## 2019-05-29: generalized for all non-greedy, exact matching
m <- .findClass(needle = .classes, haystack = text)
m <- tolower(m)

# return as an ordered factor acidic -> basic
m <- factor(m, levels = .classes, ordered = TRUE)

return(m)

}



# vectorized parsing of drainage class
#' @importFrom stringi stri_match
.parse_drainage_class <- function(text) {
Expand Down Expand Up @@ -472,7 +493,8 @@
res$cf_class <- .parse_CF(narrative.data$narrative)
res$pH <- .parse_pH(narrative.data$narrative)
res$pH_class <- .parse_pH_class(narrative.data$narrative)

res$eff_class <- .parse_eff_class(narrative.data$narrative)

bdy <- .parse_hz_boundary(narrative.data$narrative)
res$distinctness <- bdy$distinctness
res$topography <- bdy$topography
Expand Down
7 changes: 7 additions & 0 deletions inst/extdata/OSD/A/AABAB.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "NA",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "smooth",
"narrative": "Oi--0 to 1 inch; slightly decomposed deciduous leaves and twigs; abrupt smooth boundary."
Expand All @@ -111,6 +112,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "moderately acid",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "A1--1 to 4 inches; dark yellowish brown (10YR 3/4) medial silt loam, yellowish brown (10YR 5/4) dry; moderate medium subangular blocky structure; hard, friable, slightly sticky and slightly plastic; common very fine and fine roots; many very fine tubular pores moderately acid (5.6); clear smooth boundary. (2 to 7 inches thick)"
Expand All @@ -133,6 +135,7 @@
"cf_class": "NA",
"pH": 5.4,
"pH_class": "strongly acid",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "A2--4 to 12 inches; dark yellowish brown (10YR 4/4) medial silt loam, light yellowish brown (10YR 6/4) dry; moderate medium subangular blocky structure; hard, friable, slightly sticky and slightly plastic; common fine, medium, and coarse roots; many very fine and common fine tubular pores; strongly acid (pH 5.4); clear wavy boundary. (6 to 11 inches thick)"
Expand All @@ -155,6 +158,7 @@
"cf_class": "NA",
"pH": 5.4,
"pH_class": "strongly acid",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "wavy",
"narrative": "Bw1--12 to 19 inches; dark yellowish brown (10YR 4/4) silty clay loam, light yellowish brown (10YR 6/4) dry; few fine and medium distinct grayish brown (10YR 5/2) redox depletions, light gray (10YR 7/2) dry, and common fine distinct yellowish red (5YR 4/6) redox concentrations, reddish yellow (5YR 6/8) dry; moderate coarse and very coarse prismatic structure; hard, firm, moderately sticky and slightly plastic; few fine roots; many very fine and fine tubular pores; strongly acid (pH 5.4); abrupt wavy boundary. (5 to 9 inches thick)"
Expand All @@ -177,6 +181,7 @@
"cf_class": "NA",
"pH": 5.6,
"pH_class": "moderately acid",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "Bw2--19 to 22 inches; brown (10YR 5/3) silt loam, light gray (10YR 7/2) dry; common fine and medium distinct yellowish red (5YR 5/8) redox concentrations, reddish yellow (5YR 6/8) dry; moderate medium subangular blocky structure; hard, firm, moderately sticky and moderately plastic; few fine roots; few very fine tubular pores; moderately acid (pH 5.6); clear wavy boundary. (2 to 4 inches thick)"
Expand All @@ -199,6 +204,7 @@
"cf_class": "NA",
"pH": 5.4,
"pH_class": "strongly acid",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "Bw3--22 to 44 inches; yellowish brown (10YR 5/4) silty clay loam, very pale brown (10YR 7/3) dry, many fine and medium distinct yellowish red (5YR 4/6) redox concentrations, yellowish red (5YR 5/8) dry; moderate very coarse prismatic structure parting to weak medium subangular blocky; hard, firm, moderately sticky and moderately plastic; few fine roots; many very fine and fine tubular pores; dark reddish brown (2.5YR 3/4) iron coatings on some peds, reddish brown (2.5YR 4/4) dry; strongly acid (pH 5.4); clear smooth boundary. (20 to 25 inches thick)"
Expand All @@ -221,6 +227,7 @@
"cf_class": "NA",
"pH": 5.6,
"pH_class": "moderately acid",
"eff_class": "NA",
"distinctness": "NA",
"topography": "NA",
"narrative": "Cg--44 to 61 inches; greenish gray (5GY 5/1) silty clay loam, light gray (2.5Y 7/2) dry; few fine distinct dark greenish gray (5BG 4/1) redox concentrations, not visible when dry; massive; very hard, very firm, moderately sticky and moderately plastic; common very fine and fine tubular pores; moderately acid (pH 5.6)."
Expand Down
3 changes: 3 additions & 0 deletions inst/extdata/OSD/A/AABERG.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"cf_class": "NA",
"pH": 7.6,
"pH_class": "slightly alkaline",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "A--0 to 4 inches; grayish brown (2.5Y 5/2) clay, very dark grayish brown (2.5Y 3/2) moist; strong fine granular structure; soft, friable, moderately sticky and moderately plastic; slightly alkaline (pH 7.6); clear smooth boundary. (3 to 6 inches thick)"
Expand All @@ -111,6 +112,7 @@
"cf_class": "NA",
"pH": 7.6,
"pH_class": "slightly alkaline",
"eff_class": "NA",
"distinctness": "gradual",
"topography": "wavy",
"narrative": "Bw--4 to 23 inches; light olive brown (2.5Y 5/3) clay, olive brown (2.5Y 4/3)) moist; weak medium prismatic structure parting to moderate medium angular blocks; slightly hard, friable, moderately sticky and moderately plastic; peds are extremely hard; few thin glossy patches on faces of peds; cracks 1 to 2 cm. wide when dry; few slickensides; slightly alkaline (pH 7.6); gradual wavy boundary. (10 to 37 inches thick)"
Expand All @@ -133,6 +135,7 @@
"cf_class": "NA",
"pH": 8,
"pH_class": "moderately alkaline",
"eff_class": "strongly effervescent",
"distinctness": "gradual",
"topography": "wavy",
"narrative": "BC--23 to 30 inches; light olive brown (2.5Y 5/3) clay, olive brown (2.5Y 4/3) moist; weak coarse angular blocky structure; slightly hard, friable, moderately sticky and moderately plastic; peds are extremely hard; few slickensides; cracks 1 to 2 cm. wide when dry; strongly effervescent; moderately alkaline (pH 8.0); gradual wavy boundary. (0 to 10 inches thick)"
Expand Down
7 changes: 7 additions & 0 deletions inst/extdata/OSD/A/AAGARD.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"cf_class": "NA",
"pH": 7,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "wavy",
"narrative": "A1--0 to 10 cm; very dark grayish brown (10YR 3/2) loam, very dark brown (10YR 2/2) moist; weak fine granular structure; soft, very friable, slightly sticky, slightly plastic, many very fine, common fine, medium and coarse roots; many very fine, few fine, medium and coarse interstitial pores; 2 percent stones, 2 percent cobbles and 5 percent gravel; neutral (pH 7.0); abrupt wavy boundary."
Expand All @@ -111,6 +112,7 @@
"cf_class": "NA",
"pH": 6.9,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "A2--10 to 30 cm; brown (10YR 4/3) loam, dark brown (7.5YR 3/2) moist; weak fine subangular blocky structure; slightly hard, very friable, slightly sticky, slightly plastic; common very fine, fine, medium and coarse roots; common very fine, fine, medium and coarse tubular pores; 2 percent stones, 2 percent cobbles and 5 percent gravel; neutral (pH 6.9); clear wavy boundary. (Combined thickness of the A horizon ranges from 30 to 46 cm.)"
Expand All @@ -133,6 +135,7 @@
"cf_class": "NA",
"pH": 7.3,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "Bt1--30 to 44 cm; brown (7.5YR 4/3) loam, dark brown (7.5YR 3/2) moist; moderate medium and fine subangular blocky structure; slightly hard, friable, moderately sticky, moderately plastic; common very fine, fine, medium and coarse roots; common thin distinct brown (7.5YR 4/4) clay films on faces of peds and lining pores; 2 percent stones, 2 percent cobbles and 5 percent gravel; neutral (pH 7.3); clear wavy boundary."
Expand All @@ -155,6 +158,7 @@
"cf_class": "cobbly",
"pH": 7.3,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "Bt2--44 to 64 cm; light brown (7.5YR 6/3) cobbly clay loam, brown (7.5YR 4/4) moist; moderate medium subangular blocky structure; hard, friable, moderately sticky, moderately plastic; common very fine, fine, medium and coarse roots; common very fine, fine, medium and coarse tubular pores; many thin distinct brown (7.5YR 5/4) clay films on faces of peds and lining pores; 3 percent stones, 8 percent cobbles and 7 percent gravel, mostly of limestone origin; neutral (pH 7.3); clear wavy boundary. (Combined thickness of the Bt horizon ranges from 26 to 34 cm.)"
Expand All @@ -177,6 +181,7 @@
"cf_class": "very stony",
"pH": 8.4,
"pH_class": "moderately alkaline",
"eff_class": "strongly effervescent",
"distinctness": "abrupt",
"topography": "wavy",
"narrative": "Btk--64 to 80 cm; very pale brown (10YR 7/4) very stony loam, yellowish brown (10YR 5/4) moist; moderate fine and medium subangular blocky structure; hard, friable, slightly sticky, moderately plastic; common very fine and fine and few medium and coarse roots; common very fine and fine tubular pores; few very thin light brown (7.5YR 6/4) clay films on faces of peds and lining pores; calcium carbonate is segregated as common fine very pale brown (10YR 8/2) threads and thin coats on bottom of rock fragments, strongly effervescent (18 percent calcium carbonate equivalent); 8 percent stones, 15 percent cobbles and 12 percent gravel; moderately alkaline (pH 8.4); abrupt wavy boundary. (12 to 18 cm thick)"
Expand All @@ -199,6 +204,7 @@
"cf_class": "gravelly",
"pH": 8.2,
"pH_class": "moderately alkaline",
"eff_class": "violently effervescent",
"distinctness": "clear",
"topography": "wavy",
"narrative": "Bk--80 to 106 cm; very pale brown (10YR 7/3) gravelly loam, brown (10YR 5/3) moist; weak moderate and fine subangular blocky structure; slightly hard, friable, slightly sticky, slightly plastic; common very fine and few fine roots; common very fine and fine tubular pores; calcium carbonate is finely disseminated and segregated as common fine very pale brown (10YR 8/2) threads, soft masses and moderately thick coats on bottom of rock fragments, violently effervescent (24 percent calcium carbonate equivalent); 3 percent cobbles and 15 percent gravel; moderately alkaline (pH 8.2); clear wavy boundary. (48 to 81 cm thick)"
Expand All @@ -221,6 +227,7 @@
"cf_class": "NA",
"pH": 8.2,
"pH_class": "moderately alkaline",
"eff_class": "violently effervescent",
"distinctness": "NA",
"topography": "NA",
"narrative": "BCk--106 to 157 cm; white (10YR 8/1) silty clay loam, light brownish gray (2.5Y 6/2) moist; weak fine and moderate subangular blocky structure; slightly hard, friable, slightly sticky, moderately plastic; few very fine and fine roots; few very fine and fine tubular pores; calcium carbonate is finely disseminated and segregated as common fine very pale brown (10YR 8/2) threads, soft masses and moderately thick coats on bottom of rock fragments, violently effervescent (28 percent calcium carbonate equivalent); 5 percent parachanners; moderately alkaline (pH 8.2). (26 to 50 cm thick)"
Expand Down
7 changes: 7 additions & 0 deletions inst/extdata/OSD/A/AARON.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "smooth",
"narrative": "Ap--0 to 8 inches; brown (10YR 4/3) silt loam; moderate medium granular structure; friable; many fine roots; neutral; abrupt smooth boundary. (5 to 9 inches thick)"
Expand All @@ -111,6 +112,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "mildly alkaline",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "Bt1--8 to 17 inches; light olive brown (2.5Y 5/4) clay; moderate coarse and medium subangular blocky structure which parts to weak fine angular blocky; very firm; common fine roots; common faint clay films; common distinct dark brown (10YR 3/3) coatings; mildly alkaline; clear smooth boundary. (7 to 10 inches thick)"
Expand All @@ -133,6 +135,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "Bt2--17 to 26 inches; light olive brown (2.5Y 5/6) clay; few medium faint grayish brown mottles; moderate medium subangular blocky structure parting to moderate fine angular blocky; very firm; few fine roots; common faint clay films; common distinct dark grayish brown (2.5Y 4/2) coatings; neutral; clear smooth boundary. (6 to 10 inches thick)"
Expand All @@ -155,6 +158,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "Bt3--26 to 37 inches; light olive brown (2.5Y 5/6) clay; common fine distinct light brownish gray (2.5Y 6/2) and yellowish brown (10YR 5/6) mottles; weak and moderate medium subangular and angular blocky structure; very firm; few fine roots; common faint clay films; neutral; clear smooth boundary. (7 to 12 inches thick)"
Expand All @@ -177,6 +181,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "gradual",
"topography": "smooth",
"narrative": "BC--37 to 45 inches; light olive brown (2.5Y 5/6) silty clay; many medium distinct light brownish gray (2.5Y 6/2) and common fine distinct yellowish brown (10YR 5/6) mottles; weak medium subangular blocky structure; firm; common fine dark brown and black concretions; 5 percent flagstones of siltstone and highly weathered shale; neutral; gradual smooth boundary. (5 to 9 inches thick)"
Expand All @@ -199,6 +204,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "mildly alkaline",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "smooth",
"narrative": "C--45 to 53 inches; mixed; light olive brown (2.5Y 5/6) and light olive gray (5Y 6/2) silty clay; massive; very firm; common fine calcium carbonate concretions; 10 percent flagstones of siltstone, limestone, and highly weathered shale; mildly alkaline; abrupt smooth boundary. (5 to 10 inches thick)"
Expand All @@ -221,6 +227,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "NA",
"eff_class": "NA",
"distinctness": "NA",
"topography": "NA",
"narrative": "R--53 inches; hard limestone bedrock with interbedded calcareous shale and siltstone."
Expand Down
5 changes: 5 additions & 0 deletions inst/extdata/OSD/A/AARUP.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"cf_class": "NA",
"pH": 6.6,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "smooth",
"narrative": "Ap1--0 to 7 inches; brown (10YR 5/3) ashy fine sandy loam, very dark grayish brown (10YR 3/2) moist; weak fine granular structure; soft, very friable, nonsticky and slightly plastic, common very fine and fine roots; few very fine interstitial and tubular pores; 15 percent sand-size pumice less than 2.0mm in diameter; neutral (pH 6.6); clear smooth boundary. (0 to 8 inches thick)"
Expand All @@ -111,6 +112,7 @@
"cf_class": "NA",
"pH": 7,
"pH_class": "neutral",
"eff_class": "NA",
"distinctness": "clear",
"topography": "wavy",
"narrative": "Ap2--7 to 9 inches; brown (10YR 5/3) ashy fine sandy loam, very dark grayish brown (10YR 3/2) moist; weak medium granular structure; slightly hard, friable, nonsticky and slightly plastic; common very fine and fine roots; common fine and very fine tubular and interstitial pores; 20 percent sand-size pumice less than 2.0mm in diameter; neutral (pH 7.0); clear wavy boundary. (0 to 7 inches thick)"
Expand All @@ -133,6 +135,7 @@
"cf_class": "NA",
"pH": 7.6,
"pH_class": "slightly alkaline",
"eff_class": "NA",
"distinctness": "abrupt",
"topography": "wavy",
"narrative": "Bw--9 to 16 inches; brown (10YR 5/3) ashy very fine sandy loam, dark brown (10YR 3/3) moist; weak medium subangular blocky structure; slightly hard, friable, slightly sticky and slightly plastic; few fine roots; few fine tubular and interstitial pores; 10 percent sand-size pumice less than 2.0 mm in diameter; 5 percent basalt gravel and duripan fragments; slightly alkaline (pH 7.6); abrupt wavy boundary. (4 to 8 inches thick)"
Expand All @@ -155,6 +158,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "NA",
"eff_class": "violently effervescent",
"distinctness": "abrupt",
"topography": "wavy",
"narrative": "2Bkqm--16 to 26 inches; indurated lime-silica cemented duripan; very pale brown (10YR 8/2), light yellowish brown (10YR 6/4) moist; violently effervescent, abrupt wavy boundary. (4 to 12 inches thick)"
Expand All @@ -177,6 +181,7 @@
"cf_class": "NA",
"pH": "NA",
"pH_class": "NA",
"eff_class": "NA",
"distinctness": "NA",
"topography": "NA",
"narrative": "3R--26 inches; basalt."
Expand Down
Loading

0 comments on commit da71f53

Please sign in to comment.