Closed EmilyMarkowitz-NOAA closed 6 months ago
Hey you found a bug! Nice. Yes, I can recreate this bug on my side. Short term solution is to loop through regions instead of listing two regions in the get_data call. Medium term solution is the next version of gapindex will have a corrected version of the subarea calculation. After that version is released I will close this issue. Thanks for finding this.
Oh great! Glad it is not me :) Thanks for all of your hard work on this great package and looking forward to the next release!
Hey Emily, okay try downloading the dev version of gapindex, rerun the script and let me know if the issues resolves itself. I think I found where the bug lives.
library(devtools)
devtools::install_github("afsc-gap-products/gapindex")
I'll merge it into the main branch if it goes well.
Hey Zack, I'll do this now. Thank you!!
Fixed!
Issue Description
It appears that the total area calculation for NBS (
AREA_ID
= 99902) complexes is not being returned by thecalc_biomass_subarea
function. This works fine for EBS, but just not for NBS. Below I take one fish complex and one invert compex to illustrate following the instructions from the package documentation for preparing complexes.Is it something that I am doing or something funky with the function? Thanks! Tagging in @sowasser for awareness.
Steps to Reproduce
Sign into oracle
Create complex data
Biomass complex data
Here I check the frequency of times a calculation for a
SURVEY_DEFINITION_ID
,AREA_ID
,SPECIES_CODE
combination was made for biomass estimates. This should:SURVEY_DEFINITION_ID
= 98,AREA_ID
= 99901,SPECIES_CODE
= "all flatfishes" should have 41 years of data, but returns 82. I checked and the duplicates are actually duplicates and removed with aunique()
ordplyr::distinct()
, as shown in second chunk.Sizecomp complex data
Here I check the frequency of times a calculation for a
SURVEY_DEFINITION_ID
,AREA_ID
,SPECIES_CODE
combination was made for sizecomp estimates. I show this because it works as expected:AREA_ID
= 99902