ncss-tech / soilReports

An R package that assists with the setup and operation of a collection of soil data summary, comparison, and evaluation reports. These reports are primarily used by USDA-NRCS soil scientists in both initial and update mapping.
15 stars 5 forks source link

[Region 2] Interactive (shiny) Pedon Summary Report #58

Closed brownag closed 7 years ago

brownag commented 7 years ago

This pull request creates a new report (shiny-pedon-summary) in the region2 directory.

Basic setup

The report has a config.R file where the following are specified:

Walkthrough

Here is a picture of shiny-pedon-summary v0.1 in action: shiny-pedon-summary-example

In the above example, the NASIS selected set contains all pedons and DMUs from CA630. First and foremost pedons are filtered by mapunit (MUSYM '6074'), Pedon overlap with mapunits is based on linework from the CA630 GDB. Generalized horizons were assigned manually during the process of populating the 607X MUs. The profile plot shows the pedons that are currently being aggregated together. Here, two taxa that are similar soils (Sierra and Auberry) are selected via a regex pattern and then are both subjected to the same horizonation scheme to come up with the component ranges. In this particular MU, the component was named Sierra.

There are many other tabs on the main information pane in addition to the grouped profile plot shown above. These tabs include:

Trying it out for yourself...

Aside from getting config.R set up in a way that works with your system, you will also need to prepare your NASIS selected set. Many of the morphology summaries and the actual static "report" output all rely on most pedons having generalized horizon labels assigned in NASIS via the Comp. Layer ID field. Individual pedons or horizons are allowed to have blanks in this field if they are not intended to be included in the range of characteristics (RIC). The RIC for each component horizon (modal pedon horizon defines RVs) is determined by aggregating other similar horizons from the non-modal pedons. This aggregation is achieved by assigning them the same "label" in the Comp Layer ID.

For my personal use, I have manually entered component layer IDs after selecting my modal pedon (and therefor my "modal horizon scheme"). This becomes increasingly less practical as the number of pedons involved in the analysis increases.

An alternate way of doing the horizon aggregation if you can't stomach doing it in NASIS manually is to use the old generalized horizon script. Various vintages of this kick around in the 2-SON office but it is currently not publically available. These scripts use regular expressions (1 expression per generalized horizon; matches many horizon designations and aggregates to a single label) and taxonname (each taxon can have its own set of generalized horizons). Then the script spits out a horizonagg.txt file that can be imported into NASIS component layer ID fields via a calculation. This script is long overdue for an overhaul and will be one of the near-future projects to bring in as a new soilReport.

Future plans

Tying in with re-vamping the horizon generalization script, I would like to have a really slick way to interactively generate regex patterns/manually assign horizonation. This could likely be a separate shiny interface report (e.g. shiny-pedon-aggregation) or a "prequel" to running the pedon-summary stage (say, if generalized horizons don't already exist in the SPC or if the user asks to override NASIS). It also would be fun to drive the "horizon similarity" metrics off of the numerical data we have and try to programmatically assign GHZ that way. Though most components/series/etc. in our region are probably not well documented enough to actually rely on this, we probably do have a handful that would be really great demonstration datasets.

The shiny interface would show a plot and graphs of properties from the selected modal pedon in a side pane. The modal pedon defines the actual "label" and number of labels for a particular component's generalized horizons. In a larger pane would be the "unaggregated" pedons. The user would be able to rapidly visualize the original description, generalized description, numerical effects on ranges of including/excluding different horizons from a particular generalized horizon group, and so on.