leppott / BioMonTools

Tools for biomonitoring and bioassessment; metric calculation for benthic macroinvertebrates, fish, and periphyton.
https://leppott.github.io/BioMonTools/
MIT License
13 stars 5 forks source link

Metrics - WY bugs #101

Closed leppott closed 5 months ago

leppott commented 7 months ago

General statement of metrics or index needed WY DEQ benthic index (2023)

Community Benthic macroinvertebrates (bugs)

Metric Names

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

Metric | Metric Description -- | -- pi_EphemNoBaeTri | % Ephemeroptera (less Baetidae and Tricorythodes) nt_EphemNoBaeTri | No. of Ephemeroptera Taxa (less Baetidae and Tricorythodes) nt_TrichNoHydro | No. Trichoptera Taxa (less Hydropsychidae) nt_COETNoBraBaeHydTri | No. Coleoptera+Odonata+Ephemeroptera+Trichoptera Taxa (less Brachycentrus, Baetidae, Hydropsyche, and Tricorythodes) rnt_ChiroOfTotal | Ratio of Chironomidae Taxa to Total Taxa rnt_NonInsOfTotal | Ratio of Non-Insect Taxa to Total Taxa x_BCICTQa | Biotic Condition Index CTQa Score

Scoring, Metrics Include any special conditions for metric scoring. For example, adjustments for drainage area need the formula and the field name.

Index Include prefered name and class names.

Scoring, Index Include criteria for index scoring

References Links to website and/or documentation. For example, https://www.pca.state.mn.us/sites/default/files/wq-bsm4-01.pdf

Notes More details sent via email.

leppott commented 7 months ago

The BCICTQa metric is based on Winget and Mangum 1979 [Biotic condition index: Integrated biological, physical, and chemical stream parameters for management. Intermountain Region, U.S. Department of Agriculture, Forest Service, Ogden, Utah]. The metric is calculated as the sum of BCI values (which come from Winget and Mangum) for each non-excluded taxon divided by the number of non-excluded taxa. I've provided an Excel snapshot to illustrate the calculation of BCICTQa score of 52 for a single sample.

Should be able to utilize existing TolVal2.

leppott commented 7 months ago

Convert names

Name_WY Name_BioMonTools Status
pi_EphemNoBaeTri pi_EphemNoBaeTri new
nt_EphemNoBaeTri nt_EphemNoBaeTri new
nt_TrichNoHydro nt_TrichNoHydro existing
nt_COETNoBraBaeHydTri nt_COETNoBraBaeHydTri new
rnt_ChiroOfTotal pt_Chiro existing
rnt_NonInsOfTotal pt_NonIns existing
x_BCICTQa x_BCICTQa new
leppott commented 7 months ago

Add 4 new taxa to "MetricNames.xlsx" and example for one region to "MetricScoring.xlsx".

leppott commented 7 months ago

nt_COETNoBraBaeHydTri not working properly. And need to edit the description (and contents).

A new metric that you added for me to BioMonTools does not appear to be performing the calculations correctly. Specifically, metric "nt_COETNoBraBaeHydTri" which calculates the Number of Coleoptera+Odonata+Ephemeroptera+Trichoptera taxa (less Brachycentrus, Baetidae, Hydropsychidae, and Tricorythodes) appears to be producing a result for the taxa that are excluded from the calculation. For example, if there are 16 total taxa that represent the COET and 2 of those represent the Brachycentrus, Baetidae, Hydropsychidae or Tricorythodes, BioMonTools produces a result of 2 instead of a correct answer of 14. Could you please check this and make any modifications to BioMonTools?

BTW, I mistakenly provided you with an incorrect description of the "nt_COETNoBraBaeHydTri" metric in an earlier email (see table below). I originally indicated that 'Hydropsyche' should be excluded but instead it should be the 'Hydropsychidae' as described in the above paragraph.Could you also please make this change to BioMonTools as well?

leppott commented 7 months ago

Code bad. Order and Family ok but Genus should be "!=" rather than "==".

image

leppott commented 7 months ago

Made change for "Hyd" and Genus statements. Also rearranged Orders in the same order as in the name of the metric.

image

leppott commented 7 months ago

NOT conditions need to be on separate lines with is.na(). Otherwise they cancel each other out and don't exclude anything.

image

leppott commented 7 months ago

Used the example dataset and calculated the metric by hand. Then wrote a test to compare to the values from metric.values().

image

All good now.

leppott commented 7 months ago

Checked other bug metrics and no other issues with "NOT" conditions. The others were constructed properly.

leppott commented 6 months ago

Updates to MetricScoring.xlsx.