Skip to content

Commit

Permalink
Merge pull request #50 from Ned-Laman-NOAA/main
Browse files Browse the repository at this point in the history
August 29 Run
  • Loading branch information
zoyafuso-NOAA authored Aug 29, 2024
2 parents 8d4c97e + 3d0c8b9 commit f3a20c4
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 34 deletions.
48 changes: 15 additions & 33 deletions code/check_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ for (iregion in 1:length(x = regions)) { ## Loop over regions -- start

## Evaluate the new, removed, and modified records between the two tables
eval_cpue <-
compare_tables(
x = test_cpue,
cols_to_check = data.frame(
colname = c("WEIGHT_KG", "COUNT", "AREA_SWEPT_KM2",
"CPUE_KGKM2", "CPUE_NOKM2"),
percent = c(F, F, F, F, F),
decplaces = c(2, 0, 2, 2, 2)),
base_table_suffix = "_CURRENT",
update_table_suffix = "_UPDATE",
key_columns = c("HAULJOIN", "SPECIES_CODE"))
compare_tables(
x = test_cpue,
cols_to_check = data.frame(
colname = c("WEIGHT_KG", "COUNT", "AREA_SWEPT_KM2",
"CPUE_KGKM2", "CPUE_NOKM2"),
percent = c(F, F, F, F, F),
decplaces = c(2, 0, 2, 2, 2)),
base_table_suffix = "_CURRENT",
update_table_suffix = "_UPDATE",
key_columns = c("HAULJOIN", "SPECIES_CODE"))

## Ignore very, very small cpue discrepancies when the weight or count of the
## record has not changed.
Expand Down Expand Up @@ -114,15 +114,15 @@ for (iregion in 1:length(x = regions)) { ## Loop over regions -- start
x = test_biomass,
cols_to_check = data.frame(
colname = c("N_HAUL", "N_WEIGHT", "N_COUNT", "N_LENGTH",
"CPUE_KGKM2_MEAN", "CPUE_KGKM2_VAR",
"CPUE_NOKM2_MEAN", "CPUE_NOKM2_VAR",
"BIOMASS_MT", "BIOMASS_VAR",
"CPUE_KGKM2_MEAN", "CPUE_KGKM2_VAR",
"CPUE_NOKM2_MEAN", "CPUE_NOKM2_VAR",
"BIOMASS_MT", "BIOMASS_VAR",
"POPULATION_COUNT", "POPULATION_VAR"),
percent = c(F, F, F, F, T, T, T, T, T, T, T, T),
decplaces = c(0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2)),
base_table_suffix = "_CURRENT",
update_table_suffix = "_UPDATE",
key_columns = c("SURVEY_DEFINITION_ID", 'AREA_ID',
key_columns = c("SURVEY_DEFINITION_ID", 'AREA_ID',
"SPECIES_CODE", "YEAR"))

cat(paste0("Finished with BIOMASS for the ", regions[iregion], " Region\n"))
Expand Down Expand Up @@ -239,25 +239,7 @@ gapindex_version <-
subset = Package == "gapindex")$Version

detailed_notes <-
"Initial 2024 post-survey run with new ages since last run and all of EBS Shelf 2024 survey data but none of AI 2024 survey data.
A development branch version of gapindex called [using_datatable](https://github.com/afsc-gap-products/gap_products/tree/using_datatable) uses the data.table package for many dataframe manipulations, which greatly decreased the computation time of many of the functions. There were no major changes in the calculations in this version of the gapindex package and thus the major changes listed below are not related to the gapindex package.
EBS Region:
cpue : New CPUE information for the 2024 EBS shelf survey (350 hauls) added.
biomass : New biomass information for the 2024 EBS shelf survey (350 hauls) added.
sizecomp : New sizecomp information for the 2024 EBS shelf survey (350 hauls) added.
agecomp : New age data added for Alaska plaice (2021), Greenland turbot (2022), flathead sole (2022, 2023), Kamchatka flounder (2023), yellowfin sole (2023), northern rock sole (2023), and Pacific cod (2023)
NBS Region:
agecomp : New age data added for Pacific cod (2023). There are 74 new agecomp records. There are 1 agecomp records that were removed. There are 10 modified agecomp records.
"While trying to update the records in the GAP_PRODUCTS table, the connection was terminated, partially uploading records in the agecomp tables and outputting NA to the N_HAUL and N_LENGTH fields in the biomass tables. At this point, the GAP_PRODUCTS tables are incomplete. The AKFIN and FOSS tables were NOT updated in this run.
"

##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion code/production.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ channel <- gapindex::get_connected(check_access = F)
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
current_year <- as.integer(format(x = Sys.Date(), format = "%Y"))
start_year <-
c("AI" = 1991, "GOA" = 1990, "EBS" = 1982, "BSS" = 2002, "NBS" = 2010)
c("AI" = 1991, "GOA" = 1990, "EBS" = 1982, "BSS" = 2002, "NBS" = 2010)
regions <- c("AI" = 52, "GOA" = 47, "EBS" = 98, "BSS" = 78, "NBS" = 143)

spp_start_year <-
Expand Down
111 changes: 111 additions & 0 deletions content/intro-news/2024-08-29.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
GAP_PRODUCTS ChangeLog (last produced on 2024-08-29) using gapindex v2.2.0
The additions of previous years’ age data and 2024 EBS catch, effort, and size data
documented in the August 20th gap_products run were partially
completed in that run. The N_HAUL and N_LENGTH fields in the biomass table
additions and the AREA_SWEPT_KM2 field in the cpue table additions were NULL. This
was found to be an issue in how the mismatches.RDS R object was created in the
check_tables.R script and has been corrected in commit (1f9d651d7edd7ad8789ffa645acd52333807ac54).
To rectify this in the GAP_PRODUCTS oracle tables, these commands were executed
on 8/28/2024 to revert those additions:

DELETE
FROM GAP_PRODUCTS.BIOMASS WHERE N_HAUL IS NULL AND N_LENGTH IS NULL;
DELETE
FROM GAP_PRODUCTS.CPUE WHERE AREA_SWEPT_KM2 IS NULL;
commit;

Records
GAP_PRODUCTS.TAXONOMIC_GROUPS of SPECIES_CODE values (82691, 82741, 82740,
82690) were found to be duplicated, leading to a doubling of estimated catch
rates for these SPECIES_CODE values. This issue has been resolved (see commit 93b1e3360e6aae1d3c8a0c407aa8ccf807cd78db)
and documented in this github issue (https://github.com/afsc-gap-products/gap_products/issues/47).

Other changes to the age composition data are from updated read otoliths data for EBS
Kamchatka flounder (2015, 2022), EBS Greenland turbot (2023), GOA northern rock
sole (2023) and GOA northern rockfish (2023).





AI Region:

cpue :
There are 0 new cpue records. There are 0 cpue records that were removed. There are 18 modified cpue records.

biomass :
There are 0 new biomass records. There are 0 biomass records that were removed. There are 83 modified biomass records.

sizecomp :
There are 0 new sizecomp records. There are 0 sizecomp records that were removed. There are 0 modified sizecomp records.

agecomp :
There are 85 new agecomp records. There are 0 agecomp records that were removed. There are 0 modified agecomp records.



GOA Region:

cpue :
There are 0 new cpue records. There are 0 cpue records that were removed. There are 100 modified cpue records.

biomass :
There are 0 new biomass records. There are 0 biomass records that were removed. There are 214 modified biomass records.

sizecomp :
There are 0 new sizecomp records. There are 0 sizecomp records that were removed. There are 0 modified sizecomp records.

agecomp :
There are 1535 new agecomp records. There are 33 agecomp records that were removed. There are 28 modified agecomp records.



EBS Region:

cpue :
There are 247418 new cpue records. There are 0 cpue records that were removed. There are 380 modified cpue records.

biomass :
There are 19216 new biomass records. There are 0 biomass records that were removed. There are 483 modified biomass records.

sizecomp :
There are 0 new sizecomp records. There are 0 sizecomp records that were removed. There are 0 modified sizecomp records.

agecomp :
There are 1271 new agecomp records. There are 38 agecomp records that were removed. There are 80 modified agecomp records.



NBS Region:

cpue :
There are 0 new cpue records. There are 0 cpue records that were removed. There are 40 modified cpue records.

biomass :
There are 0 new biomass records. There are 0 biomass records that were removed. There are 16 modified biomass records.

sizecomp :
There are 0 new sizecomp records. There are 0 sizecomp records that were removed. There are 0 modified sizecomp records.

agecomp :
There are 0 new agecomp records. There are 0 agecomp records that were removed. There are 0 modified agecomp records.



BSS Region:

cpue :
There are 0 new cpue records. There are 0 cpue records that were removed. There are 1 modified cpue records.

biomass :
There are 0 new biomass records. There are 0 biomass records that were removed. There are 3 modified biomass records.

sizecomp :
There are 0 new sizecomp records. There are 0 sizecomp records that were removed. There are 0 modified sizecomp records.

agecomp :
There are 0 new agecomp records. There are 0 agecomp records that were removed. There are 0 modified agecomp records.




0 comments on commit f3a20c4

Please sign in to comment.