pfmc-assessments / PacFIN.Utilities

R code to manipulate data from the PacFIN database for assessments
http://pfmc-assessments.github.io/PacFIN.Utilities
Other
7 stars 1 forks source link

getAges message for kept age methods #49

Closed chantelwetzel-noaa closed 3 years ago

chantelwetzel-noaa commented 3 years ago

https://github.com/nwfsc-assess/PacFIN.Utilities/blob/d0b9862aff692b2993560c4045f07fb414b2c87f/R/getAge.R#L86

This function when verbose = TRUE appears to print out an incorrect list of 'good' age methods. When run for an example where the keep_age_methods = c(1, "B", "BB") the print out of age types kept are:

The following age types were kept in the data: NA, 3, 9, B, and UNK

However, the only kept ages in the age column correspond only to "B" as expected. So, I think this function is working correctly but kicking out a misleading message.

kellijohnson-NOAA commented 3 years ago

it is telling you all ageing methods across age readers, so that might be the difference.

there is a disconnect in what is being printed (all age types) and what is used to find the best age (only those in the included methods). keep this issue open and i will work making them match.

kellijohnson-NOAA commented 3 years ago

There is no way to know which method was used for the best age. I can only search across age methods used for the read.

NWFSC ageing lab (phone call with Patrick): Value in the best age column might not even be from a read. Sometimes, reconciling happens where a senior reader is sent to check some ages and then together the readers can even come up with a new age. Typically, this will be using the same method as what is in the agemethod columns but not always. We will need to leave it up to the labs to determine what the best age is. Hopefully, in the future the best...age_method column will be filled and we can utilize this information then, but right now this is all we can do. I did upgrade the messages to show something more comprehensible and less nuanced then what was previously printed. Like comparisons across how many age methods there are for each age reader.

From Washington (email): If only age_1, best_age = age_1 If difference between age_1 and age_2 <=3, randomly choose from the two ages. If the difference > 3, age readers need to reconcile between the reads. That is, the best_age will have to be manually keyed in.
When there are 3 age reads, best_age will be assigned only when age_1 = age_2 = age_3. Otherwise, age readers need to make the assignment.

For people that are working with species that should not be aged using a certain method, then they will want to clean their data using external methods and not those inside cleanPacFIN. I am happy to add any additional filtering processes that people want. Just open a new issue and we can deal with these on a case-by-case basis. I am going to leave the enhancement tag on this issue even after closing to facilitate future searching. PacFIN has been notified that this column is currently incorrect in their data in that it repeats some best ages rather than providing an ageing method.