massbays-tech / MassWateR

R package for working with Massachusetts surface water quality data
https://massbays-tech.github.io/MassWateR
Creative Commons Zero v1.0 Universal
11 stars 3 forks source link

Need to handle both Depth and Relative Depth #38

Closed ben-wetherill closed 1 year ago

ben-wetherill commented 2 years ago

This is regarding issue #4 in beta list. The QC functions should evaluate everything regardless of depth. The analysis functions should only evaluate surface data. Surface is defined by either Relative Depth = "Surface" or Depth < 1m/3.3ft. Relative Depth should take precedent if both Relative Depth and Depth entered.

  1. When I run anlzMWRoutlier(), it is correctly including records that have Relative Depth = Surface and any depth, but it is currently including the following records that it should not include (Relative Depth = Bottom and Depth = NA; Relative Depth = Bottom and Depth = 1; Relative Depth = Bottom and Depth = 5; Relative Depth = NA and Depth = 5).

  2. readMWRresults() is giving individual warnings for records that have Relative Depth = Bottom and Depth > 3.3, but it doesn't give a warning if the Depth is less than 3.3. If the Relative Depth says Bottom, I don't think it needs to give a warning for each record. That could get very long. Maybe it would be better to just give a warning of the total number of records that are not Surface records and are out of scope (i.e. all records that have Relative Depth that is not NA or Surface plus all records that have Relative Depth = NA and have a Depth > 3.3).

fawda123 commented 1 year ago

@ben-wetherill I think I got this sorted out now. The check was modified to not evaluate anything that had "Bottom" or "Midwater" in the relative depth column. I also added a filter for all of the analysis functions to evaluate only surface data. Give it a check and let me know if it's working as we discussed.

ben-wetherill commented 1 year ago

Number 1 is good now.

For number 2, I think we should give a warning about all records that are not surface (all records that have Relative Depth that is not NA or Surface plus all records that have Relative Depth = NA and have a Depth > 3.3). Currently the warning is only for the second part of that logic. Records with Relative Depth = Bottom don't show up in the warning. I don't feel strongly about this, but I think they should show up if we can keep the warning to a manageable length.

fawda123 commented 1 year ago

@ben-wetherill alright, no problem. The warning is updated. It will indicate additional text if Bottom or Midwater entries are found in the Activity Relative Depth Name column. The checks for surface values should work as before (depths > 3.3 ft / 1 m and not Surface).

ben-wetherill commented 1 year ago

This looks good.