The goal of the script is to merge the two constituent datasets all_areas_nuseds (referred to as NUSEDS) and conservation_unit_system_sites (referred to as CUSS) so each time series in NUSEDS (i.e., fish counts associated to a unique populations, characterized by a unique IndexId/POP_ID & GFE_ID association) can be attributed to a unique conservation unit (CU) in CUSS (characterized by CU_NAME and FULL_CU_IN). But there are multiple inconsistencies between the two datasets that lead to discard a significant amount of data points in NUSEDS, unless fixes are implemented. This script is a attempt to implement such fixes.

The dataset version corresponding to this script is:

Fisheries and Oceans Canada. 2024. NuSEDS - New Salmon Escapement Database System. Pacific Biological Station. Retrieved January 22, 2024, from https://open.canada.ca/data/en/dataset/c48669a3-045b-400d-b730-48aafe8c5ee6.

1 Import datasets

The NUSEDS (all_areas_nuseds) and CUSS (conservation_unit_system_sites) datasets are imported and duplicated rows are removed. The columns considered for NuSEDS are related to the population, location, fish counts and year of assessment:

## [1] "File imported: all_areas_nuseds_2025-02-21.csv ; Date modified: 2025-02-21 09:28:25.445271"
## [1] "File imported: conservation_unit_system_sites_2025-02-20.csv ; Date modified: 2025-02-20 15:55:05.475634"

The list of conservation units (CUs) as shown in the Pacific Salmon Explorer (PSE) is imported. The columns cu_name_pse and cu_name_dfo correspond to CU_NAME in CUSS, cu_index corresponds to FULL_CU_INDEX.

##   region species_name species_qualified cuid             cu_name_pse
## 1 Skeena Lake sockeye               SEL  171                Alastair
## 2 Skeena Lake sockeye               SEL  174           Ecstall/Lower
## 3 Skeena Lake sockeye               SEL  175                Johnston
## 4 Skeena Lake sockeye               SEL  176             Kitsumkalum
## 5 Skeena Lake sockeye               SEL  177                 Lakelse
## 6 Skeena Lake sockeye               SEL  172 Mcdonell/Dennis/Aldrich
##     cu_name_dfo  cu_index
## 1      Alastair SEL-20-01
## 2 Ecstall/Lower SEL-20-04
## 3      Johnston SEL-20-05
## 4   Kitsumkalum SEL-20-06
## 5       Lakelse SEL-20-07
## 6       Aldrich SEL-20-02

The DFO file of the stream locations and coordinates (emailed from Wu Zhipeng, DFO, 09/04/2024) is imported. The columns NME and ID correspond to SYSTEM_SITE and GFE_ID in CUSS, respectively.

## # A tibble: 6 × 4
##   NME               ID X_LONGT           Y_LAT           
##   <chr>          <dbl> <chr>             <chr>           
## 1 STANLEY CREEK   1557 -132.691420767338 53.9746116925906
## 2 DAVIDSON CREEK  1558 -132.682181062338 53.9544135568635
## 3 NADEN RIVER     1559 -132.672499482506 53.9448571061959
## 4 LIGNITE CREEK   1560 -132.601901312242 53.97114945092  
## 5 OTUN RIVER      1561 -132.260106013    54.07328672     
## 6 BILL CREEK      1562 -132.395009112518 53.7494926521361

The DFO hatchery data file (emailed from Brock Ramshaw, DFO, 03/07/2023) is imported because it contains GFE_ID (i.e., STOCK_GFE_ID and REL_GFE_ID) and coordinates that are missing in the above DFO stream location file:

## # A tibble: 6 × 8
##   STOCK_GFE_ID STOCK_WATERBODY_NAME STOCK_LATITUDE STOCK_LONGITUDE REL_GFE_ID
##          <dbl> <chr>                         <dbl>           <dbl>      <dbl>
## 1         1001 TANKEEAH RIVER                 52.3           -128.       1001
## 2         1001 TANKEEAH RIVER                 52.3           -128.       1001
## 3         1001 TANKEEAH RIVER                 52.3           -128.      11611
## 4         1001 TANKEEAH RIVER                 52.3           -128.      11611
## 5         1001 TANKEEAH RIVER                 52.3           -128.       1001
## 6         1001 TANKEEAH RIVER                 52.3           -128.       1001
## # ℹ 3 more variables: REL_WATERBODY_NAME <chr>, REL_LATITUDE <dbl>,
## #   REL_LONGITUDE <dbl>

The regions and CUs shape files as defined in the PSE are imported:

2 Initial modifications

We remove from NUSEDS and CUSS data related to steelhead, Atlantic salmon and Kokanee salmon, corresponding to 967 rows and 133 populations (POP_ID) in NUSEDS and 0 in CUSS.

We create the column IndexId, which the the combination of the species acronym (i.e., CO, CM, CN, PKO, PKE, SX) and POP_ID:

## [1] "CN_48442"  "CO_590"    "CO_1794"   "CO_1844"   "CO_2172"   "PKE_51264"

We create the column MAX_ESTIMATE which is the maximum value of the fish count columns:

## [1] "NATURAL_ADULT_SPAWNERS"    "NATURAL_JACK_SPAWNERS"    
## [3] "NATURAL_SPAWNERS_TOTAL"    "ADULT_BROODSTOCK_REMOVALS"
## [5] "JACK_BROODSTOCK_REMOVALS"  "TOTAL_BROODSTOCK_REMOVALS"
## [7] "OTHER_REMOVALS"            "TOTAL_RETURN_TO_RIVER"

3 Fixes on NUSEDS and CUSS

The major issue in NuSEDS is the discrepancy between the two datasets. Normally, there should be the same population references (i.e., unique IndexId/POP_ID & GFE_ID combinations). But there are 11568 unique population references in NUSEDS and only 7145 in CUSS. Additionally, there are 4428 references in NUSEDS that are not in CUSS and 5 that are in CUSS but not in NUSEDS. This section consists in solving these discrepancies so that the same population references are present in both datasets.

3.1 Duplicated rows

There are 60 duplicated rows in NUSEDS when considering the following fields:

##  [1] "SPECIES"                   "POP_ID"                   
##  [3] "GFE_ID"                    "Year"                     
##  [5] "NATURAL_ADULT_SPAWNERS"    "NATURAL_JACK_SPAWNERS"    
##  [7] "NATURAL_SPAWNERS_TOTAL"    "ADULT_BROODSTOCK_REMOVALS"
##  [9] "JACK_BROODSTOCK_REMOVALS"  "TOTAL_BROODSTOCK_REMOVALS"
## [11] "OTHER_REMOVALS"            "TOTAL_RETURN_TO_RIVER"
##    SPECIES POP_ID GFE_ID Year MAX_ESTIMATE
## 1  Sockeye  44565   2489 1997           NA
## 2  Sockeye  44565   2489 1998           NA
## 3  Sockeye  44565   2489 2001           NA
## 4  Sockeye  44565   2489 2002           NA
## 5     Coho  44567   2489 1995           NA
## 6     Coho  44567   2489 1996           NA
## 7     Coho  44567   2489 1997            1
## 8     Coho  44567   2489 1998           12
## 9     Coho  44567   2489 1999           NA
## 10    Coho  44567   2489 2000           NA
## 11    Coho  44567   2489 2001           NA
## 12    Coho  44567   2489 2002           NA
## 13    Coho  44567   2489 2003           NA
## 14    Coho  44567   2489 2004           NA
## 15    Coho  44567   2489 2005           NA
## 16    Coho  44567   2489 2007           NA
## 17    Coho  44567   2489 2008           NA
## 18    Coho  44567   2489 2009           NA
## 19    Coho  44567   2489 2010           NA
## 20    Coho  44567   2489 2011           NA
## 21    Coho  44567   2489 2012           NA
## 22    Coho  44567   2489 2013           NA
## 23    Coho  44567   2489 2014           NA
## 24    Coho  44567   2489 2015           NA
## 25    Coho  44567   2489 2016           NA
## 26    Coho  44567   2489 2017           NA
## 27    Coho  44567   2489 2018           NA
## 28    Coho  44567   2489 2019           NA
## 29    Pink  44569   2489 1997           NA
## 30    Pink  44569   2489 1998           NA
## 31    Pink  44569   2489 2001           NA
## 32    Pink  44569   2489 2002           NA
## 33    Chum  44571   2489 1995           NA
## 34    Chum  44571   2489 1996           NA
## 35    Chum  44571   2489 1997          126
## 36    Chum  44571   2489 1998           93
## 37    Chum  44571   2489 1999           NA
## 38    Chum  44571   2489 2000           NA
## 39    Chum  44571   2489 2001           NA
## 40    Chum  44571   2489 2002           NA
## 41    Chum  44571   2489 2003           NA
## 42    Chum  44571   2489 2004           NA
## 43    Chum  44571   2489 2005           NA
## 44    Chum  44571   2489 2008           NA
## 45    Chum  44571   2489 2009           NA
## 46    Chum  44571   2489 2010           NA
## 47    Chum  44571   2489 2011           NA
## 48    Chum  44571   2489 2012           NA
## 49    Chum  44571   2489 2013           NA
## 50    Chum  44571   2489 2014           NA
## 51    Chum  44571   2489 2015           NA
## 52    Chum  44571   2489 2016           NA
## 53    Chum  44571   2489 2017           NA
## 54    Chum  44571   2489 2018           NA
## 55    Chum  44571   2489 2019           NA
## 56 Chinook  44573   2489 1997           NA
## 57 Chinook  44573   2489 1998           NA
## 58 Chinook  44573   2489 2001           NA
## 59 Chinook  44573   2489 2002           NA
## 60    Chum  51316   1174 2011           NA

These duplicated rows in NUSEDS are removed.

For CUSS, 0 duplicated rows are found:

##  [1] MAP_LABEL           GFE_ID              SYSTEM_SITE        
##  [4] GFE_TYPE            SPECIES_QUALIFIED   Y_LAT              
##  [7] X_LONGT             FAZ_ACRO            MAZ_ACRO           
## [10] JAZ_ACRO            CU_NAME             CU_ACRO            
## [13] CU_LAT              CU_LONGT            CU_TYPE            
## [16] CU_INDEX            FULL_CU_IN          SBJ_ID             
## [19] POP_ID              IS_INDICATOR        CMNTS              
## [22] EFFECTIVE_DT        WATERSHED_CDE       FWA_WATERSHED_CDE  
## [25] coordinates_changed SPECIES             species_acronym_ncc
## [28] IndexId            
## <0 rows> (or 0-length row.names)

These rows (if any) are removed as well.

3.2 Conflictual counts in NUSEDS

There are 1 instances where multiple MAX_ESTIMATE values are available in a same Year for a given population:

##    IndexId GFE_ID Year MAX_ESTIMATE
## 1 CN_46447    241 2016   494.000000
## 2 CN_46447    241 2016   475.414455

For each of these cases, we keep the observation with the maximum MAX_ESTIMATE value and remove the other(s) from NUSEDS:

##    IndexId GFE_ID Year MAX_ESTIMATE     ESTIMATE_CLASSIFICATION
## 1 CN_46447    241 2016   475.414455 RELATIVE ABUNDANCE (TYPE-4)
## 2 CN_46447    241 2016   494.000000 RELATIVE ABUNDANCE (TYPE-4)
##          ESTIMATE_METHOD remove
## 1 Calibrated Time Series   TRUE
## 2 Calibrated Time Series  FALSE

3.3 Remove the IndexId & GFE_ID time series in NUSEDS with only NAs and/or 0s

We remove these time series to reduce the amount of cleaning to do after. There is the option to remove series with (1) only NAs and 0s or (2) only NAs.

Decision made:

## [1] "Time series uniqually made of NAs are removed (those also containing 0s are kept)."

This procedure removes 101944 rows in NUSEDS, corresponding to 24.6% of the original dataset.

The data removed concerns 4424 time series, which are referenced in removed_all:

##     IndexId GFE_ID dataset                   comment
## 1 PKO_53054   1155  NUSEDS Only NAs for MAX_ESTIMATE
## 2 PKE_45947    413  NUSEDS Only NAs for MAX_ESTIMATE
## 3  CN_50404   1058  NUSEDS Only NAs for MAX_ESTIMATE
## 4  CM_43463   1745  NUSEDS Only NAs for MAX_ESTIMATE
## 5  CM_50368   1051  NUSEDS Only NAs for MAX_ESTIMATE
## 6  CN_44159   1907  NUSEDS Only NAs for MAX_ESTIMATE

Note that we do not remove these series in CUSS at this stage because they could be alternative series for the series in NUSEDS that do not appear in CUSS. It is only once series in NUSEDS absent in CUSS were found alternative series for, that we remove series in CUSS that have only NAs and/or 0s in NUSEDS.

3.4 Fix time series in CUSS that are not in NUSEDS

Look for each time series in CUSS (i.e., unique IndexId & GFE_ID association) and:

  1. check if there are IndexId associated to multiple locations (i.e., GFE_ID); if yes: trouble shoot manually because this should not happen: IndexId should be associated to one unique location.

  2. else look if there is a time series with the same IndexId & GFE_ID in NUSEDS; if yes: all good :-)

  3. else: that could be due to the wrong attribution of either (i) the IndexId or (ii) the GFE_ID. The rest of the code looks for potential alternative series in NUSEDS with either a different IndexId (but with the same species) or a different GFE_ID. Alternative series identified NOT present in CUSS are kept, the ones present are not considered.

The procedure returns a simple data frame with the IndexId & GFE_ID series concerned and associated comment and eventual potential alternative series that have to be checked manually after:

##     i   IndexId GFE_ID in_cuss in_nused
## 1  23 PKE_40049   1211     yes       no
## 2  32 PKE_52934   1143     yes       no
## 3  60 PKE_40149   1221     yes       no
## 4  62 PKE_50494    812     yes       no
## 5 112 PKO_46644    262     yes       no
## 6 176  CN_46842    285     yes       no
##                                                comment
## 1             There is no alternative series in NUSEDS
## 2             There is no alternative series in NUSEDS
## 3             There is no alternative series in NUSEDS
## 4             There is no alternative series in NUSEDS
## 5             There is no alternative series in NUSEDS
## 6 Alternative series: CN_46842 & 2463, CN_46841 &  285

There are 247 out of 7145 time series in CUSS that are not present in NUSEDS (i.e., 3.5%), and the vast majority of them do not have an alternative series in NUSEDS:

table(trackRecord$comment[cond])
## 
##        Alternative series: CN_46842 & 2463, CN_46841 &  285 
##                                                           1 
##                     Alternative series: PKE_54793433 & 1490 
##                                                           1 
##                           Alternative series: SX_47954 & 21 
##                                                           1 
## In CUSS: there are multiple GFE_IDs for CN_7479 : 133, 2373 
##                                                           1 
##                    There is no alternative series in NUSEDS 
##                                                         243

3.4.1 Alternative series present

The goal here is to go over all the cases where alternative series are available. The title of the figures below shows the focal series that is in CUSS but not in NUSEDS. The series on the top left corner are potential alternative series (i.e., they are present in NUSEDS but not in CUSS).

comment <- "Alternative series:"
trackRecord_cuss_alternative <- trackRecord[grepl(comment,trackRecord$comment),]
## [1] 3
##      i   IndexId GFE_ID in_cuss in_nused
## 1  176  CN_46842    285     yes       no
## 2 3489 PKE_42409   1490     yes       no
## 3 6685   SX_7763     21     yes       no
##                                                comment
## 1 Alternative series: CN_46842 & 2463, CN_46841 &  285
## 2              Alternative series: PKE_54793433 & 1490
## 3                    Alternative series: SX_47954 & 21

The focal CUSS time series CN_46842 & GFE_ID = 285 corresponds to the CU_NAME:

## [1] "MIDDLE FRASER RIVER_SP_1.3"

The two alternative time series are noted as two different runs, according to NUSEDS’s POPULATION:

## [1] "Chilcotin River (Williams Lake Area) Chinook Run 2"
## [2] "Chilcotin River (Williams Lake Area) Chinook Run 1"

Below are the focal and alternative location, and the distance between the two GFE_ID is 0 km:

##               SYSTEM_SITE GFE_ID     X_LONGT      Y_LAT
## 1 CHILCOTIN RIVER - LOWER   2463 -122.401309 51.7399528
## 2         CHILCOTIN RIVER    285 -122.401309 51.7399528

Decision: It was decided to merge the two time series CN_46842 & GFE_ID = 2463 and CN_46841 & GFE_ID = 285 to the series CN_46842 & GFE_ID = 285 in NUSEDS because there is only one timing for this Middle Fraser River (Spring 5-2) Chinook CU and the two series are complementary.

Decision: we replace PKE_54793433 & GFE_ID = 1490 by PKE_42409 & GFE_ID = 1490 in NUSEDS.

The two time series have the same CU_NAME in CUSS:

##   SX_7763  SX_47954 
## "WIDGEON" "WIDGEON"
## [1] "75 rows were edited in all_areas_nuseds at the following fields: SPECIES, POP_ID, species_acronym_ncc, IndexId"

Decision: Replace SX_47954 & GFE_ID = 21 by SX_7763 & GFE_ID = 21 in NUSEDS.

3.4.2 Alternative series not present in NUSEDS

The goal is to remove these IndexId & GFE_ID references from CUSS and to specify if they were simply not present in the original NUSEDS or only contained NAs and/or 0s.

comment <- "There is no alternative series in NUSEDS"
trackRecord_cuss_noAlernative <- trackRecord[grepl(comment,trackRecord$comment),]
## [1] 243
##     IndexId GFE_ID in_cuss in_nused                                  comment
## 1 PKE_40049   1211     yes       no There is no alternative series in NUSEDS
## 2 PKE_52934   1143     yes       no There is no alternative series in NUSEDS
## 3 PKE_40149   1221     yes       no There is no alternative series in NUSEDS
## 4 PKE_50494    812     yes       no There is no alternative series in NUSEDS
## 5 PKO_46644    262     yes       no There is no alternative series in NUSEDS
## 6   CM_3261   2637     yes       no There is no alternative series in NUSEDS

242 of the 243 IndexId & GFE_ID references were removed previously from NUSEDS because they contained only NAs and/or 0s. Only the following reference was not in NUSEDS initially:

##   GFE_ID   SYSTEM_SITE SPECIES_QUALIFIED      CU_NAME FULL_CU_IN
## 1    150 SEEBACH CREEK               SER UPPER FRASER     SER-06

3.4.3 Multiple GFE_IDs for a same IndexId (POP_ID) in CUSS

There should not be any IndexId associated to multiple GFE_ID (it is a MANY TO ONE relationship).

comment <- "In CUSS: there are multiple GFE_IDs for"
trackRecord_cuss_multi_fgeid <- trackRecord[grepl(comment,trackRecord$comment),]

This happens for 2 populations:

##      i  IndexId GFE_ID in_cuss in_nused
## 1 1169  CN_7479    133     yes       no
## 2 1169  CN_7479   2373     yes      yes
## 3 6288 SX_45525   2444     yes      yes
## 4 6288 SX_45525    303     yes      yes
##                                                        comment
## 1  In CUSS: there are multiple GFE_IDs for CN_7479 : 133, 2373
## 2  In CUSS: there are multiple GFE_IDs for CN_7479 : 133, 2373
## 3 In CUSS: there are multiple GFE_IDs for SX_45525 : 2444, 303
## 4 In CUSS: there are multiple GFE_IDs for SX_45525 : 2444, 303

The figure above only show the time series present in NUSEDS. The other time series is removed from CUSS.

These two time series of this CU (CU_NAME = NADINA/FRANCOIS-EARLY SUMMER TIMING, NADINA/FRANCOIS-EARLY SUMMER TIMING) should have a different IndexId (i.e. POP_ID). We keep them as is and do not make any change to NUSEDS and CUSS.

3.5 Fix populations in NUSEDS that are not in CUSS

The goal is to look for each IndexId & GFE_ID series in NUSEDS that are not in CUSS and to:

  1. Look if there are alternative series in NUSEDS that are also present in CUSS
  • if not, add the IndexId & GFE_ID reference in CUSS

  • if yes, see if the alternative series can be merged; if not, add the IndexId & GFE_ID reference to CUSS

  1. Use the PSE’s CUs’ shape files for those without alternative series.

There are 242 IndexId & GFE_ID references in NUSEDS that are not present in CUSS, for instance:

##   IndexId GFE_ID nb_dataPt alternative_IndexId alternative_GFE_ID
## 1 CM_1622     11         2                none               none
## 2 CM_2434      4        11                none               none
## 3  CM_297     14         1            CM_47925               none
## 4 CM_3212   2487         4                none               none
## 5 CM_3305  11486        15                none              11485
## 6 CM_3305  11487         2                none              11485

3.5.1 Alternative IndexId (POP_ID) AND no alternative GFE_ID

The section concerns focal IndexId & GFE_ID time series in NUSEDS that are not in CUSS and for which there are alternative series in CUSS with the same IndexId but a different GFE_ID. The goal is to compare the focal vs. the alternative time series and take the following actions:

  • if the time series are 100% complementary: merge them (i.e., edit IndexId in NUSEDS)

  • if the time series are 100% duplicated: remove the focal series in NUSEDS

  • if the series are partially conflictual or if there are multiple potential alternative series: trubble shoot manually

There are 12 time series concerned:

##     IndexId GFE_ID nb_dataPt alternative_IndexId
## 1    CM_297     14         1            CM_47925
## 2   CN_3331   1156        13 CN_53068 ; CN_53069
## 3   CN_3334   1194        36 CN_51519 ; CN_51518
## 4  CN_39983   1204         7            CN_39984
## 5   CN_7751   1208         1 CN_40023 ; CN_40024
## 6   CN_7809    442        18            CN_48442
## 7   CO_7776   2243         5             CO_3136
## 8   SX_3438   2434         6            SX_45085
## 9  SX_46279    224         5            SX_46278
## 10 SX_46308    227        14            SX_46309
## 11  SX_7639  26771         2             SX_7636
## 12  SX_7823    298        47            SX_46023

The figures below show for each of these cases the decision made. The figures also show the POPULATION of focal and alternative IndexId. The i at the bottom left of each plot is used after to reference the figures when fixing time series manually. Several cases are set aside to be manually fixed after.

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CM_47925     14           100         0        0       NA         1
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CN_53068   1156           100         0        0       NA        13
## 2 CN_53069   1156           100         0        0       NA        13
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CN_51519   1194            90         0       10       NA        36
## 2 CN_51518   1194           100         0        0       NA        36
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CN_39984   1204            70         0       30       NA         7
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CN_40023   1208           100         0        0       NA         1
## 2 CN_40024   1208             0         0      100       NA         1
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CN_48442    442           100         0        0       NA        18
## [1] "***"
## [1] "Number of rows removed from dataframe = 5"

##   IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 CO_3136   2243             0       100        0       NA         5
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 SX_45085   2434             0        30       70       NA         6
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 SX_46278    224             0         0      100       NA         5
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 SX_46309    227            40        40       20       NA        14
## [1] "***"

##   IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 SX_7636  26771             0        50       50       NA         2
## [1] "***"

##    IndexId GFE_ID complementary duplicate conflict decision nb_dataPt
## 1 SX_46023    298           100         0        0       NA        47
## [1] "***"

We now assess the cases set aside.

In the case i = 1 above, series CM_297 - 14 is merged to the alternative series despite the potential mismatch in “Run” because there is only one Chum CU in the Fraser. Its IndexId is change from CM_297 to CM_47925 in NUSEDS.

In the case i = 2 above, series CN_3331 - 1156 was not merged to any of the alternative series because of its unknown run timing (see below). It is consequently removed from NUSEDS.

##    IndexId        type                               POPULATION
## 1  CN_3331       focal Puntledge River Chinook (unknown timing)
## 2 CN_53068 alternative           Puntledge River Spring Chinook
## 3 CN_53069 alternative             Puntledge River Fall Chinook

In the case i = 3 above, series CN_3334 - 1194 was initially going to be merged to the alternative series with which is was 100% compatible. But is was decided to remove it from NUSEDS because its run timing is unknown:

##    IndexId        type                             POPULATION
## 1  CN_3334       focal Nanaimo River Chinook (unknown timing)
## 2 CN_51519 alternative             Nanaimo River Fall Chinook
## 3 CN_51518 alternative           Nanaimo River Summer Chinook

In the case i = 4 above, series CN_39983 - 1204 was not merged to the alternative series because of different run timings:

##    IndexId        type                     POPULATION
## 1 CN_39983       focal Chemainus River Summer Chinook
## 2 CN_39984 alternative   Chemainus River Fall Chinook

It was decided instead to associate the population CN_39983 to the CU East Vancouver Island-Georgia Strait (Summer 4-1) in the PSE because of the same run timing and the fact that the Chemainus river is connected to this CU. The corresponding CU_NAME in CUSS is:

## [1] "EAST VANCOUVER ISLAND-GEORGIA STRAIT_SU_0.3"

The reference of the CN_39983 - 1204 time series is added to CUSS. The CU-related fields in CUSS are filled with the values corresponding to the above CU_NAME. Here below is the row added to CUSS:

##   MAP_LABEL GFE_ID     SYSTEM_SITE GFE_TYPE SPECIES_QUALIFIED      Y_LAT
## 1        NA   1204 CHEMAINUS RIVER   Stream                CK 48.8979258
##       X_LONGT FAZ_ACRO MAZ_ACRO JAZ_ACRO
## 1 -123.673181      EVI     GStr EVI+GStr
##                                       CU_NAME     CU_ACRO     CU_LAT
## 1 EAST VANCOUVER ISLAND-GEORGIA STRAIT_SU_0.3 EVIGStr-sum 49.5622666
##      CU_LONGT CU_TYPE CU_INDEX FULL_CU_IN SBJ_ID POP_ID IS_INDICATOR CMNTS
## 1 -125.201122 Current       83      CK-83     NA  39983         <NA>  <NA>
##   EFFECTIVE_DT                                            WATERSHED_CDE
## 1         <NA> 920-303500-00000-00000-0000-0000-000-000-000-000-000-000
##                                                                                                                                 FWA_WATERSHED_CDE
## 1 920-302830-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000-000000
##   coordinates_changed SPECIES species_acronym_ncc  IndexId
## 1               FALSE Chinook                  CN CN_39983

In the case i = 5 above with the focal series CN_7751 - 1208, both alternative series belong to the same fall Chinook CU (CU_NAME = EAST VANCOUVER ISLAND-COWICHAN AND KOKSILAH_FA_0.x). The focal series is consequently deleted from NUSEDS because its POPULATION indicates it is a summer population, for which there is no CU in the PSE at this location.

In the case i = 6 above, series CN_7809 - 442 can be merged to the alternative series CN_48442 - 442 with which it is 100% compatible. The run timing indicated in POPULATION in NUSEDS are not incompatible:

##                                      CN_7809 
## "Okanagan River (Salmon Arm) Summer Chinook" 
##                                     CN_48442 
##  "Okanagan River (Salmon Arm) Chinook Run 1"

However, we decide to merge the alternative time series to the focal one (i.e., change CN_48442 - 442 to CN_7809 - 442) instead of the contrary because the latter is longer and more recent. Consequently both NUSEDS and CUSS are edited.

## [1] "1 rows were edited in conservation_unit_system_sites at the following fields: POP_ID, SPECIES, species_acronym_ncc, IndexId"
## [1] "4 rows were edited in all_areas_nuseds at the following fields: SPECIES, POPULATION, RUN_TYPE, POP_ID, species_acronym_ncc, IndexId"

In the case i = 7 above, the focal series CO_7776 - 2243 is removed from NUSEDS because it is 100% duplicated with the alternative series CO_3136 - 2243.

In the case i = 8 above, the focal series SX_3438 - 2434 has the POPULATION = Loftus Creek Late Sockeye, which corresponds to the CU_NAME = “SHUSWAP COMPLEX-LATE TIMING” in CUSS. We consequently do not merge the two series but add the reference of the focal series in CUSS to the SHUSWAP COMPLEX-LATE TIMING CU.

In the case i = 9 above, the focal series SX_46279 - 224 has the POPULATION = Cayenne Creek (Clearwater) Late Sockeye, which does not correspond to any CU_NAME in CUSS. The data cannot be merged to the alternative series SX_46278 - 224 because of different run timing. It is consequently deleted from NUSEDS.

In the case i = 10 above, the focal series SX_46308 - 227 has the POPULATION = Ross Creek (Salmon Arm) Early Summer Sockeye, which corresponds to the CU_NAME = “SHUSWAP COMPLEX-EARLY SUMMER TIMING” in CUSS. We consequently do not merge the two series but add the reference of the focal series in CUSS to the SHUSWAP COMPLEX-LATE TIMING CU.

In the case i = 11 above, the focal series SX_7639 - 26771 has the POPULATION = Four Mile Creek (Salmon Arm) Late Sockeye, which corresponds to the CU_NAME = “SHUSWAP COMPLEX-LATE TIMING” in CUSS. We consequently do not merge the two series but add the reference of the focal series in CUSS to the SHUSWAP COMPLEX-LATE TIMING CU.

In the case i = 12 above, the focal series SX_7823 - 298 is merged to the alternative series (indexId is changed from SX_7823 to SX_46023 in NUSEDS) because the focal POPULATION (= Ormond Creek (Prince George) Early Summer Sockeye) is compatible with the alternative CU_NAME (= FRASER-EARLY SUMMER TIMING).

## [1] "47 rows were edited in all_areas_nuseds at the following fields: SPECIES, POPULATION, RUN_TYPE, POP_ID, species_acronym_ncc, IndexId"

Note that could be a mismatch between the alternative POPULATION (= Ormond Creek (Prince George) Summer Sockeye) and its its own CU_NAME (= FRASER-EARLY SUMMER TIMING) (FULL_CU_IN = SEL-06-06), and could instead be better associated with the CU with CU_NAME = FRANCOIS/FRASER-SUMMER TIMING (FULL_CU_IN = SEL-06-07). We are not making any change in that regard.

3.5.2 Alternative GFE_ID

The focal time series (i.e., a unique IndexId - GFE_ID not in CUSS) are compared to alternative series with a different GFE_ID and potentially a different IndexId (but of the same species).

There are 64 time series concerned:

##      IndexId     GFE_ID nb_dataPt alternative_IndexId alternative_GFE_ID
## 1    CM_3305      11486        15                none              11485
## 2    CM_3305      11487         2                none              11485
## 3    CM_3305      11488         3                none              11485
## 4   CM_46984       2529         2                none                 62
## 5   CM_47906        441         2                none                  3
## 6   CM_47907          5         1                none                  7
## 7   CM_47925         15         8            CM_47928                 14
## 8   CM_47925         17         3            CM_47939                 14
## 9   CM_47925      31516         8                none                 14
## 10  CM_47925      31740         8                none                 14
## 11  CM_50616       2618         8                none                824
## 12  CM_50616  446068199         1                none                824
## 13   CN_2178        129         5            CN_47189               2476
## 14   CN_3306      11486        38                none              11485
## 15   CN_3306      11487         3                none              11485
## 16   CN_3306      11488         4                none              11485
## 17   CN_3333       1194         3 CN_51519 ; CN_51518              23735
## 18  CN_44577       2518         1            CN_44599               2492
## 19  CN_46801      33103         1                none                281
## 20  CN_46891       2466         2                none                290
## 21  CN_46891       2467         5                none                290
## 22  CN_46892       2466        23                none                290
## 23  CN_47277       2464        46                none                142
## 24  CN_48448      19723         1                none                443
## 25  CN_50618       2618         8                none                824
## 26  CN_50618  446068199         1                none                824
## 27   CO_3303      11487         3                none              11485
## 28   CO_3303      11488         3                none              11485
## 29  CO_44539        129         5            CO_47183               2476
## 30  CO_44539       2451        14                none               2476
## 31  CO_46170       2453         2            CO_44736                213
## 32  CO_46170       2461         7                none                213
## 33  CO_46170      54282         5                none                213
## 34  CO_46170      54283         2                none                213
## 35  CO_46240        221         2            CO_46250                220
## 36  CO_46240       3477         2                none                220
## 37  CO_46582 1754239945        14                none                256
## 38  CO_46582 2049268617        21                none                256
## 39  CO_46582      33045        21                none                256
## 40  CO_46582      57041         6                none                256
## 41  CO_46582      63379         4                none                256
## 42  CO_46582  719256264        23                none                256
## 43  CO_46602  212716981        22                none                258
## 44  CO_46602       2746         6            CO_46632                258
## 45  CO_46632        261         9                none               2746
## 46  CO_46795 1921661712        15                none                281
## 47  CO_46795      33103        16                none                281
## 48  CO_46835       2463         2                none                285
## 49  CO_47183       2451         2                none                129
## 50  CO_50612       2618         6                none                824
## 51  CO_50612  446068199         1                none                824
## 52  PKE_3304      11486         3                none              11485
## 53 PKE_50614       2618         6                none                824
## 54  PKO_3304      11486         4                none              11485
## 55 PKO_50614       2618         7                none                824
## 56 PKO_50614  446068199         2                none                824
## 57 PKO_51094  489440637         1                none                872
## 58   SX_3302       3416        23             SX_3310              11485
## 59   SX_3302       3444        23             SX_3325              11485
## 60   SX_3416       2746        41                none                261
## 61  SX_45141       2119         1                none               2193
## 62  SX_45182       1327         1            SX_52310            7990630
## 63  SX_50610       2618        13                none                824
## 64  SX_50610  446068199         3                none                824

Notice in the table above that several time series have the same IndexId. Again this is problematic because normally only one GFE_ID can be associated to a given IndexId (i.e., POP_ID). We show here after the focal time series grouped with their alternative series. On top of each figure is shown the POPULATION and WATERBODY associated with each IndexId (i.e., POP_ID) and GFE_ID, respectively. Belong each figure is shown a summary table providing the number of data points (nb_dataPt) and the % of them that are complementary, duplicate and in conflict compared with the alternative series. The decision made in each case are provided after the figures, using the index i shown at the bottom left of the plots for reference.

## [1] "*** i = 1 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CM_3305  11486            NA        11485        15           100         0
## 2 CM_3305  11487            NA        11485         2           100         0
## 3 CM_3305  11488            NA        11485         3           100         0
##   conflict
## 1        0
## 2        0
## 3        0

## [1] "*** i = 2 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_3306  11486            NA        11485        38           100         0
## 2 CN_3306  11487            NA        11485         3           100         0
## 3 CN_3306  11488            NA        11485         4           100         0
##   conflict
## 1        0
## 2        0
## 3        0

## [1] "*** i = 3 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_3303  11487            NA        11485         3           100         0
## 2 CO_3303  11488            NA        11485         3           100         0
##   conflict
## 1        0
## 2        0

## [1] "*** i = 4 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 PKE_3304  11486            NA        11485         3           100         0
##   conflict
## 1        0

## [1] "*** i = 5 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 PKO_3304  11486            NA        11485         4           100         0
##   conflict
## 1        0

## [1] "*** i = 6 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 SX_3302   3416          <NA>        11485        23           100         0
## 2 SX_3302   3444          <NA>        11485        23           100         0
## 3 SX_3302   3416       SX_3310         <NA>        23           100         0
## 4 SX_3302   3444       SX_3325         <NA>        23           100         0
##   conflict
## 1        0
## 2        0
## 3        0
## 4        0

## [1] "*** i = 7 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_47183   2451            NA          129         2           100         0
##   conflict
## 1        0

## [1] "*** i = 8 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CM_47925     15          <NA>           14         8            90         0
## 2 CM_47925     17          <NA>           14         3           100         0
## 3 CM_47925  31516          <NA>           14         8            90        10
## 4 CM_47925  31740          <NA>           14         8            90         0
## 5 CM_47925     15      CM_47928         <NA>         8           100         0
## 6 CM_47925     17      CM_47939         <NA>         3           100         0
##   conflict
## 1       10
## 2        0
## 3        0
## 4       10
## 5        0
## 6        0

## [1] "*** i = 9 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_47277   2464            NA          142        46           100         0
##   conflict
## 1        0

## [1] "*** i = 10 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_46170   2453          <NA>          213         2           100         0
## 2 CO_46170   2461          <NA>          213         7           100         0
## 3 CO_46170  54282          <NA>          213         5           100         0
## 4 CO_46170  54283          <NA>          213         2           100         0
## 5 CO_46170   2453      CO_44736         <NA>         2           100         0
##   conflict
## 1        0
## 2        0
## 3        0
## 4        0
## 5        0

## [1] "*** i = 11 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 SX_45141   2119            NA         2193         1           100         0
##   conflict
## 1        0

## [1] "*** i = 12 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_46240    221          <NA>          220         2           100         0
## 2 CO_46240   3477          <NA>          220         2           100         0
## 3 CO_46240    221      CO_46250         <NA>         2           100         0
##   conflict
## 1        0
## 2        0
## 3        0

## [1] "*** i = 13 ***"
##   IndexId GFE_ID       IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CN_3333   1194                <NA>        23735         3           100
## 2 CN_3333   1194 CN_51519 ; CN_51518         <NA>         3           100
##   duplicate conflict
## 1         0        0
## 2         0        0

## [1] "*** i = 14 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_2178    129          <NA>         2476         5            80         0
## 2 CN_2178    129      CN_47189         <NA>         5           100         0
##   conflict
## 1       20
## 2        0

## [1] "*** i = 15 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_44539    129          <NA>         2476         5           100         0
## 2 CO_44539   2451          <NA>         2476        14            90         0
## 3 CO_44539    129      CO_47183         <NA>         5           100         0
##   conflict
## 1        0
## 2       10
## 3        0

## [1] "*** i = 16 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_44577   2518          <NA>         2492         1           100         0
## 2 CN_44577   2518      CN_44599         <NA>         1           100         0
##   conflict
## 1        0
## 2        0

## [1] "*** i = 17 ***"
##    IndexId     GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CO_46582 1754239945            NA          256        14           100
## 2 CO_46582 2049268617            NA          256        21           100
## 3 CO_46582      33045            NA          256        21           100
## 4 CO_46582      57041            NA          256         6           100
## 5 CO_46582      63379            NA          256         4           100
## 6 CO_46582  719256264            NA          256        23           100
##   duplicate conflict
## 1         0        0
## 2         0        0
## 3         0        0
## 4         0        0
## 5         0        0
## 6         0        0

## [1] "*** i = 18 ***"
##    IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CO_46602 212716981          <NA>          258        22            60
## 2 CO_46602      2746          <NA>          258         6            80
## 3 CO_46602      2746      CO_46632         <NA>         6           100
##   duplicate conflict
## 1         0       40
## 2         0       20
## 3         0        0

## [1] "*** i = 19 ***"
##   IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 SX_3416   2746            NA          261        41           100         0
##   conflict
## 1        0

## [1] "*** i = 20 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_46632    261            NA         2746         9           100         0
##   conflict
## 1        0

## [1] "*** i = 21 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_46801  33103            NA          281         1             0         0
##   conflict
## 1      100

## [1] "*** i = 22 ***"
##    IndexId     GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CO_46795 1921661712            NA          281        15           100
## 2 CO_46795      33103            NA          281        16           100
##   duplicate conflict
## 1         0        0
## 2         0        0

## [1] "*** i = 23 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CO_46835   2463            NA          285         2           100         0
##   conflict
## 1        0

## [1] "*** i = 24 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_46891   2466            NA          290         2             0         0
## 2 CN_46891   2467            NA          290         5             0       100
##   conflict
## 1      100
## 2        0

## [1] "*** i = 25 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_46892   2466            NA          290        23            80        10
##   conflict
## 1        0

## [1] "*** i = 26 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CM_47906    441            NA            3         2            50         0
##   conflict
## 1       50

## [1] "*** i = 27 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CN_48448  19723            NA          443         1           100         0
##   conflict
## 1        0

## [1] "*** i = 28 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CM_46984   2529            NA           62         2             0         0
##   conflict
## 1      100

## [1] "*** i = 29 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 CM_47907      5            NA            7         1             0         0
##   conflict
## 1      100

## [1] "*** i = 30 ***"
##    IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 SX_45182   1327          <NA>      7990630         1           100         0
## 2 SX_45182   1327      SX_52310         <NA>         1           100         0
##   conflict
## 1        0
## 2        0

## [1] "*** i = 31 ***"
##    IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CM_50616      2618            NA          824         8            40
## 2 CM_50616 446068199            NA          824         1             0
##   duplicate conflict
## 1         0       60
## 2         0      100

## [1] "*** i = 32 ***"
##    IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CN_50618      2618            NA          824         8             0
## 2 CN_50618 446068199            NA          824         1             0
##   duplicate conflict
## 1         0      100
## 2         0      100

## [1] "*** i = 33 ***"
##    IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 CO_50612      2618            NA          824         6             0
## 2 CO_50612 446068199            NA          824         1             0
##   duplicate conflict
## 1         0      100
## 2         0      100

## [1] "*** i = 34 ***"
##     IndexId GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary duplicate
## 1 PKE_50614   2618            NA          824         6             0         0
##   conflict
## 1      100

## [1] "*** i = 35 ***"
##     IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 PKO_50614      2618            NA          824         7            10
## 2 PKO_50614 446068199            NA          824         2            50
##   duplicate conflict
## 1         0       90
## 2         0       50

## [1] "*** i = 36 ***"
##    IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 SX_50610      2618            NA          824        13            20
## 2 SX_50610 446068199            NA          824         3            70
##   duplicate conflict
## 1         0       80
## 2         0       30

## [1] "*** i = 37 ***"
##     IndexId    GFE_ID IndexId_alter GFE_ID_alter nb_dataPt complementary
## 1 PKO_51094 489440637            NA          872         1           100
##   duplicate conflict
## 1         0        0

In case i = 1: series CM_3305 - 11486 is not merged to alternative series CM_3305 - 11485 because these are different streams. Consequently, the reference of the focal series is added to CUSS. There other focal two time series CM_3305 - 11487 and CM_3305 - 11488 are removed from NUSEDS because they only have < 4 data points and are anterior to 2020.

Note that GFE_ID = 11485 is present in the DFO streams file (under ID) but coordinates are not:

## # A tibble: 1 × 4
##   NME                            ID X_LONGT Y_LAT
##   <chr>                       <dbl> <chr>   <chr>
## 1 WATERSHED ABOVE STAMP FALLS 11486 <NA>    <NA>

However, the GFE_ID and coordinates are in the DFO hatchery file so we use these values:

##   STOCK_GFE_ID STOCK_WATERBODY_NAME STOCK_LATITUDE STOCK_LONGITUDE
## 1        11486          STAMP RIVER      49.329344     -124.912868

In case i = 2: series CN_3306 - 11486 in green is not merged to alternative series CN_3306 - 11485 in red for the same reason as above; its reference are instead added to CUSS. The other focal series CN_3306 - 11487 and CN_3306 - 11488 are deleted because they have <= 4 data points and are anterior to 2020.

In case i = 3: focal series CO_3303 - 11487 and CO_3303 - 11488 are removed from NUSEDS because their GFE_ID correspond to different locations, they have < 4 data points and they are anterior to 2020.

In case i = 4: series PKE_3304 - 11486 in blue is not merged to alternative series PKE_3304 - 11485 in red for the same reason as above; its reference are instead added to CUSS.

In case i = 5: series PKO_3304 - 11486 in blue is not merged to alternative series PKO_3304 - 11485 in red for the same reason as above; its reference are instead added to CUSS.

In case i = 6: series PKO_3302 - 3416 in black (bottom plot) is merged to alternative series SX_3310 - 3416 in red and series PKO_3302 - 3444 in blue (bottom plot) is merged to alternative series SX_3325 - 3444 in green.

In case i = 7: series CO_47183 - 2451 in blue is merged to alternative series CO_47183 - 129 in red because the location of the focal series leads to the location of the alternative series.

In case i = 8: the focal series CM_47925 - 15 in red (bottom plot) is merged to the alternative series CM_47928 - 15 in back (bottom plot).

Similarly, the focal series CM_47925 - 17 in green (bottom plot) is merged to the alternative series CM_47939 - 17 in blue (bottom plot).

The other two focal series CM_47925 - 31516 in black (top plot) and CM_47925 - 31740 in blue (top plot) are added to CUSS. Their GFE_IDs are not in CUSS and their are in the DFO streams file.

In case i = 9: it is a special situation deserving more attention. There are two different issues related to CN_47277: (1) it is associated to two locations (GFE_IDs) and (2) in one location (GFE_ID = 142), there is another time series with IndexId = CN_2483, which belong to the same CU:

The SYSTEM_SITE for GFE_ID = 142 is:

##   SYSTEM_SITE GFE_ID     X_LONGT     Y_LAT
## 1 SWIFT RIVER    142 -122.115545 53.015621

The GFE_ID = 2464 is not in CUSS but it is in the DFO streams file but does not have coordinates:

## # A tibble: 1 × 4
##   NME                         ID X_LONGT Y_LAT
##   <chr>                    <dbl> <chr>   <chr>
## 1 COTTONWOOD RIVER - LOWER  2464 <NA>    <NA>

Notice above that the NME (= SYSTEM_SITE) for ID (= GFE_ID) = 2464 matches the POPULATION of CN_47277, which is not the case for GFE_ID = 142:

##    IndexId                               POPULATION
## 1 CN_47277 Cottonwood River (Quesnel) Chinook Run 1
## 2  CN_2483      Swift River (Quesnel) Chinook Run 1

DECISION: we decide to merge the alternative series CN_47277 - 142 to the focal series CN_47277 - 2464 in NUSEDS and to add CN_47277 - 2464 to CUSS (and to then remove CN_47277 - 142 from CUSS):

As show above, there is no coordinates for the location with GFE_ID = 2464. We consequently defined them manually using Google Maps; they corresponds to the mouth of Cottonwood river:

##                SYSTEM_SITE GFE_ID     X_LONGT     Y_LAT
## 1 COTTONWOOD RIVER - LOWER   2464 -122.610584 53.119965

In case i = 10: the focal series CO_46170 - 2461 in dark green (top plot) is merged to the alternative series CO_46170 - 213 in red.

## [1] "7 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"

The other focal series CO_46170 - 54282 in black (“DAM”; top plot) is instead added to CUSS. Its GFE_ID is not in CUSS:

## [1] SYSTEM_SITE GFE_ID      Y_LAT       X_LONGT    
## <0 rows> (or 0-length row.names)

It is also not in the DFO hatchery file

## # A tibble: 0 × 3
## # ℹ 3 variables: REL_GFE_ID <dbl>, REL_LATITUDE <dbl>, REL_LONGITUDE <dbl>

It is in the DFO streams file but without coordinates:

## # A tibble: 1 × 4
##   NME                   ID Y_LAT X_LONGT
##   <chr>              <dbl> <chr> <chr>  
## 1 NICOLA RIVER (DAM) 54282 <NA>  <NA>

We consequently define the coordinates manually using Google Maps:

##           SYSTEM_SITE GFE_ID     Y_LAT     X_LONGT
## NA NICOLA RIVER (DAM)  54282 50.163045 -120.665873

The focal series CO_46170 - 54283 is removed because it does not have coordinates, it is unclear what “(DOT)” stands for and there is only two data points.

Finally, the focal series CO_46170 - 2453 in red (bottom plot) is merged to the alternative series CO_44736 - 2453 in blue.

## [1] "2 rows were edited in all_areas_nuseds at the following fields: SPECIES, POPULATION, RUN_TYPE, POP_ID, species_acronym_ncc, IndexId"

In case i = 11: the focal series SX_45141 - 2119 in blue is not merged to SX_45141 - 2119 because the two location are far apart; it is instead added to CUSS.

In case i = 12: the focal series CO_46240 - 221 is merged to the alternative series CO_46250 - 221 (bottom plot) because the two POPULATIONs belong to the same CU_NAME = SOUTH THOMPSON and the time series are compatible:

##   nb_dataPt complementary duplicate conflict
## 1         2             2         0        0

The GFE_ID of the other focal series CO_46240 - 3477 is not in CUSS but it is in the DFO streams file and we can see that its coordinates are very similar to the coordinates of the alternative time series:

## # A tibble: 2 × 4
##   NME                    ID Y_LAT            X_LONGT          
##   <chr>               <dbl> <chr>            <chr>            
## 1 ADAMS RIVER           220 50.8943855175699 -119.554135949561
## 2 ADAMS RIVER - LOWER  3477 50.893862861     -119.550567544

The second focal series CO_46240 - 3477 is consequently merged to the alternative series CO_46240 - 220 in NUSEDS.

In case i = 13: the focal series CN_3333 - 1194 is not merged to the alternative series CN_3333 - 23735 (top plot) because the two locations are two far apart; it is added to CUSS instead.

In case i = 14: the focal series CN_2178 - 129 in blue is a duplicate of the atlernative series CN_47189 - 129 in red (bottom plot); it is consequently removed from NUSEDS.

In case i = 15: the focal series CO_44539 - 2451 in blue (top plot) is not merged to the alternative series CO_44539 - 2476 in red because of a conflicting point; its reference is instead added to CUSS. The second focal series CO_44539 - 129 in blue (bottom plot) is not merged to the alternative series CO_47183 - 129 in red, notably because this would create a conflict with the merge done with series CO_47183 - 2451 at step i = 7.

In case i = 16: there is a clear discrepancy between focal series CN_44577 - 2518’s POPULATION = Chandindu River (Yukon/Arctic) Chinook and its SYSTEM_SITE = rS SYSTEM_SITE: these two locations are very far apart. We decide to merge it to the alternative series CN_44599 - 2518 (bottom plot) by changing its IndexId/POP_ID.

In case i = 17: all 6 focal series are added to CUSS. Their GFE_ID are present in the DFO streams but the coordinates are missing for most of them:

## # A tibble: 6 × 4
##   NME                                                   ID X_LONGT     Y_LAT   
##   <chr>                                              <dbl> <chr>       <chr>   
## 1 BIRCH ISLAND CHANNEL                               33045 <NA>        <NA>    
## 2 UPPER NORTH THOMPSON RIVER MAINSTEM           2049268617 <NA>        <NA>    
## 3 MIDDLE NORTH THOMPSON RIVER MAINSTEM          1754239945 <NA>        <NA>    
## 4 PIG CHANNEL COMBINED                           719256264 <NA>        <NA>    
## 5 UPPER NORTH THOMPSON RIVER-MILEDGE CONFLUENCE      57041 <NA>        <NA>    
## 6 ENGINEERED CHANNEL                                 63379 -119.860244 51.58644

The coordinates are consequently defined manually using Google Maps and the map in page 31 of Arbeider et al. 2020. Interior Fraser Coho Salmon Recovery Potential Assessment:

##                                     SYSTEM_SITE     GFE_ID     X_LONGT
## 1                          BIRCH ISLAND CHANNEL      33045 -119.889197
## 2           UPPER NORTH THOMPSON RIVER MAINSTEM 2049268617 -119.177796
## 3          MIDDLE NORTH THOMPSON RIVER MAINSTEM 1754239945 -119.701668
## 4                          PIG CHANNEL COMBINED  719256264 -119.810014
## 5 UPPER NORTH THOMPSON RIVER-MILEDGE CONFLUENCE      57041 -119.173514
## 6                            ENGINEERED CHANNEL      63379 -119.860244
##       Y_LAT
## 1 51.598602
## 2 52.345236
## 3 51.593091
## 4 51.579465
## 5 52.281312
## 6  51.58644

In case i = 18: the focal series CO_46602 - 2746 in blue (bottom plot) is merged to the alternative series CO_46632 - 2476 in red. The other focal series CO_46602 - 212716981 in green (top plot) is added to CUSS.

In case i = 19: the focal series SX_3416 - 2746 in blue (bottom plot) is merged to the alternative series SX_3416 - 261 in red.

In case i = 20: the focal series CO_46632 - 261 in blue (bottom plot) is merged to the alternative series CO_46632 - 2746 in red.

In case i = 21: the focal series CN_46801 - 33103 is removed from NUSEDS because its value is almost a duplicate of the value in the alternative series for this one year.

In case i = 22: the focal series CO_46795 - 33103 in blue is merged to the alternative series CO_46795 - 281 in red. The other focal series CO_46795 - 1921661712 in green is added to CUSS. Its GFE_ID is in the DFO streams file but coordinates are not:

## # A tibble: 2 × 4
##   NME                        ID X_LONGT       Y_LAT       
##   <chr>                   <dbl> <chr>         <chr>       
## 1 BLUE RIVER - LOWER      33103 -119.27964147 52.104610605
## 2 BLUE RIVER - UPPER 1921661712 <NA>          <NA>

The coordinates are consequently defined manually using Google Maps:

##          SYSTEM_SITE     GFE_ID     Y_LAT     X_LONGT
## 1 BLUE RIVER - UPPER 1921661712 52.112252 -119.289006

In case i = 23: the two locations are the same:

##               SYSTEM_SITE GFE_ID      Y_LAT     X_LONGT
## 1 CHILCOTIN RIVER - LOWER   2463 51.7399528 -122.401309
## 2         CHILCOTIN RIVER    285 51.7399528 -122.401309

Because the focal series CO_46835 - 2463 is much more recent that the alternative series CO_46835 - 285, it the latter that is modified in CUSS (i.e., the GFE_ID of the alternative series is changed to the one of the focal series) and in NUSEDS.

## [1] "1 rows were edited in conservation_unit_system_sites at the following fields: GFE_ID, SYSTEM_SITE, GFE_TYPE, Y_LAT, X_LONGT, WATERSHED_CDE, FWA_WATERSHED_CDE, coordinates_changed"
## [1] "5 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"

In case i = 24: the focal series CN_46891 - 2467 in blue is a duplicate of the alternative series CN_46891 - 290 in red; it is consequently removed from NUSEDS. The other focal series CN_46891 - 2466 is not merge to the alternative series because the two locations are far apart (also we could be counting fish twice here); it is added to CUSS instead.

In case i = 25: the focal series CN_46892 - 2466 in blue has three duplicated points with the alternative time series CN_46892 - 290 in red, and a conflicting point. However, this conflicting point in the alternative time series is a duplicated point in the third time series CN_46891 - 290 in purple in the bottom plot below. We consequently (1) remove the duplicated point in the alternative series (in red) and (2) merge the focal series to the latter.

In case i = 26: the focal series CM_47906 - 441 in blue is not merged to the alternative series because the points are conflictual; it is added to CUSS instead. Its GFE_ID (- 441) is not in CUSS but the coordinates were found in the DFO streams file:

## # A tibble: 1 × 4
##   NME            ID X_LONGT        Y_LAT       
##   <chr>       <dbl> <chr>          <chr>       
## 1 EAGLE CREEK   441 -122.935076432 49.243360825

In case i = 27: the focal series CN_48448 - 443 in blue is merged to the alternative series.

In case i = 28: the focal series CM_46984 - 2529 is added to CUSS instead of being merged to the alternative series because the two series are not compatible and in two different locations.

In case i = 29: the focal series CM_47907 - 5 is removed from NUSEDS because it only has one data point, it is conflictual with the alternative series and it is anterior to 2020.

In case i = 30: the focal series SX_45182 - 1327 is merged to the alternative series SX_45182 - 7990630 (top plot) because locations are very close and the one data point is compatible.

In the cases (i = 31, 32, 33, 34, 35, 36): there are two recurrent GFE_IDs of focal series that seem to be the same locations because they have the same WATERBODY in NUSEDS:

##          WATERBODY    GFE_ID
## 1 CLEARWATER CREEK      2618
## 2 Clearwater Creek 446068199

These two GFE_IDs are not in CUSS, and only one is in the DFO streams file:

## # A tibble: 1 × 4
##   NME                 ID Y_LAT         X_LONGT       
##   <chr>            <dbl> <chr>         <chr>         
## 1 CLEARWATER CREEK  2618 50.6158337647 -125.276480824

In addition, the two focal series with these GFE_IDs are compatible in each cases, so we decide to merge them by changing the GFE_ID from 446068199 to 2618 in NUSEDS:

## [1] "In case i = 31, focal series SX_45182 - 446068199 merged to focal series SX_45182 - 2618"
## [1] "1 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"
## [1] ""
## [1] "In case i = 32, focal series CM_50616 - 446068199 merged to focal series CM_50616 - 2618"
## [1] "1 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"
## [1] ""
## [1] "In case i = 33, focal series CN_50618 - 446068199 merged to focal series CN_50618 - 2618"
## [1] "1 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"
## [1] ""
## [1] "In case i = 35, focal series CO_50612 - 446068199 merged to focal series CO_50612 - 2618"
## [1] "2 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"
## [1] ""
## [1] "In case i = 36, focal series PKO_50614 - 446068199 merged to focal series PKO_50614 - 2618"
## [1] "3 rows were edited in all_areas_nuseds at the following fields: AREA, WATERBODY, GAZETTED_NAME, LOCAL_NAME_1, LOCAL_NAME_2, WATERSHED_CDE, WATERBODY_ID, GFE_ID"
## [1] ""

The resulting merged focal series are not merged to the alternative series but are added to CUSS instead.

In case i = 37: the focal series PKO_51094 - 489440637’s GFE_ID = 489440637 is not in CUSS, nor in the other two DFO files. The Atltzi river is close to the Kingcome river and the one data point is compatible with the alternative series PKO_51094 - 872, to which it is consequently merged to.

3.5.3 No alternative series

There remain 166 series in NUSEDS with no alternative series, i.e., both their IndexId (POP_ID) and SPECIES & GFE_ID are absent from CUSS. We rescue these time series by identifying the CU they belong to using the CUs’ shape files of the PSE. Series with X_LONGT and Y_LAT values that intersects one unique CU layer of the same species are attributed the CU’s FULL_CU_IN and CU_NAME and the reference is added to CUSS.

##          IndexId  GFE_ID nb_dataPt alternative_IndexId alternative_GFE_ID
## 1        CM_1622      11         2                none               none
## 2        CM_2434       4        11                none               none
## 3        CM_3212    2487         4                none               none
## 4       CM_41256    1349         1                none               none
## 5       CM_41371    1362         6                none               none
## 6       CM_42458    1497         3                none               none
## 7       CM_43568    1766         1                none               none
## 8       CM_44524    2473         1                none               none
## 9       CM_44558    2486         1                none               none
## 10      CM_45283    2024         1                none               none
## 11      CM_45393    2076         7                none               none
## 12      CM_45931 7990588         4                none               none
## 13   CM_46787933    2488         3                none               none
## 14      CM_47648     499         1                none               none
## 15      CM_51026     865         1                none               none
## 16      CM_51161     879         3                none               none
## 17      CM_52086    1303         5                none               none
## 18      CM_52096 7990617         2                none               none
## 19      CM_52171    1312         3                none               none
## 20      CM_52186    1314         1                none               none
## 21        CM_562    2716        14                none               none
## 22       CM_7009    2837         3                none               none
## 23       CM_7734     182         4                none               none
## 24       CM_7735   52747         7                none               none
## 25       CM_7736   52748         7                none               none
## 26       CM_7737     189        10                none               none
## 27       CM_7739   52749         5                none               none
## 28       CM_7765   55413         1                none               none
## 29       CM_7768    2441         6                none               none
## 30       CM_7769   55417         1                none               none
## 31       CM_7774   55420         2                none               none
## 32       CM_7775    2252         5                none               none
## 33       CM_7784   57042         3                none               none
## 34       CM_7796    2685         5                none               none
## 35       CM_7812    2684         1                none               none
## 36       CM_7816    3554         1                none               none
## 37       CN_3213    2487         4                none               none
## 38       CN_3320   11487         2                none               none
## 39       CN_3324   11486         1                none               none
## 40      CN_41103    1333         3                none               none
## 41      CN_46841    2454         5                none               none
## 42      CN_46841    2462        28                none               none
## 43      CN_49102     802         1                none               none
## 44      CN_50009     723         1                none               none
## 45      CN_50319    1041         1                none               none
## 46      CN_50638     826         2                none               none
## 47      CN_50698     832         1                none               none
## 48       CN_7808   64739        44                none               none
## 49       CO_1624      11         1                none               none
## 50       CO_1826      99         1                none               none
## 51       CO_3027    2655         2                none               none
## 52       CO_3211    2487         4                none               none
## 53       CO_3321   11486        11                none               none
## 54      CO_43196    1662         1                none               none
## 55      CO_43616    1776         1                none               none
## 56      CO_44441    2656        13                none               none
## 57      CO_44840    2312         2                none               none
## 58      CO_44988    2374         7                none               none
## 59      CO_45303    2030         1                none               none
## 60      CO_45879     403         1                none               none
## 61      CO_46310     227         2                none               none
## 62      CO_46855     287         1                none               none
## 63      CO_46865     288         1                none               none
## 64      CO_47232     134         1                none               none
## 65      CO_48090     481         1                none               none
## 66      CO_48205     640         2                none               none
## 67      CO_49415     602         1                none               none
## 68      CO_52082    1303        13                none               none
## 69      CO_52242    1320         3                none               none
## 70      CO_52262    1322         5                none               none
## 71      CO_52272    1323         7                none               none
## 72      CO_52376    1073        16                none               none
## 73        CO_572      95         1                none               none
## 74       CO_7420   23726         3                none               none
## 75       CO_7729    2239         6                none               none
## 76       CO_7747   32077         1                none               none
## 77       CO_7764   55413         1                none               none
## 78       CO_7771    2422         6                none               none
## 79       CO_7772   11491         7                none               none
## 80       CO_7773   55420         1                none               none
## 81       CO_7776    2692         1                none               none
## 82       CO_7779   57040         1                none               none
## 83       CO_7780    2397         1                none               none
## 84       CO_7793    2681         7                none               none
## 85       CO_7814    2687         1                none               none
## 86        CO_792     208         2                none               none
## 87        CO_959     199         2                none               none
## 88      PKE_3277    2236         1                none               none
## 89      PKE_3432   11572         2                none               none
## 90      PKE_3447    2708         2                none               none
## 91     PKE_45304    2030         2                none               none
## 92     PKE_45454    2107         1                none               none
## 93     PKE_45930 7990588         1                none               none
## 94     PKE_48638     757         1                none               none
## 95     PKE_48658     759         1                none               none
## 96     PKE_50012     724         2                none               none
## 97     PKE_51064     869         4                none               none
## 98     PKE_51882     990         4                none               none
## 99     PKE_52377    1073         8                none               none
## 100    PKE_52387    1075         1                none               none
## 101    PKE_52392    1076         5                none               none
## 102    PKE_52492    1096         1                none               none
## 103    PKE_52754    1125         3                none               none
## 104     PKE_7797    2685         2                none               none
## 105 PKE_88092422    2601         3                none               none
## 106      PKO_180    2616         1                none               none
## 107     PKO_3195    2737         1                none               none
## 108     PKO_3277    2236         1                none               none
## 109    PKO_40049    1211         1                none               none
## 110    PKO_41037    1574         1                none               none
## 111    PKO_43007    1624         1                none               none
## 112    PKO_44654    2574         1                none               none
## 113    PKO_45930 7990588         1                none               none
## 114    PKO_49088     801         1                none               none
## 115    PKO_50007     723         1                none               none
## 116    PKO_50012     724         1                none               none
## 117    PKO_52377    1073         8                none               none
## 118    PKO_52392    1076         6                none               none
## 119    PKO_52492    1096         1                none               none
## 120    PKO_52754    1125         4                none               none
## 121     PKO_7792    2252         1                none               none
## 122     PKO_7797    2685         3                none               none
## 123     PKO_7811    2688         1                none               none
## 124     PKO_7813    2684         1                none               none
## 125     PKO_7817    3554         1                none               none
## 126 PKO_88092422    2601         2                none               none
## 127      SX_1874    3505         8                none               none
## 128      SX_3077    2753        12                none               none
## 129      SX_3085    2761         5                none               none
## 130      SX_3092     426         9                none               none
## 131      SX_3221    1991         9                none               none
## 132     SX_39730    1433         1                none               none
## 133     SX_40015    1208         1                none               none
## 134     SX_42680    1671         1                none               none
## 135     SX_42950    1613         1                none               none
## 136     SX_43095    1642         1                none               none
## 137     SX_43770    1807         1                none               none
## 138     SX_44140    1904         1                none               none
## 139     SX_44160    1908         1                none               none
## 140     SX_44165    1909         1                none               none
## 141     SX_45038    2396         1                none               none
## 142     SX_45040    2398         1                none               none
## 143     SX_45056    2405         2                none               none
## 144     SX_48264     652         1                none               none
## 145     SX_50005     723         1                none               none
## 146     SX_50010     724         3                none               none
## 147     SX_50340    1046         5                none               none
## 148     SX_51000     863         1                none               none
## 149     SX_51060     869         1                none               none
## 150     SX_51145     878         5                none               none
## 151     SX_51155     879         1                none               none
## 152     SX_52080    1303        51                none               none
## 153     SX_52120    1307        44                none               none
## 154     SX_52390    1076        11                none               none
## 155     SX_52750    1125         5                none               none
## 156     SX_52890    1139         4                none               none
## 157     SX_52960    1146         1                none               none
## 158      SX_7640   26773         3                none               none
## 159      SX_7689    3510         7                none               none
## 160      SX_7694    3446         3                none               none
## 161      SX_7805    2792         3                none               none
## 162      SX_7807     185         6                none               none
## 163      SX_7815    2687         1                none               none
## 164      SX_7818   64745         1                none               none
## 165      SX_7822   58219         1                none               none
## 166  SX_80808204    2601         1                none               none

The are 14 time series without coordinates provided for their GFE_ID. We use the SYSTEM_SITE (if available) and WATERBODY and Google Maps to define X_LONGT and Y_LAT manually when possible:

##     GFE_ID               WATERBODY     X_LONGT     Y_LAT coordinates_changed
## 1  7990588   RETURN CHANNEL CREEKS          NA        NA               FALSE
## 2     1303    KENNEDY LAKE BEACHES -125.580441 49.049133                TRUE
## 3    52749         SILVERMERE LAKE -122.408753 49.174967                TRUE
## 4    55417           CAMILOS CREEK -121.393056 49.386667                TRUE
## 5    57042            HANSEN CREEK -128.346389 50.778889                TRUE
## 6    11487 STAMP RIVER BELOW FALLS          NA        NA               FALSE
## 7       95        SEMMIHAULT CREEK -121.956111 49.153056                TRUE
## 8     2681          MCLELLAN CREEK -126.619731 52.387830                TRUE
## 9      208        COTTONWOOD CREEK -123.145631 49.762523                TRUE
## 10     199               FEE CREEK          NA        NA               FALSE
## 11    3505             OLSEN CREEK -122.631537 49.597168                TRUE
## 12    1307   CLAYOQUOT ARM BEACHES -125.591878 49.099033                TRUE
## 13    2792              MOORE LAKE -129.501134 53.409530                TRUE
## 14   64745           ATNARKO LAKES -125.713941 52.163834                TRUE

Time series without coordinates or intersecting more that one CU boundary are removed from NUSEDS. Below we show a plot for each time series followed by the action made:

## [1] "*** r = 1 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##   IndexId      CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_1622 Lower Fraser       CM-2 Current
## [1] ""
## [1] "*** r = 2 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##   IndexId      CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_2434 Lower Fraser       CM-2 Current
## [1] ""
## [1] "*** r = 3 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##   IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_3212 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 4 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_41256 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 5 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_41371 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 6 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_42458 East HG      CM-21 Current
## [1] ""
## [1] "*** r = 7 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                    CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_43568 Portland Canal-Observatory      CM-32 Current
## [1] ""
## [1] "*** r = 8 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_44524 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 9 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_44558 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 10 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_45283 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 11 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId        CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_45393 Georgia Strait       CM-4 Current
## [1] ""
## [1] "*** r = 12 ***"

## [1] "The series above is removed from NUSEDS because: No coordinates available"
## [1] "*** r = 13 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##       IndexId                            CU_NAME FULL_CU_IN CU_TYPE
## 1 CM_46787933 Southwest & West  Vancouver Island      CM-10 Current
## [1] ""
## [1] "*** r = 14 ***"

## [1] "The time series above is added to CUSS in association with the CU:"
##    IndexId      CU_NAME                   FULL_CU_IN CU_TYPE
## 1 CM_47648 Upper Skeena No FULL_CU_in but cuid = 242    <NA>
## [1] ""
## [1] "*** r = 15 ***"