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 2 forks source link

PSMFC_CATCH_AREA_CODE 9U #18

Open kellijohnson-NOAA opened 5 years ago

kellijohnson-NOAA commented 5 years ago

Mark Freeman (ODFW) noted that PSMFC_CATCH_AREA == "9U" are samples from outside of the EEZ and shouldn't be used in the assessment. This reminded me that many state reps said to filter samples for COUNCIL_CODE == "P". Unfortunately, our current bds file doesn't have council code. Tasks:

John-R-Wallace-NOAA commented 5 years ago

'9U' is not in PacFINs's 'ar' table and hence will not get a Council 'P'.    '9U' is matched with the missing XXX in PSMFC_ARID:

Table(SABL$PSMFC_ARID, SABL$PSMFC_AREA)              1A    1B    1C    2A    2B 2C    2E    2F    3A    3B    3C    3S    4A    5B    9U       84548     0     0     0     0     0 0     0     0     0     0     0     0     0     0     0   1A      0 32684     0     0     0     0 0     0     0     0     0     0     0     0     0     0   1B      0     0 60529     0     0     0 0     0     0     0     0     0     0     0     0     0   1C      0     0     0 43464     0     0 0     0     0     0     0     0     0     0     0     0   2A      0     0     0     0 18789     0 0     0     0     0     0     0     0     0     0     0   2B      0     0     0     0     0 29936 0     0     0     0     0     0     0     0     0     0   2C      0     0     0     0     0     0 1128     0     0     0     0     0     0     0     0     0   2E      0     0     0     0     0     0 0  3258     0     0     0     0     0     0     0     0   2F      0     0     0     0     0     0 0     0 20595     0     0     0     0     0     0     0   3A      0     0     0     0     0     0 0     0     0 24567     0     0     0     0     0     0   3B      0     0     0     0     0     0 0     0     0     0  7178     0     0     0     0     0   3S      0     0     0     0     0     0 0     0     0     0     0  9712   486     0     0     0   4A      0     0     0     0     0     0 0     0     0     0     0     0     0    52     0     0   XXX     0     0     0     0     0     0 0     0     0     0     0     0     0     0   115   311

   Removing 4A (Puget Sound) and the unknown XXX from PSMFC_ARID gives areas that all have Council 'P'.

  I should be able to add COUNCIL to the BDS.

John-R-Wallace-NOAA commented 5 years ago

 psmfc_arid can be matched  ar's arid,  but trying to filter samples for COUNCIL_CODE == "P" doesn't work since 80% of WA entries (and some others) do not have a PSMFC_AREA nor a PSMFC_ARID and hence no Council 'P' after matching:

Table(PacFIN.SABL.bds.05.Apr.2019$PSMFC_AREA %in% "", PacFIN.SABL.bds.05.Apr.2019$SAMPLE_AGENCY)

            CA     OR     PW      T      W   FALSE 132230  96135   3195      0  21244   TRUE       0     26     30    146  84346

Table(PacFIN.SABL.bds.05.Apr.2019$PSMFC_ARID %in% "", PacFIN.SABL.bds.05.Apr.2019$SAMPLE_AGENCY)

            CA     OR     PW      T      W   FALSE 132230  96135   3195      0  21244   TRUE       0     26     30    146  84346

This is why the number in the upper left of the table below is so high.