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

Make a PacFIN extraction function that works here in PacFIN.Utilities #30

Closed John-R-Wallace-NOAA closed 2 years ago

John-R-Wallace-NOAA commented 3 years ago

PacFIN.Catch.Extraction() (with a help man page) now gives the same result as the 'PacFIN Catch Extraction Sablefish Example.R' script here:

  https://github.com/John-R-Wallace-NOAA/PacFIN.Data.Extraction/tree/master/Scripts_with_Legacy_Names

to 4 decimal places. (Both the script and function are based on the Comprehensive_FT table.)

After fixing a small bug for unknown areas in the script, the Canary rockfish test species' aggregate catch for CA and OR now is the same in all years for the INPFC and PSMFC areas comparison:

        ACA.INPFC AOR.INPFC AWA.INPFC      ACA.PSMFC AOR.PSMFC AWA.PSMFC      CA.diff OR.diff WA.diff      CA.ratio OR.ratio WA.ratio
 1981    685.00      0.00    508.12         685.00      0.00    508.12            0       0    0.00             1      NaN     1.00
 1982    811.84      0.00    429.76         811.84      0.00    429.76            0       0    0.00             1      NaN     1.00
 1983    555.57      0.00    642.79         555.57      0.00    642.79            0       0    0.00             1      NaN     1.00
 1984    442.92      0.00    605.33         442.92      0.00    605.33            0       0    0.00             1      NaN     1.00
 1985    428.76      0.00   1025.22         428.76      0.00   1025.22            0       0    0.00             1      NaN     1.00
 1986    220.02      0.00    888.00         220.02      0.00    888.00            0       0    0.00             1      NaN     1.00
 1987    254.11   1631.08   1004.13         254.11   1631.08   1004.13            0       0    0.00             1        1     1.00
 1988    274.53   1557.04    967.26         274.53   1557.04    967.26            0       0    0.00             1        1     1.00
 ...
 2016      2.78     15.57      8.18           2.78     15.57      3.16            0       0    5.02             1        1     2.59
 2017     81.19    144.21     39.64          81.19    144.21     26.78            0       0   12.86             1        1     1.48
 2018    145.99    171.99    157.79         145.99    171.99    131.40            0       0   26.39             1        1     1.20
 2019    185.77    197.89     65.83         185.77    197.89     52.22            0       0   13.61             1        1     1.26
 2020     65.70    179.55     47.66          65.70    179.55     35.78            0       0   11.88             1        1     1.33          

An argument (addColsWithLegacyNames) to copy historically used columns and give them legacy names currently has its default set to TRUE.

kellijohnson-NOAA commented 3 years ago

@John-R-Wallace-NOAA can we close this issue and maybe add this information to #45?