Closed brianlangseth-NOAA closed 1 year ago
Thanks @brianlangseth-NOAA for reporting this. Instead of writing convoluted checkers that will likely miss something for someone along the way, I opted to write more informative stop and message statements that tell the user that their data contains measurements with unknown units and a valid unit must be assigned before they can move on.
Is your feature request related to a problem? Please describe. cleanPacFIN can result in incorrectly scaled lengths. For canary bds data, samples with unknown length units are assumed to be in mm and are divided by 10, even when the length is pretty clearly in cm. These are different than samples without lengths (NA)
To Reproduce Steps to reproduce the behavior:
dir <- "//nwcfile/FRAM/Assessments/Assessment Data/2023 Assessment Cycle/canary rockfish/PacFIN data"
load(file.path(dir, "PacFIN.CNRY.bds.01.Sep.2022.RData"))
pacfin <- bds.pacfin
pacfin2 <- cleanPacFIN(Pdata=pacfin,CLEAN=TRUE,verbose=TRUE)
pacfin2[which(pacfin2$FISH_LENGTH_UNITS=="UNK"),]
Expected behavior This may be super rare, but it does require additional checks on the users part. Possible solutions are 2) remove samples with unknown lengths 3) run a convoluted checker to determine whether an issue is likely based on the entered length
Describe the solution you'd like 1) Output a warning highlighting that X number of fish may have unit issues, where X is the number of samples with unknown length
Describe alternatives you've considered 2) remove samples with unknown lengths 3) run a convoluted checker to determine whether an issue is likely based on the entered length
Additional context![image](https://user-images.githubusercontent.com/27824606/213573367-7f76bb90-ff0d-497c-a34a-b4d8bf613b18.png)