EOGrady21 / vprr

Video Plankton Recorder Data Processing
https://eogrady21.github.io/vprr/
Other
2 stars 1 forks source link

direction of binning in vpr_roi_concentration() #62

Open kevinsorochan opened 7 months ago

kevinsorochan commented 7 months ago

Is your feature request related to a problem? Please describe. I don't think that the direction of binning (from surface or bottom) can actually be specified

Describe the solution you'd like An argument should be made in the external facing function for the direction of binning and it should be made certain that this is not overwritten by internal facing functions

Describe alternatives you've considered none

EOGrady21 commented 7 months ago

In develop I have made an update to vpr_roi_concentration that pulls the rev argument out to the most external layer.

The issue here is really how nested the bin calculation functions are. It makes things challenging.

The argument should now be pulled all the way through although it is not used until line 1688 in EC_functions (bin_calculate()).

I will note there is no overwriting of this argument but the functions do have a default value (FALSE), which will only be used if the value is not supplied by the user.

EOGrady21 commented 4 months ago

@kevinsorochan let me know if you have tested this more. The meat of what is going on here when this rev argument is actually used is at line 1692 of EC_functions (in bin_calculate)

Here is a reproducible example with the package data to see the difference in rev = TRUE, and rev = FALSE

library(vprr)
data(ctd_roi_merge)
# Call concentration_category with binSize = 1 and imageVolume = 1000 as example

result <- concentration_category(ctd_roi_merge, "Calanus", 3, 1000, rev = TRUE, breaks = 1000)
result_revF <- concentration_category(ctd_roi_merge, "Calanus", 3, 1000, rev = FALSE, breaks = 1000)

Note that the depth bins are different in these two data frames.