From 8d88e499cc194ccb209ebd6d4aefe82dc3ecf940 Mon Sep 17 00:00:00 2001 From: kaydin Date: Mon, 25 Apr 2022 07:45:12 -0700 Subject: [PATCH 1/6] testing unix line endings on windows --- R/param.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/param.R b/R/param.R index 571ede27..f746e54c 100644 --- a/R/param.R +++ b/R/param.R @@ -376,9 +376,9 @@ check.rpath.params <- function(Rpath.params){ } if(w == 0){ - cat('Rpath parameter file is functional.\n') + cat('Rpath parameter file is functional. \n') } else { - cat('Rpath parameter file needs attention!\n') + cat('Rpath parameter file needs attention! \n') } } From 2b51fe35bc309df2d6b71dde8440c0f6b95a0675 Mon Sep 17 00:00:00 2001 From: kaydin Date: Mon, 9 May 2022 14:47:26 -0700 Subject: [PATCH 2/6] partial start on data_raw --- .Rbuildignore | 15 ++++---- .gitignore | 1 - R/data.R | 13 +++++++ data-raw/Ecosense_EBS_base.csv | 55 +++++++++++++++++++++++++++++ data-raw/Ecosense_EBS_diet.csv | 55 +++++++++++++++++++++++++++++ data-raw/Ecosense_EBS_pedigree.csv | 54 ++++++++++++++++++++++++++++ data-raw/Ecosense_ECS_base.csv | 54 ++++++++++++++++++++++++++++ data-raw/Ecosense_ECS_diet.csv | 54 ++++++++++++++++++++++++++++ data-raw/Ecosense_ECS_pedigree.csv | 53 +++++++++++++++++++++++++++ data-raw/Ecosense_GOA_base.csv | 51 ++++++++++++++++++++++++++ data-raw/Ecosense_GOA_diet.csv | 51 ++++++++++++++++++++++++++ data-raw/Ecosense_GOA_pedigree.csv | 50 ++++++++++++++++++++++++++ data-raw/Rpath_unbalanced_data.R | 18 ++++++++++ data/test_usedat.rda | Bin 0 -> 92 bytes man/test_usedat.Rd | 25 +++++++++++++ 15 files changed, 541 insertions(+), 8 deletions(-) create mode 100644 R/data.R create mode 100644 data-raw/Ecosense_EBS_base.csv create mode 100644 data-raw/Ecosense_EBS_diet.csv create mode 100644 data-raw/Ecosense_EBS_pedigree.csv create mode 100644 data-raw/Ecosense_ECS_base.csv create mode 100644 data-raw/Ecosense_ECS_diet.csv create mode 100644 data-raw/Ecosense_ECS_pedigree.csv create mode 100644 data-raw/Ecosense_GOA_base.csv create mode 100644 data-raw/Ecosense_GOA_diet.csv create mode 100644 data-raw/Ecosense_GOA_pedigree.csv create mode 100644 data-raw/Rpath_unbalanced_data.R create mode 100644 data/test_usedat.rda create mode 100644 man/test_usedat.Rd diff --git a/.Rbuildignore b/.Rbuildignore index 0d4a580c..d416705d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,7 +1,8 @@ - -^.*\.Rproj$ -^\.Rproj\.user$ -^\.github$ -^_pkgdown\.yml$ -^docs$ -^pkgdown$ + +^.*\.Rproj$ +^\.Rproj\.user$ +^\.github$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ +^data-raw$ diff --git a/.gitignore b/.gitignore index 156c6bee..5cd53704 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ *.png *.jpg *.tif -data outputs code *.xlsx diff --git a/R/data.R b/R/data.R new file mode 100644 index 00000000..9e45449c --- /dev/null +++ b/R/data.R @@ -0,0 +1,13 @@ +#' Gulf of Alaska (west/central) 1990s Ecopath model. +#' +#' Rpath inputs (unbalanaced model) from the Western/Centeral Gulf of Alaska +#' 1990s Ecopath model. +#' +#' @format An Rpath model object +#' \describe{ +#' \item{price}{price, in US dollars} +#' \item{carat}{weight of the diamond, in carats} +#' ... +#' } +#' @source Some Source Or Other +"test_usedat" \ No newline at end of file diff --git a/data-raw/Ecosense_EBS_base.csv b/data-raw/Ecosense_EBS_base.csv new file mode 100644 index 00000000..f0d21e03 --- /dev/null +++ b/data-raw/Ecosense_EBS_base.csv @@ -0,0 +1,55 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.03503154,0.06911141,17.39968,,,0,0.2,,0.4,0.6,2.52E-05,0.000006747 +Gray whales,0,0.0326672,0.063365,8.87285,,,0,0.2,,0.4,0.6,0,0 +Other baleen,0,0.5007642,0.02832879,6.642456,,,0,0.2,,0.4,0.6,0.000000183,1.91E-05 +Bowhead whales,0,0.007173534,0.01005034,8.679965,,,0,0.2,,0.4,0.6,0,0 +Other pinnipeds,0,0.04919672,0.09292668,33.97923,,,0,0.2,,0.4,0.6,0.000100598,5.62E-06 +Walrus/bearded seal,0,0.1142484,0.051293,15.37061,,,0,0.2,,0.4,0.6,3.09E-05,5.96E-06 +Wintering seals,0,0.03029022,0.068998,19.19651,,,0,0.2,,0.4,0.6,0.000031609,3.15E-07 +Procellarids,0,0.000920162,0.07456178,73,,,0,0.2,,0.4,0.6,2.20E-09,0.000003567 +Alcids piscivorous,0,0.008617982,0.1623509,72.05511,,,0,0.2,,0.4,0.6,2.08E-08,3.34E-05 +Larids,0,0.000767614,0.08903116,104.9432,,,0,0.2,,0.4,0.6,1.90E-09,2.98E-06 +Alcids planktivorous,0,0.001754495,0.1694877,110,,,0,0.2,,0.4,0.6,4.20E-09,6.80E-06 +Other seabirds,0,0.000101753,0.06846981,76.18891,,,0,0.2,,0.4,0.6,2.00E-10,3.94E-07 +Cormorants,0,0.000149799,0.1587271,73,,,0,0.2,,0.4,0.6,4.00E-10,5.81E-07 +Sharks,0,0.0532473,0.1,3,,,0,0.2,,0.4,0.6,1.55E-05,0.000695172 +Walleye pollock,0,22.97889,0.8208976,4.193416,,,0,0.2,,0.392,0.608,0.4041824,2.104923 +Pacific cod,0,2.650923,0.5080103,2.739351,,,0,0.2,,0.392,0.608,0.2240711,0.1983278 +Pelagic forage fish,0,7.644652,0.7672387,3.732284,,,0,0.2,,0.392,0.608,0.02158515,0.007684128 +Lg.-mouth flatfish,0,1.58756,0.1937844,1.213555,,,0,0.2,,0.392,0.608,0.01807182,0.04641179 +Sm.-mouth flatfish,0,11.31311,0.2096047,1.325415,,,0,0.2,,0.392,0.608,0.1925451,0.2227745 +Skates,0,0.7733867,0.2,2,,,0,0.2,,0.392,0.608,0.004292543,0.02400982 +Other demersals,0,1.382284,0.2117719,2.526838,,,0,0.2,,0.392,0.608,0.01536881,0.01027679 +Eelpouts,0,2.371533,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Lg.-mouth sculpins,0,0.5403231,0.4,2,,,0,0.2,,0.392,0.608,0.000573506,0.009394558 +Other sculpins,0,1.136692,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Misc. shallow fish,0,1.167694,0.4,2,,,0,0.2,,0.392,0.608,1.13E-05,3.58E-05 +Octopods,0,0.192476,0.8,3.65,,,0,0.2,,0.392,0.608,7.99E-05,0.000228618 +Squids,0,0.9269976,3.2,10.67,,,0,0.2,,0.392,0.608,0.000454888,0.000875192 +Salmon returning,0,0.1637697,1.65,11.6,,,0,0.2,,0.392,0.608,0.1691487,0.00067146 +Salmon outgoing,0,0.0141972,1.28,13.56,,,0,0.2,,0.392,0.608,0,0 +Other crabs,0,3.244238,0.9338375,3.872315,,,0,0.2,,0.1,0.9,0.06657811,0.003027228 +Snow crab,0,2.178832,1.295101,3.117084,,,0,0.2,,0.1,0.9,0.3006897,0.006839902 +Shrimps,0,19.44489,0.5756463,2.40941,,,0,0.2,,0.1,0.9,2.25E-07,0.000001989 +Sea stars,0,2.471359,1.21,6.05,,,0,0.2,,0.1,0.9,3.87E-05,0.006488753 +Brittle stars,0,2.950093,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +Urchins dollars cucumbers,0,1.167418,0.61,3.05,,,0,0.2,,0.1,0.9,3.48E-07,6.56E-05 +Snails,0,0.8071689,1.81,9.049999,,,0,0.2,,0.1,0.9,1.88E-07,1.80E-05 +Misc. crustacean,0,8.88581,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,12.79612,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.1095207,1,5,,,0,0.4,,0.1,0.9,4.31E-07,0.000384743 +Corals and sea pens,0,0.02658792,0.06929576,0.3464788,,,0,0.4,,0.1,0.9,3.25E-07,0.000025347 +Worms etc.,0,3.905683,2.155615,10.77807,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.3544967,3.58,17.9,,,0,0.4,,0.1,0.9,6.09E-06,0.001505825 +Sponge,0,0.05448509,1,5,,,0,0.4,,0.1,0.9,1.91E-06,0.00064731 +Bivalves,0,61.87307,1.3,6.5,,,0,0.4,,0.1,0.9,2.33E-08,1.11E-07 +Polychaetes,0,21.68738,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid Jellies,0,0.3379304,0.88,3,,,0,0.2,,0.4,0.6,0.003364776,0.01527125 +Other zooplankton,0,22.7485,5.253331,15.00952,,,0,0.2,,0.4,0.6,0,0 +Copepods,0,26.85738,6,27.74,,,0,0.2,,0.4,0.6,0,0 +Pelagic microbes,0,45,36.5,104.2857,,,0,0.25,,0.4,0.6,0,0 +Benthic microbes,0,22.06101,36.5,104.2857,,,0,0.25,,0.1,0.9,0,0 +Primary production,1,48.60443,99.40636,,,,0,0,,0.4004332,0.5995669,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.2278577,0.7721423,, diff --git a/data-raw/Ecosense_EBS_diet.csv b/data-raw/Ecosense_EBS_diet.csv new file mode 100644 index 00000000..ab7e75b0 --- /dev/null +++ b/data-raw/Ecosense_EBS_diet.csv @@ -0,0 +1,55 @@ +DIETS,Toothed whales,Gray whales,Other baleen,Bowhead whales,Other pinnipeds,Walrus/bearded seal,Wintering seals,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squids,Salmon returning,Salmon outgoing,Other crabs,Snow crab,Shrimps,Sea stars,Brittle stars,Urchins dollars cucumbers,Snails,Misc. crustacean,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid Jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,6.47E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whales,0.000133081,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.002040034,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whales,2.92E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.000205117,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,,,,,,0.001017812,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,6.33E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,0.00059265,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,5.28E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,0.000120655,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,7.00E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,1.03E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000239291,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.1698044,,0.08070278,,0.2811362,,0.4888999,0.1655044,0.2614391,0.2021952,0.002550183,0.1678919,0.02434087,0.2,0.08240532,0.2243627,,0.5571692,0.03047612,0.4114217,0.004290166,0.00395613,0.1298186,,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01947363,,,,0.01366742,,0.0049334,0.007216445,0.1888303,0.008816263,0.000111195,0.007320547,0.001061329,,0.000594541,0.00446721,,0.006268422,3.22E-05,0.006085007,,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.2487804,,0.1201802,,0.2320068,,0.1287617,0.3508018,0.3939846,0.6618846,0.05411142,0.3104237,0.931414,,0.005597626,0.03139776,,0.0777799,0.04213176,0.0297038,0.004689368,0.01307451,0.08628711,,,,0.15,,,,,,,,,,,,,,,,,,,0.008,,,,, +Lg.-mouth flatfish,0.001034033,,,,5.86E-06,,,,,,,,,0.2,0.000824726,0.001458564,,0.002081271,6.93E-05,0.02431003,1.60E-06,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.006842509,,,,0.08088505,,0.0394672,,,,,,,,0.000164344,0.02012908,,0.02068678,0.000488947,0.09006111,0.000020214,7.38E-06,0.03985396,0.009723351,0.007394266,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.003475559,,,,,,,,,,,,,,,5.18E-07,,1.45E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.005536608,,,,0.01134714,,,0.000564447,0.000998577,0.000999001,0.001003092,0.000032534,0.00084674,0.2,4.84E-07,0.001655552,,0.001043523,,,0.000351201,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.141124,,,,0.008174762,,0.05969413,,,,,,,,0.000426192,0.03098069,,0.04269749,0.001878417,0.08047485,3.13E-06,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,,,,,,,,,,,,7.54E-06,0.001176434,,0.0002093,1.93E-05,0.000021452,0.000121231,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.05504273,,,,0.01009857,,0.07893439,,,,,,,,0.000323667,0.01049386,,0.01287026,0.001030404,0.02096508,0.000147024,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.03660734,,0.01555704,,0.02213815,,0.09866799,,,,,,,0.02,8.52E-05,0.003238108,,0.004294502,0.000809832,0.007287188,5.99E-06,0.000986537,0.01898878,0.04985736,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,0.005624069,,,,0.02070426,0.01017812,0.009866798,,,,,,,0.02,2.62E-05,0.005013016,,0.000651224,7.19E-05,,0.000360057,,0.01435832,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squids,0.2922446,,0.002097894,,0.2519298,,0.00049334,0.4435776,0.03470331,0.006531665,0.00074037,0.503465,,0.2,0.001616147,0.00071992,,0.07333685,0.00012839,2.53E-05,0.2840489,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.01169868,,0.005824628,,0.008696572,,,,,,,,,0.05,,0.001279095,,,,0.02247792,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,7.14E-08,,3.56E-08,,0.008696572,,,,,,,7.53E-08,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.002564021,,0.001170194,0.01055097,0.006252694,0.009866799,,,,,,0.000783198,0.0025,0.001008549,0.1117827,,0.01110253,0.01499601,0.05703641,0.001302062,0.008096965,0.06165776,0.05453778,0.000531343,0.15,,,,0.005500491,0.06013035,,0.01,,,,,,,,,,,,,,,,,, +Snow crab,,0.001909877,,0.000871649,0.000698742,0.003925424,,,,,,,0.00121494,,1.81E-05,0.05749471,,0.004300768,0.004455289,0.0300742,,0.09333689,0.03866288,,,0.05,,,,,,,0.005,,,,,,,,,,,,,,,,,, +Shrimps,,0.01358641,,0.006200707,0.02408229,0.02035623,0.0542674,,,,,,0.0086428,0.005,0.03297897,0.1420867,0,0.05616299,0.08154,0.07128841,0.2867417,0.01367033,0.1972778,0.5433436,0.225388,,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.001959092,,0.000894111,,,,,,,,,,,2.83E-05,0.00012312,,1.04E-08,3.16E-06,0.00055577,4.92E-06,,5.38E-05,,,,,,,0.000382242,0.000603733,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.002253839,,0.00102863,,,,,,,,,,,3.63E-05,0.000185201,,6.63E-05,0.05973076,5.11E-05,2.43E-06,0.1822525,0.000102108,0.000181826,,,,,,0.01228855,0.07161608,,0.03,,,,,,,,,,,,,,,,,, +Urchins dollars cucumbers,,0.000840129,,0.000383427,0.01513655,,,,,,,,,,1.25E-07,0.000107477,,5.44E-06,0.02279872,8.06E-08,,,2.12E-05,,,,,,,0.01201729,0.007422531,,,,,,,,,,,,,,,,,,,, +Snails,,0.000502282,,0.000229237,2.21E-05,0.0610687,,,,,,,,0.0025,0.000179459,0.004685467,,0.000333693,0.007431038,0.000301499,0.000000029,,0.001372771,,,0.4,,,,0.01685826,0.04829947,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustacean,,0.006993907,,0.003191952,,,,0.004287296,0.009203487,0.003571809,0.00072099,3.73E-05,0.004449074,,0.007055759,0.002030444,,2.65E-05,0.02593507,0.000023285,4.31E-07,0.005357117,0.000792121,0.01442491,4.38E-05,,,,,0.001538223,0.01720634,,,,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,0.004360963,,,,6.32E-05,,0.004879939,0.000985044,5.10E-05,0.006078489,,0.03478977,0.1104455,2.96E-06,0.001273519,0.09940312,0.008388263,0.001051775,0.3280452,0.05959997,0.1947338,0.09178961,,,,,0.005461351,0.04782058,0.3,,0.1,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Anemones,,8.68E-05,,3.96E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,0.001850753,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,2.11E-05,,9.62E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.002718438,,0.001240668,,0.1832061,0.02614701,1.69E-05,,0.001301065,0.000262628,1.36E-05,,,0.001353052,0.02704704,,0.000266081,0.09399602,5.84E-05,7.86E-07,0.02537635,0.01925321,0.03702217,,,,,,0.2085163,0.03021216,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000281016,,0.000128253,,,,,,,,,,,1.68E-05,0.000549436,,3.16E-06,0.002288761,1.66E-06,0.000489444,,,,,,,,,0.000570783,,,,,,,,,,,,,,,,,,,,, +Sponge,,4.32E-05,,1.97E-05,,,,,,,,,,,5.47E-05,4.36E-05,,9.00E-10,9.09E-05,7.98E-06,,,,,,,,,,0.00023874,0.002601985,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.04904792,,0.022385,2.21E-05,0.7139949,,0.00032442,,0.02504892,0.005056271,0.000261789,,,0.000490379,0.00165732,,0.000577568,0.08503099,2.78E-05,8.08E-06,0.05257819,0.000393605,,,0.4,,,,0.2533802,0.2524816,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.01719198,,0.007846256,,,,0.000113714,,0.008779998,0.001772293,9.18E-05,,,0.00366851,0.03710564,3.12E-05,0.000641417,0.3154908,0.002781462,0.000225772,0.2386699,0.10978,0.02550208,1.19E-05,,,,,0.263431,0.2847306,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid Jellies,,,,,,,,,,,,,,,2.91E-05,3.76E-06,,1.33E-06,0.001530271,1.47E-05,0.0001446,,7.51E-06,,0.06429844,,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5746825,0.55,,,,0.01148704,0.04877095,0.03297732,0.4103911,0.004580894,0.008569111,,0.4335781,0.1106963,0.9033016,0.09674293,0.09784253,0.000493316,0.3819539,0.001346271,0.1561293,0.01137116,0.6102213,,0.65,0.6,0.5,,0.004736442,0.2,,,,,,,,,,,,,,0.74,0.008073313,,,, +Copepods,,,0.200955,0.4,,,,0.01519615,0.06206967,0.04196949,0.5222954,0.00583,0.01259939,,0.3857745,0.001424687,0.09666412,0.000011405,0.00054752,,0.03367182,,2.77E-05,0.01865575,0.000321321,,0.2,0.2,0.5,,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,1.93E-06,8.57E-06,,,0.000224104,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,,0.05,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4901808,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,,,,1.85E-05,,1.76E-07,5.60E-09,,,,,,,,,,,0.001516897,0.004452738,,,,0.25,0.2,,,,,,,,,,0.05,0.5919268,0.5,0.7,, +Pelagic detritus,,,,,,,,,,0.00104472,,,,,,,,,,,,,,,,,,,,0.000994342,0.005903513,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,,,,0.1,0.006865464,0.0561312,,0.02938087,0.009528337,0.1360623,0.000363454,0.00062444,0.008015924,,,,,,,0.2173052,0.1599311,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5028055,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_EBS_pedigree.csv b/data-raw/Ecosense_EBS_pedigree.csv new file mode 100644 index 00000000..8f783a1e --- /dev/null +++ b/data-raw/Ecosense_EBS_pedigree.csv @@ -0,0 +1,54 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whales,0.5,0.6,0.6,0.8,0 +Other baleen,0.8,0.6,0.6,0.8,0.3 +Bowhead whales,0.5,0.1,0.6,0.8,0 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Walrus/bearded seal,0.5,0.6,0.6,0.7,0.3 +Wintering seals,0.5,0.6,0.6,0.7,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.5,0.7,0.7,0.8,0.7 +Walleye pollock,0.5,0.4,0.4,0.1,0.1 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.8,0.6,0.8,0.3,0.7 +Sm.-mouth flatfish,0.8,0.6,0.8,0.7,0.3 +Skates,0.5,0.7,0.7,0.7,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.3,0.8 +Other sculpins,0.8,0.7,0.7,0.3,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squids,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.8 +Snow crab,0.1,0.6,0.8,0.7,0.3 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.8,0.6,0.7,0.8,0 +Urchins dollars cucumbers,0.8,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.5 +Misc. crustacean,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.5,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.5,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.5 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid Jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.8,0.8,0 +Copepods,0.8,0.7,0.8,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/data-raw/Ecosense_ECS_base.csv b/data-raw/Ecosense_ECS_base.csv new file mode 100644 index 00000000..bc8fdad4 --- /dev/null +++ b/data-raw/Ecosense_ECS_base.csv @@ -0,0 +1,54 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Polar bears,0,0.00052669,0.0603,4.001384,,,0,0.2,,0.3,0.7,1.84E-05,3.00E-10 +Toothed whales,0,0.01158743,0.112092,14.50402,,,0,0.2,,0.3,0.7,6.34E-05,1.00E-10 +Gray whale,0,0.1879512,0.063365,8.87285,,,0,0.2,,0.3,0.7,0,0 +Bowhead whale,0,0.3984775,0.01005,5.260121,,,0,0.2,,0.3,0.7,0.001198808,1.00E-10 +Walrus/bearded seal,0,0.09814298,0.07127273,18.19188,,,0,0.2,,0.3,0.7,0.004842258,2.00E-10 +Wintering seals,0,0.06165962,0.08586258,19.17929,,,0,0.2,,0.3,0.7,0.002269417,2.00E-10 +Procellarids,0,0.001927375,0.06674218,187.9285,,,0,0.2,,0.3,0.7,0,0 +Cormorants,0,1.47E-06,0.1625189,142.6185,,,0,0.2,,0.3,0.7,0,0 +Other seabirds,0,7.77E-05,0.1625189,374.3133,,,0,0.2,,0.3,0.7,0,0 +Larids,0,9.31E-05,0.1057225,205.6736,,,0,0.2,,0.3,0.7,0,0 +Alcids piscivorous,0,0.001155027,0.104122,178.3831,,,0,0.2,,0.3,0.7,0,0 +Alcids planktivorous,0,0.000139496,0.1404024,247.5067,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth flatfish,0,0.1114285,0.4006235,1.780206,,,0,0.2,,0.3,0.7,0,0 +Sm.-mouth flatfish,0,0.09015632,0.3078811,1.535264,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth sculpins,0,0.599852,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Other sculpins,0,0.8552857,0.4592638,2.415146,,,0,0.2,,0.3,0.7,0,0 +Eelpouts,0,0.3821929,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Pelagic forage fish,0,1.190608,0.5432349,2.919605,,,0,0.2,,0.3,0.7,0,0 +Misc. shallow fish,0,7.477481,0.41934,2.105119,,,0,0.2,,0.3,0.7,0,0 +Other demersals,0,0.2338559,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Skates,0,0.005364676,0.21,2.1,,,0,0.2,,0.3,0.7,0,0 +Walleye pollock,0,0.0005417,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0,0 +Pacific cod,0,0.000037935,0.5477087,2.802848,,,0,0.2,,0.3,0.7,0,0 +Arctic cod,0,1.044914,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0.000000001,1.00E-10 +Snow crab,0,3.169973,1,2.75,,,0,0.2,,0.1,0.9,0,0 +Bivalves,0,90.28777,0.755625,3.778125,,,0,0.4,,0.1,0.9,0,0 +Snails,0,1.384463,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Other crabs,0,3.067152,0.82,4.1,,,0,0.2,,0.1,0.9,0,0 +Shrimps,0,7.492234,0.576,2.409,,,0,0.2,,0.1,0.9,0,0 +Sea stars,0,2.180155,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +Brittle stars,0,5.644247,0.485,2.425,,,0,0.4,,0.1,0.9,0,0 +Basket stars,0,0.5098612,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,36.28965,0.695,3.475,,,0,0.4,,0.1,0.9,0,0 +Sponge,0,0.5271555,1,5,,,0,0.4,,0.1,0.9,0,0 +Anemones,0,0.3841269,1,5,,,0,0.2,,0.1,0.9,0,0 +Benthic urochordate,0,1.160084,3.58,17.9,,,0,0.4,,0.1,0.9,0,0 +Corals and sea pens,0,0.02567942,0.046,0.23,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.3719727,0.88,3,,,0,0.2,,0.3,0.7,0,0 +Octopods,0,0.01057694,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Salmon outgoing,0,0.000520686,1.28,13.56,,,0,0.2,,0.3,0.7,0,0 +Salmon returning,0,0.005206862,1.65,11.6,,,0,0.2,,0.3,0.7,0,0 +Benthic amphipods,0,20.52637,1,5,,,0,0.4,,0.1,0.9,0,0 +Polychaetes,0,27.80796,2.915733,14.57867,,,0,0.4,,0.1,0.9,0,0 +Worms etc.,0,17.03959,2.23,11.15,,,0,0.4,,0.1,0.9,0,0 +Misc. crustaceans,0,5.580986,2.008,10.04,,,0,0.4,,0.1,0.9,0,0 +Copepods,0,2.042696,6,27.74,,,0,0.2,,0.3,0.7,0,0 +Other zooplankton,0,1.225213,5.475,15.64286,,,0,0.2,,0.3,0.7,0,0 +Pelagic microbes,0,1.488708,26.25,75,,,0,0.2,,0.3,0.7,0,0 +Benthic microbes,0,22.31168,26.25,75,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,27.8,75,,,,0,0,,0.3,0.7,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3,0.7,, diff --git a/data-raw/Ecosense_ECS_diet.csv b/data-raw/Ecosense_ECS_diet.csv new file mode 100644 index 00000000..85514f75 --- /dev/null +++ b/data-raw/Ecosense_ECS_diet.csv @@ -0,0 +1,54 @@ +DIETS,Polar bears,Toothed whales,Gray whale,Bowhead whale,Walrus/bearded seal,Wintering seals,Procellarids,Cormorants,Other seabirds,Larids,Alcids piscivorous,Alcids planktivorous,Lg.-mouth flatfish,Sm.-mouth flatfish,Lg.-mouth sculpins,Other sculpins,Eelpouts,Pelagic forage fish,Misc. shallow fish,Other demersals,Skates,Walleye pollock,Pacific cod,Arctic cod,Snow crab,Bivalves,Snails,Other crabs,Shrimps,Sea stars,Brittle stars,Basket stars,"Urchins, dollars, cucumbers",Sponge,Anemones,Benthic urochordate,Corals and sea pens,Scyphozoid jellies,Octopods,Salmon outgoing,Salmon returning,Benthic amphipods,Polychaetes,Worms etc.,Misc. crustaceans,Copepods,Other zooplankton,Pelagic microbes,Benthic microbes,Primary production +Polar bears,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Toothed whales,0.1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,0.25,,,,0.000212616,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,0.65,,,,0.000504327,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,,,0.004651598,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.005322316,0.02487342,,0.001472492,0.006102135,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.01650201,0.06433967,,0.01072673,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,0.009999999,,,0.01659991,0.0410623,,,,0.001718235,0.07135769,,,,,,0.04798269,0.005778736,,0.04407414,0.02363462,,0.006649494,0.006265168,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,,0.009999999,,,,0.008492618,,,,0.001718235,0.07133969,,,,0.206761,,0.000789418,0.004220617,,0.05228622,0.000336991,,0.004856593,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,,0.009999999,,,,,,,,,,,,,0.08932029,,,,,0.003859158,0.04130904,,0.004297453,0.003560629,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,,0.5544065,,,0.000657422,0.06911467,0.05867733,0.25,,0.3324589,0.2731979,,,,,0.03727878,,,,0.05182033,0.05281629,,,0.04948226,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,,0.03590742,,,0.00509502,0.3092427,,0.25,,0.0267805,0.2405652,,0.3332412,,0.2435342,,0.07879899,0.1874234,0.06125135,0.07786866,0.01548537,,0.06349141,0.002147306,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,,,,,,0.001981432,,,,0.007045029,0.006587705,,,,0.01485121,,0.000345366,,,0.09428567,0.005443891,,0.00277255,0.002785945,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,,,,,,,,,,,,,,,,,,,,,,,0.000578866,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pacific cod,,,,,,,,,,,,,,,,,,,,,0.001371445,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Arctic cod,,0.2796861,,,0.002410548,0.4286107,0.06969959,0.25,,0.5012766,0.2594775,,0.2409175,,,,,,,0.005050726,0.2729864,0.5366726,0.1560087,0.008183806,,,,,,,,,,,,,,,,,,,,,,,,,, +Snow crab,,,0.000256674,0.000113781,0.07158563,,,,,,,,,0.0265204,0.07528889,0.00226101,,,,0.01153278,0.2568457,,0.1453266,,,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Bivalves,,,0.0433623,0.01922197,0.5941439,,,,,1.53E-06,2.65E-06,,0.00729814,0.3710207,,0.001438914,0.000389389,,0.04453,0.001736895,1.76E-05,,0.001407035,4.30E-05,0.2075,,0.5,0.25,0.15,0.5154778,0.125,,,,0.2,,,,0.25,,,,,,,,,,, +Snails,,,0.004340004,0.00192387,0.04782695,,,,,0.005283926,0.003017653,,,0.000498679,,0.006792177,,,0.000733818,,5.89E-05,,0.001507538,,0.0326,,,,,0.05159265,,,,,,,,,0.25,,,,,,,,,,, +Other crabs,,,7.88E-05,3.49E-05,0.02207871,,,,,0.005283772,0.003044799,,,0.000157228,0.1497352,0.05728141,0.002116573,0.000288189,0.005869959,0.02178959,0.06081963,,0.0525628,0.001098868,0.0411,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Shrimps,,0.09993257,1.25E-05,5.55E-06,0.08408973,0.09176343,,0.25,,0.01060208,0.009951027,,0.1977302,,0.1319228,0.01229081,0.01550181,0.009836816,0.1471351,0.181513,0.1139477,0.1423735,0.2859297,0.1600893,,,,,,,,,,,,,,,,,,,,,,,,,, +Sea stars,,,0.004000351,0.001773306,,,,,,,,,,,,,,,,,,,,,0.0015,,,,,,,,,,,,,,,,,,,,,,,,, +Brittle stars,,,0.003698438,0.001639472,,,,,,,,,,0.03040408,1.92E-05,0.005426886,,,,,6.06E-06,,,,0.05895,,,,,,,,,,,,,,,,,,,,,,,,, +Basket stars,,,0.00014616,6.48E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,,0.02290767,0.01015469,0.05747112,,,,,,,,,0.05108213,,,,,,,0.000107293,,,,0.0081,,,,,0.2723194,,,,,,,,,,,,,,,,,,,, +Sponge,,,0.000249278,0.000110502,,,,,,,,,,,,,,,,,,,,,0.00275,,,,,,,,,,,,,,,,,,,,,,,,, +Anemones,,,0.002641741,0.001171051,,,,,,,,,,,,0.06376915,,,,,1.18E-05,,,,0.00115,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic urochordate,,,0.002641741,0.001171051,0.006627641,,,,,,,,,,,,,,,,0.00021469,,,,,,,,,0.03140422,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,,2.54E-06,1.13E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,,0.0192604,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,0.000067419,,,0.007169423,0.001830349,,,,,,,,,,,,,,,6.64E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon returning,,,,,,,,,,,,,,,,,,,,,0.02096798,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic amphipods,,,0.9,0.005671234,0.03530366,0.03725448,0.002204452,,0.1,0.03446057,0.02325702,,0.0252337,0.1203165,0.0703186,0.4825385,0.2814546,0.01338544,0.4361333,0.3160916,0.03019983,0.0429575,0.137789,0.09571919,0.05525,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,,0.01086888,0.00481804,0.03047494,,,,,0.02371788,0.008201232,,0.04969615,0.3519998,0.01052774,0.2352545,0.5376897,0.004593154,0.1107291,0.1004426,0.007359331,,0.06924623,0.004512317,0.27195,,0.3,0.25,0.15,0.1292059,0.125,,,,,,,,,,,,,,,,,,, +Worms etc.,,,0.002226611,0.000987029,0.005586154,,,,,,,,,0.008323649,,0.06003539,,,0.02272738,0.000147471,,,,,0.03125,,0.05,0.25,,,,,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,,0.002566263,0.001137593,,,,,,0.00012475,,,,0.03681871,0.006913655,0.007458307,0.00088703,0.000632304,0.06850621,0.003324673,0.000133681,0.03436605,0.001507538,0.01197542,0.01425,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Copepods,,,,0.7125,,,0.004408904,,0.45,,,0.3485923,9.47E-06,9.85E-05,,,5.11E-07,0.3125479,0.01474068,0.000178091,0.000000209,0.1472829,,0.3724843,,,,,,,,0.25,,,,,,0.675,,0.5,0.5,,,,,,0.25,,, +Other zooplankton,,,,0.2375,,0.009084825,0.8650097,,0.45,0.02627006,0.01077462,0.6321473,0.1458736,0.002759635,0.000807251,0.02817404,0.03404389,0.4612935,0.08764321,0.01217405,0.006646099,0.0963475,0.05386934,0.2755505,0.0041,,,,,,,0.25,,,,,,0.225,,0.5,0.5,,,,,,,,, +Pelagic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.05,,,,,,,,0.5,0.15,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,0.25,,,,,,,,0.25,0.2,0.25,0.25,,,,,0.5,0.5,0.5,0.5,,,,, +Primary production,,,,,,,,,,,,,,,,,,,,,,,,,0.0039,,,,,,,,0.25,,,,,0.05,,,,,,,,0.5,0.6,0.7,, +Pelagic detritus,,,,,,,,,,0.005581916,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,0.01302447,,,,,,,,,,,,,,,0.26565,0.75,0.05,0.25,0.4,,0.5,,0.75,0.75,0.2,0.75,0.75,,,,,0.5,0.5,0.5,0.5,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_ECS_pedigree.csv b/data-raw/Ecosense_ECS_pedigree.csv new file mode 100644 index 00000000..2d1148c5 --- /dev/null +++ b/data-raw/Ecosense_ECS_pedigree.csv @@ -0,0 +1,53 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Polar bears,0.8,0.5,0.6,0.8,0.8 +Toothed whales,0.5,0.6,0.6,0.7,0.5 +Gray whale,0.5,0.6,0.6,0.7,0 +Bowhead whale,0.5,0.6,0.6,0.7,0.1 +Walrus/bearded seal,0.8,0.6,0.6,0.7,0.5 +Wintering seals,0.8,0.6,0.6,0.6,0.5 +Procellarids,0.5,0.6,0.6,0.8,0 +Cormorants,0.5,0.6,0.6,0.8,0 +Other seabirds,0.5,0.6,0.6,0.8,0 +Larids,0.5,0.6,0.6,0.8,0 +Alcids piscivorous,0.5,0.6,0.6,0.8,0 +Alcids planktivorous,0.5,0.6,0.6,0.8,0 +Lg.-mouth flatfish,0.8,0.5,0.5,0.3,0 +Sm.-mouth flatfish,0.8,0.6,0.6,0.3,0 +Lg.-mouth sculpins,0.8,0.6,0.6,0.3,0 +Other sculpins,0.8,0.6,0.6,0.3,0 +Eelpouts,0.8,0.6,0.6,0.3,0 +Pelagic forage fish,0.8,0.6,0.6,0.3,0 +Misc. shallow fish,0.8,0.6,0.6,0.3,0 +Other demersals,0.8,0.6,0.6,0.3,0 +Skates,0.1,0.6,0.7,0.8,0 +Walleye pollock,0.1,0.6,0.6,0.3,0 +Pacific cod,0.1,0.6,0.6,0.8,0 +Arctic cod,0.8,0.2,0.2,0.3,0 +Snow crab,0.1,0.6,0.6,0.8,0 +Bivalves,0.1,0.5,0.7,0.8,0 +Snails,0.1,0.6,0.7,0.8,0 +Other crabs,0.1,0.6,0.7,0.8,0 +Shrimps,0.8,0.6,0.7,0.8,0 +Sea stars,0.1,0.6,0.7,0.8,0 +Brittle stars,0.1,0.6,0.7,0.8,0 +Basket stars,0.1,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.1,0.5,0.7,0.8,0 +Sponge,0.1,0.6,0.7,0.8,0 +Anemones,0.1,0.6,0.7,0.8,0 +Benthic urochordate,0.1,0.6,0.7,0.8,0 +Corals and sea pens,0.1,0.6,0.7,0.8,0 +Scyphozoid jellies,0.1,0.6,0.6,0.8,0 +Octopods,0.8,0.6,0.7,0.8,0 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Salmon returning,0.8,0.6,0.6,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Polychaetes,0.1,0.5,0.7,0.8,0 +Worms etc.,0.1,0.6,0.7,0.8,0 +Misc. crustaceans,0.1,0.6,0.7,0.8,0 +Copepods,0.8,0.6,0.6,0.8,0 +Other zooplankton,0.8,0.6,0.7,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.8,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0,0,0,0,0 +Benthic detritus,0,0,0,0,0 diff --git a/data-raw/Ecosense_GOA_base.csv b/data-raw/Ecosense_GOA_base.csv new file mode 100644 index 00000000..4a340d95 --- /dev/null +++ b/data-raw/Ecosense_GOA_base.csv @@ -0,0 +1,51 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.06165833,0.04713691,12.43829,,,0,0.2,,0.5,0.5,1.29E-07,8.45E-07 +Gray whale,0,0.05543134,0.063365,8.87285,,,0,0.2,,0.5,0.5,8.57E-08,0 +Other baleen,0,0.4567338,0.03134125,6.980565,,,0,0.2,,0.5,0.5,0,5.19E-05 +Other pinnipeds,0,0.03346486,0.1222834,36.81018,,,0,0.2,,0.5,0.5,0.000090749,4.04E-06 +Procellarids,0,0.001051795,0.06487884,73,,,0,0.2,,0.5,0.5,0,1.43E-06 +Alcids piscivorous,0,0.01131623,0.09528826,72.57302,,,0,0.2,,0.5,0.5,0,1.54E-05 +Larids,0,0.001458566,0.1115763,95.5601,,,0,0.2,,0.5,0.5,0,1.98E-06 +Alcids planktivorous,0,0.000299744,0.1694877,110,,,0,0.2,,0.5,0.5,0,4.07E-07 +Other seabirds,0,0.000461801,0.09378317,109.5,,,0,0.2,,0.5,0.5,0,6.27E-07 +Cormorants,0,0.000348881,0.1587271,73,,,0,0.2,,0.5,0.5,0,4.74E-07 +Sharks,0,0.142353,0.1,3.729058,,,0,0.2,,0.5,0.5,0.000176845,0.00594262 +Walleye pollock,0,6.224493,0.6538435,4.109179,,,-1.35,0.2,,0.5,0.5,0.0618452,0.281034 +Pacific cod,0,1.520393,0.5576789,2.39571,,,0,0.2,,0.5,0.5,0.1218526,0.1289747 +Pelagic forage fish,0,14.26999,0.8180392,3.676071,,,-0.11,0.2,,0.5,0.5,0.05087369,0.005135313 +Lg.-mouth flatfish,0,8.015218,0.2929934,1.443946,,,0,0.2,,0.5,0.5,0.08691967,0.07947716 +Sm.-mouth flatfish,0,2.44411,0.2152337,1.93294,,,0,0.2,,0.5,0.5,0.04497369,0.02795422 +Skates,0,0.191803,0.2,2,,,0,0.2,,0.5,0.5,0.003005425,0.01178723 +Other demersals,0,4.505964,0.1830862,2.246801,,,-0.002,0.2,,0.5,0.5,0.09719946,0.09624746 +Eelpouts,0,1.069425,0.4,2,,,0,0.2,,0.5,0.5,7.66E-06,1.66E-05 +Lg.-mouth sculpins,0,0.08888517,0.4,2,,,0,0.2,,0.5,0.5,0.000193433,0.004255149 +Other sculpins,0,0.8168654,0.4,2,,,0,0.2,,0.5,0.5,0,0 +Misc. shallow fish,0,0.8389893,0.4,2,,,0,0.2,,0.5,0.5,0.000319678,0.000919832 +Octopods,0,0.7834731,0.8,3.65,,,0,0.2,,0.5,0.5,0.000165189,0.000167874 +Squid,0,1.265454,3.2,10.67,,,0,0.2,,0.5,0.5,0.000119335,0.000225772 +Salmon returning,0,0.8566338,1.815861,11.8269,,,0,0.2,,0.5,0.5,0.29042,0.02977088 +Salmon outgoing,0,0.01713268,1.641523,14.38647,,,0,0.2,,0.5,0.5,0,0 +Other crabs,0,5.218338,0.8414152,3.966247,,,0,0.2,,0.1,0.9,0.003609303,0.000240075 +Shrimps,0,22.22855,0.576,2.41,,,0,0.2,,0.1,0.9,0.00019897,4.79E-06 +Sea stars,0,0.09551849,1.21,6.05,,,0,0.2,,0.1,0.9,0.000009245,0.003106511 +Brittle stars,0,4.544021,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,1.630926,0.61,3.05,,,0,0.2,,0.1,0.9,3.51E-06,7.42E-05 +Snails,0,0.8638767,1.81,9.049999,,,0,0.2,,0.1,0.9,3.27E-07,0 +Misc. crustaceans,0,2.120289,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,5.868869,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.08886787,1,5,,,0,0.4,,0.1,0.9,4.09E-07,7.39E-05 +Corals and sea pens,0,0.005739689,0.05045965,0.2522982,,,0,0.4,,0.1,0.9,2.98E-06,2.43E-05 +Worms etc.,0,3.772863,2.195745,10.97872,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.2448,3.58,17.9,,,0,0.4,,0.1,0.9,0,0.000006744 +Sponge,0,0.1075014,1,5,,,0,0.4,,0.1,0.9,2.65E-07,0.000020834 +Bivalves,0,13.85198,1.3,6.5,,,0,0.4,,0.1,0.9,0.000280681,0 +Polychaetes,0,3.923291,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.11,0.88,3,,,0,0.2,,0.7,0.3,0.000141226,0.000195899 +Other zooplankton,0,23.99852,5.30758,15.16452,,,0,0.2,,0.7,0.3,0,0 +Copepods,0,21.8635,6,27.74,,,0,0.2,,0.7,0.3,0,0 +Pelagic microbes,0,12.25505,36.5,104.2857,,,0,0.2,,0.7,0.3,0,0 +Benthic microbes,0,7.252296,36.5,104.2857,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,40.39581,110.2083,,,,0,0,,0.5001647,0.4998353,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3908825,0.6091174,, diff --git a/data-raw/Ecosense_GOA_diet.csv b/data-raw/Ecosense_GOA_diet.csv new file mode 100644 index 00000000..90f58390 --- /dev/null +++ b/data-raw/Ecosense_GOA_diet.csv @@ -0,0 +1,51 @@ +DIETS,Toothed whales,Gray whale,Other baleen,Other pinnipeds,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squid,Salmon returning,Salmon outgoing,Other crabs,Shrimps,Sea stars,Brittle stars,"Urchins, dollars, cucumbers",Snails,Misc. crustaceans,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,0.000053212,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,0.000195671,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.00161226,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.00011813,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,0.00001722,8.24E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,0.000185269,0.000886036,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,2.39E-05,0.000114203,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,4.91E-06,2.35E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,7.56E-06,0.000036158,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,5.71E-06,2.73E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000161708,,,,,,,,,,0.007149246,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.003959108,,0.01536035,0.2443831,0.1994964,0.1707221,0.1374473,0.002219961,0.019285,0.000520214,0.0642318,0.01730322,0.165236,,0.2428017,0.001732163,0.05733645,0.02243403,0.003956129,0.1298187,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01370258,,,0.01315614,0.03869898,0.0953234,0.02666247,0.000430635,0.003740967,0.000100913,0.01441741,4.16E-05,4.53E-05,,0.00643942,0.000612311,0.01391214,0.000445677,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.1161123,,0.2332085,0.3194725,0.2109555,0.5695944,0.7290136,0.0579436,0.1867094,0.9490509,0.09923565,0.05399713,0.05462447,,0.3145934,0.002486164,0.1599201,0.01277022,0.01307451,0.08628713,,,,0.15,,,,,,,,,,,,,,,,,,0.008000001,,,,, +Lg.-mouth flatfish,0.005098103,,,0.06527214,,,,,,,0.1543446,0.000791903,0.01130468,,0.01020996,1.63E-05,0.1309565,0.000628949,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.001552685,,,0.01064673,,,,,,,0.01475467,0.001102062,0.006265766,,0.003265063,,0.09747098,6.51E-05,7.38E-06,0.03985396,0.009723351,0.000782896,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.001757251,,,0.002557138,,,,,,,0.006894708,,,,,,8.46E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.0355815,,0.000854911,0.0275689,0.000779691,0.000999022,0.000999001,0.000999028,0.000656877,0.000999001,0.1612058,4.97E-06,0.000487305,,0.01635126,,0.007544784,0.00062241,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.03762805,,,0.001576726,,,,,,,,0.000384112,0.00827353,,0.01708649,0.001052443,0.06045089,1.19E-05,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,0.004269105,,,,,,,0.001023347,,,,0.0004592,,0.001537074,0.00074721,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.0239836,,,0.001656653,,,,,,,0.008203304,0.000368221,0.03324791,,0.003973727,0.002730238,0.008991601,0.001097425,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.0183782,,0.01225261,0.01958377,,,,,,,0.01196223,0.000873976,0.00369463,,0.004439839,0.00072485,0.009763914,0.000227009,0.000986536,0.01898878,0.04985735,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,,,0.003456976,,,,,,,0.01923347,0.000801896,0.01928917,,0.004122138,5.58E-05,0.005395931,0.03390534,,0.01435831,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squid,0.7395499,,0.003086945,0.0333473,0.5152936,0.03660618,0.005065987,0.000737371,0.5699574,,0.03743711,0.005250731,0.004351677,,0.002514759,,0.007717871,0.02896504,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.000544865,,0.01958669,0.09488117,,,,,,,0.1593205,,,,0.01610603,,0.007721416,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,1.09E-05,,0.000391734,0.001760886,,,,,0.000253304,,,,,,,,0.000154428,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.00868696,,0.07330567,,,,,,0.001637441,0.03539184,0.02547316,0.2096924,,0.05080061,0.05152845,0.004317433,0.02019694,0.1014338,0.1003206,0.05453777,,0.2,,,,0.001857261,,0.015,,,,,,,,,,,,,,,,,, +Shrimps,,0.03814375,,7.59E-05,,,,,,0.01679093,0.04296356,0.1641614,0.1930464,,0.1034172,0.1775361,0.2619857,0.2075776,0.01367033,0.1972779,0.5433435,0.06150237,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.000168028,,,,,,,,,3.78E-05,0.001743829,0.001815502,,5.86E-07,0.000471179,,2.18E-06,,5.38E-05,,,,,,,0.000007134,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.007993475,,,,,,,,,0.001799504,,0.000263089,,2.68E-05,0.1307027,0.000445373,1.20E-07,0.1822525,0.000102108,0.000181826,,,,,,0.003674393,,0.03,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,0.002868994,,0.08012424,,,,,,,0.00152771,3.39E-05,1.33E-05,,0.000167073,0.04294402,,2.75E-06,,2.12E-05,,,,,,,0.002019559,,,,,,,,,,,,,,,,,,,, +Snails,,0.001471001,,,,,,,,,0.001029396,4.63E-05,0.003873213,,0.00034488,0.002924132,,0.00091642,,0.001372771,,,0.4,,,,0.002910736,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,0.00358871,,,0.002251724,0.03868497,0.002705831,0.000634075,0.000665534,0.001579755,0.000458313,0.000930434,0.003999098,,0.000181152,0.08995359,0.002523744,0.001508952,0.005357116,0.000792121,0.01442491,,,,,,0.000473233,,,,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,,0.000155224,,0.00744352,0.001744287,0.001830829,0.004345777,0.002902649,0.05938753,0.09548885,0.00000074,0.004069764,0.03767442,0.1267503,0.02685756,0.3280453,0.05959999,0.1947338,0.00359031,,,,,0.001832292,0.3,,0.1,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Anemones,,0.000156329,,,,,,,,,3.52E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,1.01E-05,,,,,,,,,,,,,,,,2.65E-07,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.006274812,,,9.61E-05,,0.004606393,0.001079445,0.001133001,,0.006249924,6.17E-05,0.003281819,,0.000493864,0.03986195,0.0164955,0.000021125,0.02537635,0.01925321,0.03702217,,,,,,0.2279804,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000430632,,,,,,,,,,,0.000000921,,1.83E-07,0.000503441,,0.000544108,,,,,,,,,4.46E-06,,,,,,,,,,,,,,,,,,,, +Sponge,,0.000189108,,,,,,,,,,,2.79E-05,,8.28E-07,1.27E-07,,6.28E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.02344889,,,0.000368692,,0.01768009,0.00414309,0.004348645,,0.005278854,0.000192252,0.002028014,,0.000433315,0.08457874,0.002404211,5.30E-05,0.05257818,0.000393605,,,0.4,,,,0.2544916,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.006569219,,0.002660374,0.000103289,,0.004953088,0.001160688,0.001218275,,0.001478873,0.004868158,0.05555004,7.80E-06,0.001962562,0.2496711,0.001560155,0.001169203,0.2386699,0.10978,0.02550207,,,,,,0.2717699,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,0.005856221,1.72E-06,,,,3.28E-08,,0.004273257,,7.51E-06,,0.000036637,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5818204,,0.01520136,0.04391786,0.02999332,0.4632186,0.1048208,0.01196193,0.08262146,0.5702611,0.07453965,0.9000154,0.1908987,0.07980518,0.005273665,0.5375271,0.001346272,0.1561293,0.01137116,0.9312431,,0.65,0.6,0.5,,0.2,,,,,,,,,,,,,,0.7400001,0.006289897,,,, +Copepods,,,0.1334379,,0.01542998,0.04415208,0.03015328,0.4656892,0.1053799,0.0130131,0.04071566,0.09128769,0.000105551,0.09997606,5.90E-05,0.002411173,,0.0915686,,2.77E-05,0.01865575,0.002844756,,0.2,0.2,0.5,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,,8.87E-07,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,0.03,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4955608,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,1.78E-07,,5.42E-07,,,4.38E-07,,,,,,,,,,,,,0.25,0.2,,,,,,,,,,0.07000001,0.5937101,0.5,0.7,, +Pelagic detritus,,,,,,,0.003276177,,,,,,,,,,,,,,,,,,,,0.000732203,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,0.01223919,0.000631227,0.04945371,,0.00477988,2.26E-05,0.009285232,0.00585382,0.00062444,0.008015925,,,,,,,0.2322469,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5012683,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/data-raw/Ecosense_GOA_pedigree.csv b/data-raw/Ecosense_GOA_pedigree.csv new file mode 100644 index 00000000..8d072f57 --- /dev/null +++ b/data-raw/Ecosense_GOA_pedigree.csv @@ -0,0 +1,50 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whale,0.5,0.6,0.6,0.8,0.3 +Other baleen,0.8,0.6,0.6,0.8,0.1 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.8,0.7,0.7,0.8,0.7 +Walleye pollock,0.8,0.4,0.4,0.1,0.3 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.5,0.4,0.4,0.1,0.7 +Sm.-mouth flatfish,0.8,0.6,0.6,0.7,0.3 +Skates,0.5,0.7,0.7,0.8,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.8,0.8 +Other sculpins,0.8,0.7,0.7,0.8,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squid,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.5 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.5,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.5,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.3 +Misc. crustaceans,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.1,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.8,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.3 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.7,0.8,0 +Copepods,0.8,0.7,0.6,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/data-raw/Rpath_unbalanced_data.R b/data-raw/Rpath_unbalanced_data.R new file mode 100644 index 00000000..09ed8e25 --- /dev/null +++ b/data-raw/Rpath_unbalanced_data.R @@ -0,0 +1,18 @@ +## Code to create unbalanced ecopath objects for Rpath examples +## Doesn't run on package install, needs to be run in repo and then Rdata +## files created in data and inst/extdata need to be pushed/committed. +## +## Only re-run if changing input data changes, or if structure of unbalanced +## ecosystem object changes. +## +## Also create entry in R/data.R file for each ecosystem. + +## This must be run from the Rpath package's root directory (the +## directory with the /data, /R, /data-raw and /inst folders). + +library(usethis) +library(Rpath) + +EBS.sensemodel <- read.rpath.params("") + +usethis::use_data(DATASET, overwrite = TRUE) diff --git a/data/test_usedat.rda b/data/test_usedat.rda new file mode 100644 index 0000000000000000000000000000000000000000..b667744392ee2d32512bbb960fa9138a816a5c57 GIT binary patch literal 92 zcmV-i0HgmxT4*^jL0KkKS;CJ Date: Wed, 11 May 2022 14:51:11 -0700 Subject: [PATCH 3/6] Ecosense ecosystems added --- DESCRIPTION | 2 ++ R/data.R | 47 +++++++++++++++++++++++++------ data-raw/Rpath_unbalanced_data.R | 18 ++++++++++-- data/Ecosense.EBS.rda | Bin 0 -> 8481 bytes data/Ecosense.ECS.rda | Bin 0 -> 6266 bytes data/Ecosense.GOA.rda | Bin 0 -> 7800 bytes data/test_usedat.rda | Bin 92 -> 0 bytes man/Ecosense.EBS.Rd | 26 +++++++++++++++++ man/Ecosense.ECS.Rd | 26 +++++++++++++++++ man/Ecosense.GOA.Rd | 26 +++++++++++++++++ man/test_usedat.Rd | 25 ---------------- 11 files changed, 134 insertions(+), 36 deletions(-) create mode 100644 data/Ecosense.EBS.rda create mode 100644 data/Ecosense.ECS.rda create mode 100644 data/Ecosense.GOA.rda delete mode 100644 data/test_usedat.rda create mode 100644 man/Ecosense.EBS.Rd create mode 100644 man/Ecosense.ECS.Rd create mode 100644 man/Ecosense.GOA.Rd delete mode 100644 man/test_usedat.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 49a8fa62..5f26165c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,3 +30,5 @@ VignetteBuilder: knitr RoxygenNote: 7.1.1 URL: https://github.com/NOAA-EDAB/Rpath BugReports: https://github.com/NOAA-EDAB/Rpath/issues +Depends: + R (>= 2.10) diff --git a/R/data.R b/R/data.R index 9e45449c..59ccb377 100644 --- a/R/data.R +++ b/R/data.R @@ -1,13 +1,44 @@ -#' Gulf of Alaska (west/central) 1990s Ecopath model. +#' Eastern Bering Sea 1990s Ecopath model (53 biological groups and 1 fleet). #' -#' Rpath inputs (unbalanaced model) from the Western/Centeral Gulf of Alaska -#' 1990s Ecopath model. +#' Rpath inputs (unbalanaced model). #' -#' @format An Rpath model object +#' @format An Rpath unbalanced model object that contains: #' \describe{ -#' \item{price}{price, in US dollars} -#' \item{carat}{weight of the diamond, in carats} +#' \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} +#' \item{diet}{A data.table containing the Ecopath model's diet matrix.} +#' \item{stanzas}{Parameters for multistanza groups.} +#' \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} #' ... #' } -#' @source Some Source Or Other -"test_usedat" \ No newline at end of file +#' @source Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074 +"Ecosense.EBS" + +#' Gulf of Alaska (west/central) 1990s Ecopath model (49 biological groups and 1 fleet). +#' +#' Rpath inputs (unbalanaced model). +#' +#' @format An Rpath unbalanced model object that contains: +#' \describe{ +#' \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} +#' \item{diet}{A data.table containing the Ecopath model's diet matrix.} +#' \item{stanzas}{Parameters for multistanza groups.} +#' \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} +#' ... +#' } +#' @source Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074 +"Ecosense.GOA" + +#' Eastern Chukchi Sea Ecopath model (52 biological groups and 1 fleet). +#' +#' Rpath inputs (unbalanaced model). +#' +#' @format An Rpath unbalanced model object that contains: +#' \describe{ +#' \item{model}{A data.table containing Ecopath unbalanced ecosystem parameters (base parameters and fisheries).} +#' \item{diet}{A data.table containing the Ecopath model's diet matrix.} +#' \item{stanzas}{Parameters for multistanza groups.} +#' \item{pedigree}{A data.table containing the data quality (pedigree) for the Ecopath model.} +#' ... +#' } +#' @source Whitehouse and Aydin 2020. Assessing the sensitivity of three Alaska marine food webs to perturbations: an example of Ecosim simulations using Rpath. https://doi.org/10.1016/j.ecolmodel.2020.109074 +"Ecosense.ECS" \ No newline at end of file diff --git a/data-raw/Rpath_unbalanced_data.R b/data-raw/Rpath_unbalanced_data.R index 09ed8e25..2b54e75b 100644 --- a/data-raw/Rpath_unbalanced_data.R +++ b/data-raw/Rpath_unbalanced_data.R @@ -13,6 +13,18 @@ library(usethis) library(Rpath) -EBS.sensemodel <- read.rpath.params("") - -usethis::use_data(DATASET, overwrite = TRUE) +Ecosense.EBS <- read.rpath.params("data-raw/Ecosense_EBS_base.csv", + "data-raw/Ecosense_EBS_diet.csv", + "data-raw/Ecosense_EBS_pedigree.csv" +) +Ecosense.GOA <- read.rpath.params("data-raw/Ecosense_GOA_base.csv", + "data-raw/Ecosense_GOA_diet.csv", + "data-raw/Ecosense_GOA_pedigree.csv" +) +Ecosense.ECS <- read.rpath.params("data-raw/Ecosense_ECS_base.csv", + "data-raw/Ecosense_ECS_diet.csv", + "data-raw/Ecosense_ECS_pedigree.csv" +) +usethis::use_data(Ecosense.EBS, overwrite = TRUE) +usethis::use_data(Ecosense.GOA, overwrite = TRUE) +usethis::use_data(Ecosense.ECS, overwrite = TRUE) diff --git a/data/Ecosense.EBS.rda b/data/Ecosense.EBS.rda new file mode 100644 index 0000000000000000000000000000000000000000..71d29f4219fa1948158d3b56e70569804ddb957c GIT binary patch literal 8481 zcmV++A>Q6XT4*^jL0KkKS#DU+YXB=lfB*mg|NsC0|NsC0|NsC0|NsC0|NsC0|NsC0 z|NsC0|Nr0`UEdA%&}$9%ZuhmS`Q?oJn)k9rRq}^B@4LI^_jSGA*StVT9JD6d7uYv^ z`R{^&x$iYsow@5FBC4ny*+9fd5CTllCIB@Ch9-t4nWU$*o9i)NvMKpY(?~rhsXdV=wLLV^HfjXY4J1tsCJB=zHo|GCgvmXsdr9PvKvDXQC#2e* zQ%^~!lO%ecqttq89;3lcs5JEhH4hV0)ICiHls!$OQ%9-kJwWoBY^SJVJep|8kI_b% z57inmJxv~v^&3R>1e%g0#7cOEDDs|D)bxyuN2%pKMiWMvr~#nUKr}Saz!TH~>H(wl zp|w3nq75|kfN7J|9-uu&n@H0pjWT4=89ftfdYU$%1JXT1Y6gNTAv7STq->^WfW*_( zG8!9GLq>*~8VxjPXlbC+Mok8rQIG&=z=J^0$kQW6jj50{X_1f(02%-qWB@cY27#bO zBp^nKgcz8nOw`fj(w?V`rWE~2w9uO*Wb}rasPzpP&}5#bM~Uj09;c{cJee{kPg6|> znlgHtWYM705Xq*7ni^!&N2J8snJ{W%Z6~P6dYhOK01jZ{5miYF>EZZJ>DoXGvo_J! zcD%rlOhN%c3ojQAr=4rn%5Zt=Z7)%ie+VuCu9-m`27*ZG!zTO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OognKev6NbFvK2WscIZbTy#>1Yb|6Jh3w^ftiU#{;-8HlV)rwS4c%Nh+}FHASM literal 0 HcmV?d00001 diff --git a/data/Ecosense.ECS.rda b/data/Ecosense.ECS.rda new file mode 100644 index 0000000000000000000000000000000000000000..885dda6bc76ddff2ad52aa930a353b105f7f5e7a GIT binary patch literal 6266 zcmV-=7=`CTT4*^jL0KkKS?QcyWdJHb|NsC0|NsC0|NsC0|NsC0|NsC0|NsC0|NsC0 z|NsC0|Nr0={`bb#38>kC9Fj3z1M$)i;BDVZ@cWXYz6nlf!u(+JShObLQwPeg-AlTA#fYI>fO@(JdEj1%Oxlc76Ac~ z$uTgQln+e}O`#2=O#~TIX-`ba6ZJ#X@+N6AHm9UC^&Y3F0j7We0ib9a8Z%G;0ML4k z00EEy00Te(HjvXnkN`B$4^g1d001P^lpsoehKhO`L(@t6Oq!Z$wHr~j7$y;fZA}J7 zX)&TOCI~dm5r6^=0F9}m6HOXpNrGZwq8T!Jm`o7KrkZK#G8$kenr~1=BtumFRLrNO zX!Ia@fB~Qy000J_plAkxqd)IC+QK0G|7>nrk;?~O*GM(dZs3WO&)@18fY>! z4K&C!^%`wPfuIekp^1pXXc`74jXgo5KtAzAKrKtHn1Vu`oV|6sK#H;4)2^A|= zlBgs`nyQ%WDcN#f%I8HUD**fB4HZh_Ctt@DzDFg{Z0%-;Vl9`JWXhT26U&eNhPup2v0~- zNVGwUR!KBzS$`y$m6>K)G_5>RNjc=>HKsvATOlhg$s$Q4-JxBoK$xijWC4(sp)koh zHCQ2FNJvT&1`-m$gtA2dLqkCng%ox803CJ&LRoKeY#aapba++#8|>Rtg=B_R(;$3H zb^AY;uHIQQ*fbEsgaqcXb;>n0Y8?S6B{a$tE?N{Z5b(Jfc=1^x7?FS%^$LPUNDE{%DGWgSqrSB6b-YA;Bp@uPk5PDO@T0(+Lv{4 z^83k4qwjQlC6E zCWBIFxsE#IhHJ9$Eg_}#a-BBs%5@+6uD~+F;m~3X#F7~y7Ap)yLk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aEg%q_Do(BzW7iIhhrB z`4s&!aOd$?@-U1q%5Sto-H@ly|k!=y**bOuS7@ZoO`R zo!GC*CIm`1u+q~?(W%z-;`k3L5@oU-WG;-l(iVCBKF+6eO6}jhuExXh2MKH*ET$6@ z`yG>;1Mjw8>PagXy(P`UAabE2c>~$|b&-f(n=>ipN`sruPS-79wytY6y@3q>5S*|2 zjDQe=lGhj;`%*^l*iXSdbRVhGLS?he5vQNaIXPJK;JRO@-^@6(j+0=y)5o!t{q-G- z^F9CPgH=0Uw!}PiB9!yf#hcjUAKJ!4HE!rX8W%a@da_fMX&WKHi+1#TC{4pe)m9-b z2!H?u-5C(4RFdvr4t3ch4I!^Z`lKG12!NKn;$NcOKV*z<9^tpS9F$F(CYD?H)HX_0 zv_Egl{H7TEZ>c}i5fKZcotmN@s@YgK+9qwXMkV8ti4$@(ohjN5Hz-s@D~u+_2hVzo zPIZFj$87v*|HG5v^QNfj=n{AYAQWV`YmU1+{oIqnV5U35_|_JK0LEbdBA5aIssAq< zoHic*R2l4hqoJRd5Qmd0f0d7a((>GVF)ldf!~g;gN8R&9E?7Z>BvP7wRizoDBi0?$ zktn>@kq4!z5p1^=afInBJyvF4(A9oZT{UqC0!!jXrW&do!m9nZqWTQI<5r5nJuEH8 zq?S!JB%0<1K9wS?eU%Heuz*4kfIuR{dwbr3@i*@v99ho%*($L?QCp1QP0m{R0)JO_ z>^8g_^-D_o?jK`vd@gWVYPt~3oK6di5J)^Z_~9=X7PF0M)$L$&#(-@Y8L zI(rk=*5qjz_L<-3y)HbufLuxF8#Xd0$*w!to0Wm`siW?%RN%qd@^RNg1nofn Date: Wed, 11 Jan 2023 10:31:35 -0800 Subject: [PATCH 4/6] syncing dev before workshop - only changed RcppExports --- src/RcppExports.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 7b0f1c36..c6f2024b 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,6 +5,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // rk4_run List rk4_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear); RcppExport SEXP _Rpath_rk4_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP) { From 5127f75ae5d129eae60db076b2d2de50de8ed4a7 Mon Sep 17 00:00:00 2001 From: kaydin Date: Fri, 13 Jan 2023 10:44:24 -0800 Subject: [PATCH 5/6] adding inst/extdata files for sense ecosystems --- data-raw/Rpath_unbalanced_data.R | 19 ++++++++- inst/extdata/Ecosense_EBS_base.csv | 55 ++++++++++++++++++++++++++ inst/extdata/Ecosense_EBS_diet.csv | 55 ++++++++++++++++++++++++++ inst/extdata/Ecosense_EBS_pedigree.csv | 54 +++++++++++++++++++++++++ inst/extdata/Ecosense_ECS_base.csv | 54 +++++++++++++++++++++++++ inst/extdata/Ecosense_ECS_diet.csv | 54 +++++++++++++++++++++++++ inst/extdata/Ecosense_ECS_pedigree.csv | 53 +++++++++++++++++++++++++ inst/extdata/Ecosense_GOA_base.csv | 51 ++++++++++++++++++++++++ inst/extdata/Ecosense_GOA_diet.csv | 51 ++++++++++++++++++++++++ inst/extdata/Ecosense_GOA_pedigree.csv | 50 +++++++++++++++++++++++ src/RcppExports.cpp | 5 +++ 11 files changed, 499 insertions(+), 2 deletions(-) create mode 100644 inst/extdata/Ecosense_EBS_base.csv create mode 100644 inst/extdata/Ecosense_EBS_diet.csv create mode 100644 inst/extdata/Ecosense_EBS_pedigree.csv create mode 100644 inst/extdata/Ecosense_ECS_base.csv create mode 100644 inst/extdata/Ecosense_ECS_diet.csv create mode 100644 inst/extdata/Ecosense_ECS_pedigree.csv create mode 100644 inst/extdata/Ecosense_GOA_base.csv create mode 100644 inst/extdata/Ecosense_GOA_diet.csv create mode 100644 inst/extdata/Ecosense_GOA_pedigree.csv diff --git a/data-raw/Rpath_unbalanced_data.R b/data-raw/Rpath_unbalanced_data.R index 2b54e75b..e0973e81 100644 --- a/data-raw/Rpath_unbalanced_data.R +++ b/data-raw/Rpath_unbalanced_data.R @@ -5,9 +5,9 @@ ## Only re-run if changing input data changes, or if structure of unbalanced ## ecosystem object changes. ## -## Also create entry in R/data.R file for each ecosystem. +## Also CREATE ENTRY in R/data.R file for each ecosystem. -## This must be run from the Rpath package's root directory (the +## This MUST BE RUN from the Rpath package's root directory (the ## directory with the /data, /R, /data-raw and /inst folders). library(usethis) @@ -28,3 +28,18 @@ Ecosense.ECS <- read.rpath.params("data-raw/Ecosense_ECS_base.csv", usethis::use_data(Ecosense.EBS, overwrite = TRUE) usethis::use_data(Ecosense.GOA, overwrite = TRUE) usethis::use_data(Ecosense.ECS, overwrite = TRUE) + +#files you want available to the user to inspect +extfiles <- c("data-raw/Ecosense_EBS_base.csv", + "data-raw/Ecosense_EBS_diet.csv", + "data-raw/Ecosense_EBS_pedigree.csv", + "data-raw/Ecosense_GOA_base.csv", + "data-raw/Ecosense_GOA_diet.csv", + "data-raw/Ecosense_GOA_pedigree.csv", + "data-raw/Ecosense_ECS_base.csv", + "data-raw/Ecosense_ECS_diet.csv", + "data-raw/Ecosense_ECS_pedigree.csv") + +file.copy(extfiles,"inst/extdata", overwrite=TRUE) + + diff --git a/inst/extdata/Ecosense_EBS_base.csv b/inst/extdata/Ecosense_EBS_base.csv new file mode 100644 index 00000000..f0d21e03 --- /dev/null +++ b/inst/extdata/Ecosense_EBS_base.csv @@ -0,0 +1,55 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.03503154,0.06911141,17.39968,,,0,0.2,,0.4,0.6,2.52E-05,0.000006747 +Gray whales,0,0.0326672,0.063365,8.87285,,,0,0.2,,0.4,0.6,0,0 +Other baleen,0,0.5007642,0.02832879,6.642456,,,0,0.2,,0.4,0.6,0.000000183,1.91E-05 +Bowhead whales,0,0.007173534,0.01005034,8.679965,,,0,0.2,,0.4,0.6,0,0 +Other pinnipeds,0,0.04919672,0.09292668,33.97923,,,0,0.2,,0.4,0.6,0.000100598,5.62E-06 +Walrus/bearded seal,0,0.1142484,0.051293,15.37061,,,0,0.2,,0.4,0.6,3.09E-05,5.96E-06 +Wintering seals,0,0.03029022,0.068998,19.19651,,,0,0.2,,0.4,0.6,0.000031609,3.15E-07 +Procellarids,0,0.000920162,0.07456178,73,,,0,0.2,,0.4,0.6,2.20E-09,0.000003567 +Alcids piscivorous,0,0.008617982,0.1623509,72.05511,,,0,0.2,,0.4,0.6,2.08E-08,3.34E-05 +Larids,0,0.000767614,0.08903116,104.9432,,,0,0.2,,0.4,0.6,1.90E-09,2.98E-06 +Alcids planktivorous,0,0.001754495,0.1694877,110,,,0,0.2,,0.4,0.6,4.20E-09,6.80E-06 +Other seabirds,0,0.000101753,0.06846981,76.18891,,,0,0.2,,0.4,0.6,2.00E-10,3.94E-07 +Cormorants,0,0.000149799,0.1587271,73,,,0,0.2,,0.4,0.6,4.00E-10,5.81E-07 +Sharks,0,0.0532473,0.1,3,,,0,0.2,,0.4,0.6,1.55E-05,0.000695172 +Walleye pollock,0,22.97889,0.8208976,4.193416,,,0,0.2,,0.392,0.608,0.4041824,2.104923 +Pacific cod,0,2.650923,0.5080103,2.739351,,,0,0.2,,0.392,0.608,0.2240711,0.1983278 +Pelagic forage fish,0,7.644652,0.7672387,3.732284,,,0,0.2,,0.392,0.608,0.02158515,0.007684128 +Lg.-mouth flatfish,0,1.58756,0.1937844,1.213555,,,0,0.2,,0.392,0.608,0.01807182,0.04641179 +Sm.-mouth flatfish,0,11.31311,0.2096047,1.325415,,,0,0.2,,0.392,0.608,0.1925451,0.2227745 +Skates,0,0.7733867,0.2,2,,,0,0.2,,0.392,0.608,0.004292543,0.02400982 +Other demersals,0,1.382284,0.2117719,2.526838,,,0,0.2,,0.392,0.608,0.01536881,0.01027679 +Eelpouts,0,2.371533,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Lg.-mouth sculpins,0,0.5403231,0.4,2,,,0,0.2,,0.392,0.608,0.000573506,0.009394558 +Other sculpins,0,1.136692,0.4,2,,,0,0.2,,0.392,0.608,0,0 +Misc. shallow fish,0,1.167694,0.4,2,,,0,0.2,,0.392,0.608,1.13E-05,3.58E-05 +Octopods,0,0.192476,0.8,3.65,,,0,0.2,,0.392,0.608,7.99E-05,0.000228618 +Squids,0,0.9269976,3.2,10.67,,,0,0.2,,0.392,0.608,0.000454888,0.000875192 +Salmon returning,0,0.1637697,1.65,11.6,,,0,0.2,,0.392,0.608,0.1691487,0.00067146 +Salmon outgoing,0,0.0141972,1.28,13.56,,,0,0.2,,0.392,0.608,0,0 +Other crabs,0,3.244238,0.9338375,3.872315,,,0,0.2,,0.1,0.9,0.06657811,0.003027228 +Snow crab,0,2.178832,1.295101,3.117084,,,0,0.2,,0.1,0.9,0.3006897,0.006839902 +Shrimps,0,19.44489,0.5756463,2.40941,,,0,0.2,,0.1,0.9,2.25E-07,0.000001989 +Sea stars,0,2.471359,1.21,6.05,,,0,0.2,,0.1,0.9,3.87E-05,0.006488753 +Brittle stars,0,2.950093,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +Urchins dollars cucumbers,0,1.167418,0.61,3.05,,,0,0.2,,0.1,0.9,3.48E-07,6.56E-05 +Snails,0,0.8071689,1.81,9.049999,,,0,0.2,,0.1,0.9,1.88E-07,1.80E-05 +Misc. crustacean,0,8.88581,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,12.79612,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.1095207,1,5,,,0,0.4,,0.1,0.9,4.31E-07,0.000384743 +Corals and sea pens,0,0.02658792,0.06929576,0.3464788,,,0,0.4,,0.1,0.9,3.25E-07,0.000025347 +Worms etc.,0,3.905683,2.155615,10.77807,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.3544967,3.58,17.9,,,0,0.4,,0.1,0.9,6.09E-06,0.001505825 +Sponge,0,0.05448509,1,5,,,0,0.4,,0.1,0.9,1.91E-06,0.00064731 +Bivalves,0,61.87307,1.3,6.5,,,0,0.4,,0.1,0.9,2.33E-08,1.11E-07 +Polychaetes,0,21.68738,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid Jellies,0,0.3379304,0.88,3,,,0,0.2,,0.4,0.6,0.003364776,0.01527125 +Other zooplankton,0,22.7485,5.253331,15.00952,,,0,0.2,,0.4,0.6,0,0 +Copepods,0,26.85738,6,27.74,,,0,0.2,,0.4,0.6,0,0 +Pelagic microbes,0,45,36.5,104.2857,,,0,0.25,,0.4,0.6,0,0 +Benthic microbes,0,22.06101,36.5,104.2857,,,0,0.25,,0.1,0.9,0,0 +Primary production,1,48.60443,99.40636,,,,0,0,,0.4004332,0.5995669,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.2278577,0.7721423,, diff --git a/inst/extdata/Ecosense_EBS_diet.csv b/inst/extdata/Ecosense_EBS_diet.csv new file mode 100644 index 00000000..ab7e75b0 --- /dev/null +++ b/inst/extdata/Ecosense_EBS_diet.csv @@ -0,0 +1,55 @@ +DIETS,Toothed whales,Gray whales,Other baleen,Bowhead whales,Other pinnipeds,Walrus/bearded seal,Wintering seals,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squids,Salmon returning,Salmon outgoing,Other crabs,Snow crab,Shrimps,Sea stars,Brittle stars,Urchins dollars cucumbers,Snails,Misc. crustacean,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid Jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,6.47E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whales,0.000133081,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.002040034,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whales,2.92E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.000205117,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,,,,,,0.001017812,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,6.33E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,0.00059265,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,5.28E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,0.000120655,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,7.00E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,1.03E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000239291,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.1698044,,0.08070278,,0.2811362,,0.4888999,0.1655044,0.2614391,0.2021952,0.002550183,0.1678919,0.02434087,0.2,0.08240532,0.2243627,,0.5571692,0.03047612,0.4114217,0.004290166,0.00395613,0.1298186,,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01947363,,,,0.01366742,,0.0049334,0.007216445,0.1888303,0.008816263,0.000111195,0.007320547,0.001061329,,0.000594541,0.00446721,,0.006268422,3.22E-05,0.006085007,,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.2487804,,0.1201802,,0.2320068,,0.1287617,0.3508018,0.3939846,0.6618846,0.05411142,0.3104237,0.931414,,0.005597626,0.03139776,,0.0777799,0.04213176,0.0297038,0.004689368,0.01307451,0.08628711,,,,0.15,,,,,,,,,,,,,,,,,,,0.008,,,,, +Lg.-mouth flatfish,0.001034033,,,,5.86E-06,,,,,,,,,0.2,0.000824726,0.001458564,,0.002081271,6.93E-05,0.02431003,1.60E-06,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.006842509,,,,0.08088505,,0.0394672,,,,,,,,0.000164344,0.02012908,,0.02068678,0.000488947,0.09006111,0.000020214,7.38E-06,0.03985396,0.009723351,0.007394266,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.003475559,,,,,,,,,,,,,,,5.18E-07,,1.45E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.005536608,,,,0.01134714,,,0.000564447,0.000998577,0.000999001,0.001003092,0.000032534,0.00084674,0.2,4.84E-07,0.001655552,,0.001043523,,,0.000351201,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.141124,,,,0.008174762,,0.05969413,,,,,,,,0.000426192,0.03098069,,0.04269749,0.001878417,0.08047485,3.13E-06,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,,,,,,,,,,,,7.54E-06,0.001176434,,0.0002093,1.93E-05,0.000021452,0.000121231,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.05504273,,,,0.01009857,,0.07893439,,,,,,,,0.000323667,0.01049386,,0.01287026,0.001030404,0.02096508,0.000147024,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.03660734,,0.01555704,,0.02213815,,0.09866799,,,,,,,0.02,8.52E-05,0.003238108,,0.004294502,0.000809832,0.007287188,5.99E-06,0.000986537,0.01898878,0.04985736,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,0.005624069,,,,0.02070426,0.01017812,0.009866798,,,,,,,0.02,2.62E-05,0.005013016,,0.000651224,7.19E-05,,0.000360057,,0.01435832,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squids,0.2922446,,0.002097894,,0.2519298,,0.00049334,0.4435776,0.03470331,0.006531665,0.00074037,0.503465,,0.2,0.001616147,0.00071992,,0.07333685,0.00012839,2.53E-05,0.2840489,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.01169868,,0.005824628,,0.008696572,,,,,,,,,0.05,,0.001279095,,,,0.02247792,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,7.14E-08,,3.56E-08,,0.008696572,,,,,,,7.53E-08,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.002564021,,0.001170194,0.01055097,0.006252694,0.009866799,,,,,,0.000783198,0.0025,0.001008549,0.1117827,,0.01110253,0.01499601,0.05703641,0.001302062,0.008096965,0.06165776,0.05453778,0.000531343,0.15,,,,0.005500491,0.06013035,,0.01,,,,,,,,,,,,,,,,,, +Snow crab,,0.001909877,,0.000871649,0.000698742,0.003925424,,,,,,,0.00121494,,1.81E-05,0.05749471,,0.004300768,0.004455289,0.0300742,,0.09333689,0.03866288,,,0.05,,,,,,,0.005,,,,,,,,,,,,,,,,,, +Shrimps,,0.01358641,,0.006200707,0.02408229,0.02035623,0.0542674,,,,,,0.0086428,0.005,0.03297897,0.1420867,0,0.05616299,0.08154,0.07128841,0.2867417,0.01367033,0.1972778,0.5433436,0.225388,,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.001959092,,0.000894111,,,,,,,,,,,2.83E-05,0.00012312,,1.04E-08,3.16E-06,0.00055577,4.92E-06,,5.38E-05,,,,,,,0.000382242,0.000603733,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.002253839,,0.00102863,,,,,,,,,,,3.63E-05,0.000185201,,6.63E-05,0.05973076,5.11E-05,2.43E-06,0.1822525,0.000102108,0.000181826,,,,,,0.01228855,0.07161608,,0.03,,,,,,,,,,,,,,,,,, +Urchins dollars cucumbers,,0.000840129,,0.000383427,0.01513655,,,,,,,,,,1.25E-07,0.000107477,,5.44E-06,0.02279872,8.06E-08,,,2.12E-05,,,,,,,0.01201729,0.007422531,,,,,,,,,,,,,,,,,,,, +Snails,,0.000502282,,0.000229237,2.21E-05,0.0610687,,,,,,,,0.0025,0.000179459,0.004685467,,0.000333693,0.007431038,0.000301499,0.000000029,,0.001372771,,,0.4,,,,0.01685826,0.04829947,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustacean,,0.006993907,,0.003191952,,,,0.004287296,0.009203487,0.003571809,0.00072099,3.73E-05,0.004449074,,0.007055759,0.002030444,,2.65E-05,0.02593507,0.000023285,4.31E-07,0.005357117,0.000792121,0.01442491,4.38E-05,,,,,0.001538223,0.01720634,,,,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,0.004360963,,,,6.32E-05,,0.004879939,0.000985044,5.10E-05,0.006078489,,0.03478977,0.1104455,2.96E-06,0.001273519,0.09940312,0.008388263,0.001051775,0.3280452,0.05959997,0.1947338,0.09178961,,,,,0.005461351,0.04782058,0.3,,0.1,,,,,0.125,0.125,0.003506872,0.125,0.125,0.125,,,,,,, +Anemones,,8.68E-05,,3.96E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,0.001850753,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,2.11E-05,,9.62E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.002718438,,0.001240668,,0.1832061,0.02614701,1.69E-05,,0.001301065,0.000262628,1.36E-05,,,0.001353052,0.02704704,,0.000266081,0.09399602,5.84E-05,7.86E-07,0.02537635,0.01925321,0.03702217,,,,,,0.2085163,0.03021216,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000281016,,0.000128253,,,,,,,,,,,1.68E-05,0.000549436,,3.16E-06,0.002288761,1.66E-06,0.000489444,,,,,,,,,0.000570783,,,,,,,,,,,,,,,,,,,,, +Sponge,,4.32E-05,,1.97E-05,,,,,,,,,,,5.47E-05,4.36E-05,,9.00E-10,9.09E-05,7.98E-06,,,,,,,,,,0.00023874,0.002601985,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.04904792,,0.022385,2.21E-05,0.7139949,,0.00032442,,0.02504892,0.005056271,0.000261789,,,0.000490379,0.00165732,,0.000577568,0.08503099,2.78E-05,8.08E-06,0.05257819,0.000393605,,,0.4,,,,0.2533802,0.2524816,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.01719198,,0.007846256,,,,0.000113714,,0.008779998,0.001772293,9.18E-05,,,0.00366851,0.03710564,3.12E-05,0.000641417,0.3154908,0.002781462,0.000225772,0.2386699,0.10978,0.02550208,1.19E-05,,,,,0.263431,0.2847306,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid Jellies,,,,,,,,,,,,,,,2.91E-05,3.76E-06,,1.33E-06,0.001530271,1.47E-05,0.0001446,,7.51E-06,,0.06429844,,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5746825,0.55,,,,0.01148704,0.04877095,0.03297732,0.4103911,0.004580894,0.008569111,,0.4335781,0.1106963,0.9033016,0.09674293,0.09784253,0.000493316,0.3819539,0.001346271,0.1561293,0.01137116,0.6102213,,0.65,0.6,0.5,,0.004736442,0.2,,,,,,,,,,,,,,0.74,0.008073313,,,, +Copepods,,,0.200955,0.4,,,,0.01519615,0.06206967,0.04196949,0.5222954,0.00583,0.01259939,,0.3857745,0.001424687,0.09666412,0.000011405,0.00054752,,0.03367182,,2.77E-05,0.01865575,0.000321321,,0.2,0.2,0.5,,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,1.93E-06,8.57E-06,,,0.000224104,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,,0.05,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4901808,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,,,,1.85E-05,,1.76E-07,5.60E-09,,,,,,,,,,,0.001516897,0.004452738,,,,0.25,0.2,,,,,,,,,,0.05,0.5919268,0.5,0.7,, +Pelagic detritus,,,,,,,,,,0.00104472,,,,,,,,,,,,,,,,,,,,0.000994342,0.005903513,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,,,,0.1,0.006865464,0.0561312,,0.02938087,0.009528337,0.1360623,0.000363454,0.00062444,0.008015924,,,,,,,0.2173052,0.1599311,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5028055,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/inst/extdata/Ecosense_EBS_pedigree.csv b/inst/extdata/Ecosense_EBS_pedigree.csv new file mode 100644 index 00000000..8f783a1e --- /dev/null +++ b/inst/extdata/Ecosense_EBS_pedigree.csv @@ -0,0 +1,54 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whales,0.5,0.6,0.6,0.8,0 +Other baleen,0.8,0.6,0.6,0.8,0.3 +Bowhead whales,0.5,0.1,0.6,0.8,0 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Walrus/bearded seal,0.5,0.6,0.6,0.7,0.3 +Wintering seals,0.5,0.6,0.6,0.7,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.5,0.7,0.7,0.8,0.7 +Walleye pollock,0.5,0.4,0.4,0.1,0.1 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.8,0.6,0.8,0.3,0.7 +Sm.-mouth flatfish,0.8,0.6,0.8,0.7,0.3 +Skates,0.5,0.7,0.7,0.7,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.3,0.8 +Other sculpins,0.8,0.7,0.7,0.3,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squids,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.8 +Snow crab,0.1,0.6,0.8,0.7,0.3 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.8,0.6,0.7,0.8,0 +Urchins dollars cucumbers,0.8,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.5 +Misc. crustacean,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.5,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.5,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.5 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid Jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.8,0.8,0 +Copepods,0.8,0.7,0.8,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/inst/extdata/Ecosense_ECS_base.csv b/inst/extdata/Ecosense_ECS_base.csv new file mode 100644 index 00000000..bc8fdad4 --- /dev/null +++ b/inst/extdata/Ecosense_ECS_base.csv @@ -0,0 +1,54 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Polar bears,0,0.00052669,0.0603,4.001384,,,0,0.2,,0.3,0.7,1.84E-05,3.00E-10 +Toothed whales,0,0.01158743,0.112092,14.50402,,,0,0.2,,0.3,0.7,6.34E-05,1.00E-10 +Gray whale,0,0.1879512,0.063365,8.87285,,,0,0.2,,0.3,0.7,0,0 +Bowhead whale,0,0.3984775,0.01005,5.260121,,,0,0.2,,0.3,0.7,0.001198808,1.00E-10 +Walrus/bearded seal,0,0.09814298,0.07127273,18.19188,,,0,0.2,,0.3,0.7,0.004842258,2.00E-10 +Wintering seals,0,0.06165962,0.08586258,19.17929,,,0,0.2,,0.3,0.7,0.002269417,2.00E-10 +Procellarids,0,0.001927375,0.06674218,187.9285,,,0,0.2,,0.3,0.7,0,0 +Cormorants,0,1.47E-06,0.1625189,142.6185,,,0,0.2,,0.3,0.7,0,0 +Other seabirds,0,7.77E-05,0.1625189,374.3133,,,0,0.2,,0.3,0.7,0,0 +Larids,0,9.31E-05,0.1057225,205.6736,,,0,0.2,,0.3,0.7,0,0 +Alcids piscivorous,0,0.001155027,0.104122,178.3831,,,0,0.2,,0.3,0.7,0,0 +Alcids planktivorous,0,0.000139496,0.1404024,247.5067,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth flatfish,0,0.1114285,0.4006235,1.780206,,,0,0.2,,0.3,0.7,0,0 +Sm.-mouth flatfish,0,0.09015632,0.3078811,1.535264,,,0,0.2,,0.3,0.7,0,0 +Lg.-mouth sculpins,0,0.599852,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Other sculpins,0,0.8552857,0.4592638,2.415146,,,0,0.2,,0.3,0.7,0,0 +Eelpouts,0,0.3821929,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Pelagic forage fish,0,1.190608,0.5432349,2.919605,,,0,0.2,,0.3,0.7,0,0 +Misc. shallow fish,0,7.477481,0.41934,2.105119,,,0,0.2,,0.3,0.7,0,0 +Other demersals,0,0.2338559,0.4,2,,,0,0.2,,0.3,0.7,0,0 +Skates,0,0.005364676,0.21,2.1,,,0,0.2,,0.3,0.7,0,0 +Walleye pollock,0,0.0005417,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0,0 +Pacific cod,0,0.000037935,0.5477087,2.802848,,,0,0.2,,0.3,0.7,0,0 +Arctic cod,0,1.044914,0.8689514,3.008252,,,0,0.2,,0.3,0.7,0.000000001,1.00E-10 +Snow crab,0,3.169973,1,2.75,,,0,0.2,,0.1,0.9,0,0 +Bivalves,0,90.28777,0.755625,3.778125,,,0,0.4,,0.1,0.9,0,0 +Snails,0,1.384463,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Other crabs,0,3.067152,0.82,4.1,,,0,0.2,,0.1,0.9,0,0 +Shrimps,0,7.492234,0.576,2.409,,,0,0.2,,0.1,0.9,0,0 +Sea stars,0,2.180155,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +Brittle stars,0,5.644247,0.485,2.425,,,0,0.4,,0.1,0.9,0,0 +Basket stars,0,0.5098612,0.34,1.7,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,36.28965,0.695,3.475,,,0,0.4,,0.1,0.9,0,0 +Sponge,0,0.5271555,1,5,,,0,0.4,,0.1,0.9,0,0 +Anemones,0,0.3841269,1,5,,,0,0.2,,0.1,0.9,0,0 +Benthic urochordate,0,1.160084,3.58,17.9,,,0,0.4,,0.1,0.9,0,0 +Corals and sea pens,0,0.02567942,0.046,0.23,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.3719727,0.88,3,,,0,0.2,,0.3,0.7,0,0 +Octopods,0,0.01057694,1.77,8.849999,,,0,0.2,,0.1,0.9,0,0 +Salmon outgoing,0,0.000520686,1.28,13.56,,,0,0.2,,0.3,0.7,0,0 +Salmon returning,0,0.005206862,1.65,11.6,,,0,0.2,,0.3,0.7,0,0 +Benthic amphipods,0,20.52637,1,5,,,0,0.4,,0.1,0.9,0,0 +Polychaetes,0,27.80796,2.915733,14.57867,,,0,0.4,,0.1,0.9,0,0 +Worms etc.,0,17.03959,2.23,11.15,,,0,0.4,,0.1,0.9,0,0 +Misc. crustaceans,0,5.580986,2.008,10.04,,,0,0.4,,0.1,0.9,0,0 +Copepods,0,2.042696,6,27.74,,,0,0.2,,0.3,0.7,0,0 +Other zooplankton,0,1.225213,5.475,15.64286,,,0,0.2,,0.3,0.7,0,0 +Pelagic microbes,0,1.488708,26.25,75,,,0,0.2,,0.3,0.7,0,0 +Benthic microbes,0,22.31168,26.25,75,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,27.8,75,,,,0,0,,0.3,0.7,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3,0.7,, diff --git a/inst/extdata/Ecosense_ECS_diet.csv b/inst/extdata/Ecosense_ECS_diet.csv new file mode 100644 index 00000000..85514f75 --- /dev/null +++ b/inst/extdata/Ecosense_ECS_diet.csv @@ -0,0 +1,54 @@ +DIETS,Polar bears,Toothed whales,Gray whale,Bowhead whale,Walrus/bearded seal,Wintering seals,Procellarids,Cormorants,Other seabirds,Larids,Alcids piscivorous,Alcids planktivorous,Lg.-mouth flatfish,Sm.-mouth flatfish,Lg.-mouth sculpins,Other sculpins,Eelpouts,Pelagic forage fish,Misc. shallow fish,Other demersals,Skates,Walleye pollock,Pacific cod,Arctic cod,Snow crab,Bivalves,Snails,Other crabs,Shrimps,Sea stars,Brittle stars,Basket stars,"Urchins, dollars, cucumbers",Sponge,Anemones,Benthic urochordate,Corals and sea pens,Scyphozoid jellies,Octopods,Salmon outgoing,Salmon returning,Benthic amphipods,Polychaetes,Worms etc.,Misc. crustaceans,Copepods,Other zooplankton,Pelagic microbes,Benthic microbes,Primary production +Polar bears,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Toothed whales,0.1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bowhead whale,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walrus/bearded seal,0.25,,,,0.000212616,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Wintering seals,0.65,,,,0.000504327,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,,,,,,,0.004651598,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.005322316,0.02487342,,0.001472492,0.006102135,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,,,,,0.006081153,0.000781252,,,,,0.009612602,,,,,,,,,0.01650201,0.06433967,,0.01072673,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,0.009999999,,,0.01659991,0.0410623,,,,0.001718235,0.07135769,,,,,,0.04798269,0.005778736,,0.04407414,0.02363462,,0.006649494,0.006265168,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,,0.009999999,,,,0.008492618,,,,0.001718235,0.07133969,,,,0.206761,,0.000789418,0.004220617,,0.05228622,0.000336991,,0.004856593,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,,0.009999999,,,,,,,,,,,,,0.08932029,,,,,0.003859158,0.04130904,,0.004297453,0.003560629,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,,0.5544065,,,0.000657422,0.06911467,0.05867733,0.25,,0.3324589,0.2731979,,,,,0.03727878,,,,0.05182033,0.05281629,,,0.04948226,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,,0.03590742,,,0.00509502,0.3092427,,0.25,,0.0267805,0.2405652,,0.3332412,,0.2435342,,0.07879899,0.1874234,0.06125135,0.07786866,0.01548537,,0.06349141,0.002147306,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,,,,,,0.001981432,,,,0.007045029,0.006587705,,,,0.01485121,,0.000345366,,,0.09428567,0.005443891,,0.00277255,0.002785945,,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,,,,,,,,,,,,,,,,,,,,,,,0.000578866,,,,,,,,,,,,,,,,,,,,,,,,,,, +Pacific cod,,,,,,,,,,,,,,,,,,,,,0.001371445,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Arctic cod,,0.2796861,,,0.002410548,0.4286107,0.06969959,0.25,,0.5012766,0.2594775,,0.2409175,,,,,,,0.005050726,0.2729864,0.5366726,0.1560087,0.008183806,,,,,,,,,,,,,,,,,,,,,,,,,, +Snow crab,,,0.000256674,0.000113781,0.07158563,,,,,,,,,0.0265204,0.07528889,0.00226101,,,,0.01153278,0.2568457,,0.1453266,,,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Bivalves,,,0.0433623,0.01922197,0.5941439,,,,,1.53E-06,2.65E-06,,0.00729814,0.3710207,,0.001438914,0.000389389,,0.04453,0.001736895,1.76E-05,,0.001407035,4.30E-05,0.2075,,0.5,0.25,0.15,0.5154778,0.125,,,,0.2,,,,0.25,,,,,,,,,,, +Snails,,,0.004340004,0.00192387,0.04782695,,,,,0.005283926,0.003017653,,,0.000498679,,0.006792177,,,0.000733818,,5.89E-05,,0.001507538,,0.0326,,,,,0.05159265,,,,,,,,,0.25,,,,,,,,,,, +Other crabs,,,7.88E-05,3.49E-05,0.02207871,,,,,0.005283772,0.003044799,,,0.000157228,0.1497352,0.05728141,0.002116573,0.000288189,0.005869959,0.02178959,0.06081963,,0.0525628,0.001098868,0.0411,,,,,,,,,,,,,,0.25,,,,,,,,,,, +Shrimps,,0.09993257,1.25E-05,5.55E-06,0.08408973,0.09176343,,0.25,,0.01060208,0.009951027,,0.1977302,,0.1319228,0.01229081,0.01550181,0.009836816,0.1471351,0.181513,0.1139477,0.1423735,0.2859297,0.1600893,,,,,,,,,,,,,,,,,,,,,,,,,, +Sea stars,,,0.004000351,0.001773306,,,,,,,,,,,,,,,,,,,,,0.0015,,,,,,,,,,,,,,,,,,,,,,,,, +Brittle stars,,,0.003698438,0.001639472,,,,,,,,,,0.03040408,1.92E-05,0.005426886,,,,,6.06E-06,,,,0.05895,,,,,,,,,,,,,,,,,,,,,,,,, +Basket stars,,,0.00014616,6.48E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,,0.02290767,0.01015469,0.05747112,,,,,,,,,0.05108213,,,,,,,0.000107293,,,,0.0081,,,,,0.2723194,,,,,,,,,,,,,,,,,,,, +Sponge,,,0.000249278,0.000110502,,,,,,,,,,,,,,,,,,,,,0.00275,,,,,,,,,,,,,,,,,,,,,,,,, +Anemones,,,0.002641741,0.001171051,,,,,,,,,,,,0.06376915,,,,,1.18E-05,,,,0.00115,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic urochordate,,,0.002641741,0.001171051,0.006627641,,,,,,,,,,,,,,,,0.00021469,,,,,,,,,0.03140422,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,,2.54E-06,1.13E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,,0.0192604,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,0.000067419,,,0.007169423,0.001830349,,,,,,,,,,,,,,,6.64E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon returning,,,,,,,,,,,,,,,,,,,,,0.02096798,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Benthic amphipods,,,0.9,0.005671234,0.03530366,0.03725448,0.002204452,,0.1,0.03446057,0.02325702,,0.0252337,0.1203165,0.0703186,0.4825385,0.2814546,0.01338544,0.4361333,0.3160916,0.03019983,0.0429575,0.137789,0.09571919,0.05525,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,,0.01086888,0.00481804,0.03047494,,,,,0.02371788,0.008201232,,0.04969615,0.3519998,0.01052774,0.2352545,0.5376897,0.004593154,0.1107291,0.1004426,0.007359331,,0.06924623,0.004512317,0.27195,,0.3,0.25,0.15,0.1292059,0.125,,,,,,,,,,,,,,,,,,, +Worms etc.,,,0.002226611,0.000987029,0.005586154,,,,,,,,,0.008323649,,0.06003539,,,0.02272738,0.000147471,,,,,0.03125,,0.05,0.25,,,,,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,,0.002566263,0.001137593,,,,,,0.00012475,,,,0.03681871,0.006913655,0.007458307,0.00088703,0.000632304,0.06850621,0.003324673,0.000133681,0.03436605,0.001507538,0.01197542,0.01425,,0.05,,0.15,,0.125,0.25,,,0.2,,,,,,,,,,,,,,, +Copepods,,,,0.7125,,,0.004408904,,0.45,,,0.3485923,9.47E-06,9.85E-05,,,5.11E-07,0.3125479,0.01474068,0.000178091,0.000000209,0.1472829,,0.3724843,,,,,,,,0.25,,,,,,0.675,,0.5,0.5,,,,,,0.25,,, +Other zooplankton,,,,0.2375,,0.009084825,0.8650097,,0.45,0.02627006,0.01077462,0.6321473,0.1458736,0.002759635,0.000807251,0.02817404,0.03404389,0.4612935,0.08764321,0.01217405,0.006646099,0.0963475,0.05386934,0.2755505,0.0041,,,,,,,0.25,,,,,,0.225,,0.5,0.5,,,,,,,,, +Pelagic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.05,,,,,,,,0.5,0.15,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,0.25,,,,,,,,0.25,0.2,0.25,0.25,,,,,0.5,0.5,0.5,0.5,,,,, +Primary production,,,,,,,,,,,,,,,,,,,,,,,,,0.0039,,,,,,,,0.25,,,,,0.05,,,,,,,,0.5,0.6,0.7,, +Pelagic detritus,,,,,,,,,,0.005581916,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,0.01302447,,,,,,,,,,,,,,,0.26565,0.75,0.05,0.25,0.4,,0.5,,0.75,0.75,0.2,0.75,0.75,,,,,0.5,0.5,0.5,0.5,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/inst/extdata/Ecosense_ECS_pedigree.csv b/inst/extdata/Ecosense_ECS_pedigree.csv new file mode 100644 index 00000000..2d1148c5 --- /dev/null +++ b/inst/extdata/Ecosense_ECS_pedigree.csv @@ -0,0 +1,53 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Polar bears,0.8,0.5,0.6,0.8,0.8 +Toothed whales,0.5,0.6,0.6,0.7,0.5 +Gray whale,0.5,0.6,0.6,0.7,0 +Bowhead whale,0.5,0.6,0.6,0.7,0.1 +Walrus/bearded seal,0.8,0.6,0.6,0.7,0.5 +Wintering seals,0.8,0.6,0.6,0.6,0.5 +Procellarids,0.5,0.6,0.6,0.8,0 +Cormorants,0.5,0.6,0.6,0.8,0 +Other seabirds,0.5,0.6,0.6,0.8,0 +Larids,0.5,0.6,0.6,0.8,0 +Alcids piscivorous,0.5,0.6,0.6,0.8,0 +Alcids planktivorous,0.5,0.6,0.6,0.8,0 +Lg.-mouth flatfish,0.8,0.5,0.5,0.3,0 +Sm.-mouth flatfish,0.8,0.6,0.6,0.3,0 +Lg.-mouth sculpins,0.8,0.6,0.6,0.3,0 +Other sculpins,0.8,0.6,0.6,0.3,0 +Eelpouts,0.8,0.6,0.6,0.3,0 +Pelagic forage fish,0.8,0.6,0.6,0.3,0 +Misc. shallow fish,0.8,0.6,0.6,0.3,0 +Other demersals,0.8,0.6,0.6,0.3,0 +Skates,0.1,0.6,0.7,0.8,0 +Walleye pollock,0.1,0.6,0.6,0.3,0 +Pacific cod,0.1,0.6,0.6,0.8,0 +Arctic cod,0.8,0.2,0.2,0.3,0 +Snow crab,0.1,0.6,0.6,0.8,0 +Bivalves,0.1,0.5,0.7,0.8,0 +Snails,0.1,0.6,0.7,0.8,0 +Other crabs,0.1,0.6,0.7,0.8,0 +Shrimps,0.8,0.6,0.7,0.8,0 +Sea stars,0.1,0.6,0.7,0.8,0 +Brittle stars,0.1,0.6,0.7,0.8,0 +Basket stars,0.1,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.1,0.5,0.7,0.8,0 +Sponge,0.1,0.6,0.7,0.8,0 +Anemones,0.1,0.6,0.7,0.8,0 +Benthic urochordate,0.1,0.6,0.7,0.8,0 +Corals and sea pens,0.1,0.6,0.7,0.8,0 +Scyphozoid jellies,0.1,0.6,0.6,0.8,0 +Octopods,0.8,0.6,0.7,0.8,0 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Salmon returning,0.8,0.6,0.6,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Polychaetes,0.1,0.5,0.7,0.8,0 +Worms etc.,0.1,0.6,0.7,0.8,0 +Misc. crustaceans,0.1,0.6,0.7,0.8,0 +Copepods,0.8,0.6,0.6,0.8,0 +Other zooplankton,0.8,0.6,0.7,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.8,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0,0,0,0,0 +Benthic detritus,0,0,0,0,0 diff --git a/inst/extdata/Ecosense_GOA_base.csv b/inst/extdata/Ecosense_GOA_base.csv new file mode 100644 index 00000000..4a340d95 --- /dev/null +++ b/inst/extdata/Ecosense_GOA_base.csv @@ -0,0 +1,51 @@ +Group,Type,Biomass,PB,QB,EE,ProdCons,BioAcc,Unassim,DetInput,PelDetFate,BenthDetFate,F_Fishery,D_Fishery +Toothed whales,0,0.06165833,0.04713691,12.43829,,,0,0.2,,0.5,0.5,1.29E-07,8.45E-07 +Gray whale,0,0.05543134,0.063365,8.87285,,,0,0.2,,0.5,0.5,8.57E-08,0 +Other baleen,0,0.4567338,0.03134125,6.980565,,,0,0.2,,0.5,0.5,0,5.19E-05 +Other pinnipeds,0,0.03346486,0.1222834,36.81018,,,0,0.2,,0.5,0.5,0.000090749,4.04E-06 +Procellarids,0,0.001051795,0.06487884,73,,,0,0.2,,0.5,0.5,0,1.43E-06 +Alcids piscivorous,0,0.01131623,0.09528826,72.57302,,,0,0.2,,0.5,0.5,0,1.54E-05 +Larids,0,0.001458566,0.1115763,95.5601,,,0,0.2,,0.5,0.5,0,1.98E-06 +Alcids planktivorous,0,0.000299744,0.1694877,110,,,0,0.2,,0.5,0.5,0,4.07E-07 +Other seabirds,0,0.000461801,0.09378317,109.5,,,0,0.2,,0.5,0.5,0,6.27E-07 +Cormorants,0,0.000348881,0.1587271,73,,,0,0.2,,0.5,0.5,0,4.74E-07 +Sharks,0,0.142353,0.1,3.729058,,,0,0.2,,0.5,0.5,0.000176845,0.00594262 +Walleye pollock,0,6.224493,0.6538435,4.109179,,,-1.35,0.2,,0.5,0.5,0.0618452,0.281034 +Pacific cod,0,1.520393,0.5576789,2.39571,,,0,0.2,,0.5,0.5,0.1218526,0.1289747 +Pelagic forage fish,0,14.26999,0.8180392,3.676071,,,-0.11,0.2,,0.5,0.5,0.05087369,0.005135313 +Lg.-mouth flatfish,0,8.015218,0.2929934,1.443946,,,0,0.2,,0.5,0.5,0.08691967,0.07947716 +Sm.-mouth flatfish,0,2.44411,0.2152337,1.93294,,,0,0.2,,0.5,0.5,0.04497369,0.02795422 +Skates,0,0.191803,0.2,2,,,0,0.2,,0.5,0.5,0.003005425,0.01178723 +Other demersals,0,4.505964,0.1830862,2.246801,,,-0.002,0.2,,0.5,0.5,0.09719946,0.09624746 +Eelpouts,0,1.069425,0.4,2,,,0,0.2,,0.5,0.5,7.66E-06,1.66E-05 +Lg.-mouth sculpins,0,0.08888517,0.4,2,,,0,0.2,,0.5,0.5,0.000193433,0.004255149 +Other sculpins,0,0.8168654,0.4,2,,,0,0.2,,0.5,0.5,0,0 +Misc. shallow fish,0,0.8389893,0.4,2,,,0,0.2,,0.5,0.5,0.000319678,0.000919832 +Octopods,0,0.7834731,0.8,3.65,,,0,0.2,,0.5,0.5,0.000165189,0.000167874 +Squid,0,1.265454,3.2,10.67,,,0,0.2,,0.5,0.5,0.000119335,0.000225772 +Salmon returning,0,0.8566338,1.815861,11.8269,,,0,0.2,,0.5,0.5,0.29042,0.02977088 +Salmon outgoing,0,0.01713268,1.641523,14.38647,,,0,0.2,,0.5,0.5,0,0 +Other crabs,0,5.218338,0.8414152,3.966247,,,0,0.2,,0.1,0.9,0.003609303,0.000240075 +Shrimps,0,22.22855,0.576,2.41,,,0,0.2,,0.1,0.9,0.00019897,4.79E-06 +Sea stars,0,0.09551849,1.21,6.05,,,0,0.2,,0.1,0.9,0.000009245,0.003106511 +Brittle stars,0,4.544021,1.21,6.05,,,0,0.2,,0.1,0.9,0,0 +"Urchins, dollars, cucumbers",0,1.630926,0.61,3.05,,,0,0.2,,0.1,0.9,3.51E-06,7.42E-05 +Snails,0,0.8638767,1.81,9.049999,,,0,0.2,,0.1,0.9,3.27E-07,0 +Misc. crustaceans,0,2.120289,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Benthic amphipods,0,5.868869,7.4,37,,,0,0.2,,0.1,0.9,0,0 +Anemones,0,0.08886787,1,5,,,0,0.4,,0.1,0.9,4.09E-07,7.39E-05 +Corals and sea pens,0,0.005739689,0.05045965,0.2522982,,,0,0.4,,0.1,0.9,2.98E-06,2.43E-05 +Worms etc.,0,3.772863,2.195745,10.97872,,,0,0.4,,0.1,0.9,0,0 +Benthic urochordate,0,0.2448,3.58,17.9,,,0,0.4,,0.1,0.9,0,0.000006744 +Sponge,0,0.1075014,1,5,,,0,0.4,,0.1,0.9,2.65E-07,0.000020834 +Bivalves,0,13.85198,1.3,6.5,,,0,0.4,,0.1,0.9,0.000280681,0 +Polychaetes,0,3.923291,2.97,14.85,,,0,0.4,,0.1,0.9,0,0 +Scyphozoid jellies,0,0.11,0.88,3,,,0,0.2,,0.7,0.3,0.000141226,0.000195899 +Other zooplankton,0,23.99852,5.30758,15.16452,,,0,0.2,,0.7,0.3,0,0 +Copepods,0,21.8635,6,27.74,,,0,0.2,,0.7,0.3,0,0 +Pelagic microbes,0,12.25505,36.5,104.2857,,,0,0.2,,0.7,0.3,0,0 +Benthic microbes,0,7.252296,36.5,104.2857,,,0,0.2,,0.1,0.9,0,0 +Primary production,1,40.39581,110.2083,,,,0,0,,0.5001647,0.4998353,0,0 +Pelagic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Benthic detritus,2,,0.5,,,,0,0,0,0,0,0,0 +Fishery/Subsistence,3,,,,,,,,,0.3908825,0.6091174,, diff --git a/inst/extdata/Ecosense_GOA_diet.csv b/inst/extdata/Ecosense_GOA_diet.csv new file mode 100644 index 00000000..90f58390 --- /dev/null +++ b/inst/extdata/Ecosense_GOA_diet.csv @@ -0,0 +1,51 @@ +DIETS,Toothed whales,Gray whale,Other baleen,Other pinnipeds,Procellarids,Alcids piscivorous,Larids,Alcids planktivorous,Other seabirds,Cormorants,Sharks,Walleye pollock,Pacific cod,Pelagic forage fish,Lg.-mouth flatfish,Sm.-mouth flatfish,Skates,Other demersals,Eelpouts,Lg.-mouth sculpins,Other sculpins,Misc. shallow fish,Octopods,Squid,Salmon returning,Salmon outgoing,Other crabs,Shrimps,Sea stars,Brittle stars,"Urchins, dollars, cucumbers",Snails,Misc. crustaceans,Benthic amphipods,Anemones,Corals and sea pens,Worms etc.,Benthic urochordate,Sponge,Bivalves,Polychaetes,Scyphozoid jellies,Other zooplankton,Copepods,Pelagic microbes,Benthic microbes,Primary production +Toothed whales,0.000053212,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Gray whale,0.000195671,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other baleen,0.00161226,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other pinnipeds,0.00011813,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Procellarids,,,,0.00001722,8.24E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids piscivorous,,,,0.000185269,0.000886036,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Larids,,,,2.39E-05,0.000114203,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Alcids planktivorous,,,,4.91E-06,2.35E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other seabirds,,,,7.56E-06,0.000036158,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Cormorants,,,,5.71E-06,2.73E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sharks,0.000161708,,,,,,,,,,0.007149246,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Walleye pollock,0.003959108,,0.01536035,0.2443831,0.1994964,0.1707221,0.1374473,0.002219961,0.019285,0.000520214,0.0642318,0.01730322,0.165236,,0.2428017,0.001732163,0.05733645,0.02243403,0.003956129,0.1298187,,,,,,,,,,,,,,,,,,,,,,0.001,,,,, +Pacific cod,0.01370258,,,0.01315614,0.03869898,0.0953234,0.02666247,0.000430635,0.003740967,0.000100913,0.01441741,4.16E-05,4.53E-05,,0.00643942,0.000612311,0.01391214,0.000445677,,0.000913099,0.04028247,,,,,,,,,,,,,,,,,,,,,,,,,, +Pelagic forage fish,0.1161123,,0.2332085,0.3194725,0.2109555,0.5695944,0.7290136,0.0579436,0.1867094,0.9490509,0.09923565,0.05399713,0.05462447,,0.3145934,0.002486164,0.1599201,0.01277022,0.01307451,0.08628713,,,,0.15,,,,,,,,,,,,,,,,,,0.008000001,,,,, +Lg.-mouth flatfish,0.005098103,,,0.06527214,,,,,,,0.1543446,0.000791903,0.01130468,,0.01020996,1.63E-05,0.1309565,0.000628949,,0.000360408,,,,,,,,,,,,,,,,,,,,,,,,,,, +Sm.-mouth flatfish,0.001552685,,,0.01064673,,,,,,,0.01475467,0.001102062,0.006265766,,0.003265063,,0.09747098,6.51E-05,7.38E-06,0.03985396,0.009723351,0.000782896,,,,,,,,,,,,,,,,,,,,,,,,, +Skates,0.001757251,,,0.002557138,,,,,,,0.006894708,,,,,,8.46E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other demersals,0.0355815,,0.000854911,0.0275689,0.000779691,0.000999022,0.000999001,0.000999028,0.000656877,0.000999001,0.1612058,4.97E-06,0.000487305,,0.01635126,,0.007544784,0.00062241,,5.16E-06,,,,,,,,,,,,,,,,,,,,,,,,,,, +Eelpouts,0.03762805,,,0.001576726,,,,,,,,0.000384112,0.00827353,,0.01708649,0.001052443,0.06045089,1.19E-05,0.01845699,0.03330814,,,,,,,,,,,,,,,,,,,,,,,,,,, +Lg.-mouth sculpins,,,,0.004269105,,,,,,,0.001023347,,,,0.0004592,,0.001537074,0.00074721,,0.001836508,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other sculpins,0.0239836,,,0.001656653,,,,,,,0.008203304,0.000368221,0.03324791,,0.003973727,0.002730238,0.008991601,0.001097425,0.01351007,0.02105363,,,,,,,,,,,,,,,,,,,,,,,,,,, +Misc. shallow fish,0.0183782,,0.01225261,0.01958377,,,,,,,0.01196223,0.000873976,0.00369463,,0.004439839,0.00072485,0.009763914,0.000227009,0.000986536,0.01898878,0.04985735,,,,,,,,,,,,,,,,,,,,,,,,,, +Octopods,,,,0.003456976,,,,,,,0.01923347,0.000801896,0.01928917,,0.004122138,5.58E-05,0.005395931,0.03390534,,0.01435831,,,,,,,,,,,,,,,,,,,,,,,,,,, +Squid,0.7395499,,0.003086945,0.0333473,0.5152936,0.03660618,0.005065987,0.000737371,0.5699574,,0.03743711,0.005250731,0.004351677,,0.002514759,,0.007717871,0.02896504,,6.85E-05,,,,,0.2,,,,,,,,,,,,,,,,,0.001,,,,, +Salmon returning,0.000544865,,0.01958669,0.09488117,,,,,,,0.1593205,,,,0.01610603,,0.007721416,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Salmon outgoing,1.09E-05,,0.000391734,0.001760886,,,,,0.000253304,,,,,,,,0.000154428,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Other crabs,,0.00868696,,0.07330567,,,,,,0.001637441,0.03539184,0.02547316,0.2096924,,0.05080061,0.05152845,0.004317433,0.02019694,0.1014338,0.1003206,0.05453777,,0.2,,,,0.001857261,,0.015,,,,,,,,,,,,,,,,,, +Shrimps,,0.03814375,,7.59E-05,,,,,,0.01679093,0.04296356,0.1641614,0.1930464,,0.1034172,0.1775361,0.2619857,0.2075776,0.01367033,0.1972779,0.5433435,0.06150237,,,,,,,0.01,,,,,,,,,,,,,,,,,, +Sea stars,,0.000168028,,,,,,,,,3.78E-05,0.001743829,0.001815502,,5.86E-07,0.000471179,,2.18E-06,,5.38E-05,,,,,,,0.000007134,,,,,,,,,,,,,,,,,,,, +Brittle stars,,0.007993475,,,,,,,,,0.001799504,,0.000263089,,2.68E-05,0.1307027,0.000445373,1.20E-07,0.1822525,0.000102108,0.000181826,,,,,,0.003674393,,0.03,,,,,,,,,,,,,,,,,, +"Urchins, dollars, cucumbers",,0.002868994,,0.08012424,,,,,,,0.00152771,3.39E-05,1.33E-05,,0.000167073,0.04294402,,2.75E-06,,2.12E-05,,,,,,,0.002019559,,,,,,,,,,,,,,,,,,,, +Snails,,0.001471001,,,,,,,,,0.001029396,4.63E-05,0.003873213,,0.00034488,0.002924132,,0.00091642,,0.001372771,,,0.4,,,,0.002910736,,0.005,,,,,,,,,,,,,,,,,, +Misc. crustaceans,,0.00358871,,,0.002251724,0.03868497,0.002705831,0.000634075,0.000665534,0.001579755,0.000458313,0.000930434,0.003999098,,0.000181152,0.08995359,0.002523744,0.001508952,0.005357116,0.000792121,0.01442491,,,,,,0.000473233,,,,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Benthic amphipods,,0.9,,,0.000155224,,0.00744352,0.001744287,0.001830829,0.004345777,0.002902649,0.05938753,0.09548885,0.00000074,0.004069764,0.03767442,0.1267503,0.02685756,0.3280453,0.05959999,0.1947338,0.00359031,,,,,0.001832292,0.3,,0.1,,,,,0.125,0.125,0.001585444,0.125,0.125,0.125,,,,,,, +Anemones,,0.000156329,,,,,,,,,3.52E-05,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Corals and sea pens,,1.01E-05,,,,,,,,,,,,,,,,2.65E-07,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Worms etc.,,0.006274812,,,9.61E-05,,0.004606393,0.001079445,0.001133001,,0.006249924,6.17E-05,0.003281819,,0.000493864,0.03986195,0.0164955,0.000021125,0.02537635,0.01925321,0.03702217,,,,,,0.2279804,,0.01,,,0.2,,,,,,,,,,,,,,, +Benthic urochordate,,0.000430632,,,,,,,,,,,0.000000921,,1.83E-07,0.000503441,,0.000544108,,,,,,,,,4.46E-06,,,,,,,,,,,,,,,,,,,, +Sponge,,0.000189108,,,,,,,,,,,2.79E-05,,8.28E-07,1.27E-07,,6.28E-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Bivalves,,0.02344889,,,0.000368692,,0.01768009,0.00414309,0.004348645,,0.005278854,0.000192252,0.002028014,,0.000433315,0.08457874,0.002404211,5.30E-05,0.05257818,0.000393605,,,0.4,,,,0.2544916,0.1,0.91,,,0.2,,,,,,,,,,,,,,, +Polychaetes,,0.006569219,,0.002660374,0.000103289,,0.004953088,0.001160688,0.001218275,,0.001478873,0.004868158,0.05555004,7.80E-06,0.001962562,0.2496711,0.001560155,0.001169203,0.2386699,0.10978,0.02550207,,,,,,0.2717699,,0.02,,,0.2,,,,,,,,,,,,,,, +Scyphozoid jellies,,,,,,,,,,,0.005856221,1.72E-06,,,,3.28E-08,,0.004273257,,7.51E-06,,0.000036637,,,,,,,,,,,,,,,,,,,,,,,,, +Other zooplankton,,,0.5818204,,0.01520136,0.04391786,0.02999332,0.4632186,0.1048208,0.01196193,0.08262146,0.5702611,0.07453965,0.9000154,0.1908987,0.07980518,0.005273665,0.5375271,0.001346272,0.1561293,0.01137116,0.9312431,,0.65,0.6,0.5,,0.2,,,,,,,,,,,,,,0.7400001,0.006289897,,,, +Copepods,,,0.1334379,,0.01542998,0.04415208,0.03015328,0.4656892,0.1053799,0.0130131,0.04071566,0.09128769,0.000105551,0.09997606,5.90E-05,0.002411173,,0.0915686,,2.77E-05,0.01865575,0.002844756,,0.2,0.2,0.5,,,,,,,,,,,,,,,,0.15,0.25,,,, +Pelagic microbes,,,,,,,,,,,,,,,,8.87E-07,,,0.00065419,,0.000363653,,,,,,,,,,,,,,,,,,,,,0.03,0.15,0.5,,, +Benthic microbes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0.5,0.5,0.15,0.15,0.4955608,0.15,0.15,0.15,0.5,,,,,, +Primary production,,,,,,,,,,,,,1.78E-07,,5.42E-07,,,4.38E-07,,,,,,,,,,,,,0.25,0.2,,,,,,,,,,0.07000001,0.5937101,0.5,0.7,, +Pelagic detritus,,,,,,,0.003276177,,,,,,,,,,,,,,,,,,,,0.000732203,,,,,,,,,,,,,,,,,,0.3,, +Benthic detritus,,,,,,,,,,,0.01223919,0.000631227,0.04945371,,0.00477988,2.26E-05,0.009285232,0.00585382,0.00062444,0.008015925,,,,,,,0.2322469,0.4,,0.9,0.75,0.2,0.5,0.5,0.6,0.6,0.5012683,0.6,0.6,0.6,0.5,,,,,1, +Import,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/inst/extdata/Ecosense_GOA_pedigree.csv b/inst/extdata/Ecosense_GOA_pedigree.csv new file mode 100644 index 00000000..8d072f57 --- /dev/null +++ b/inst/extdata/Ecosense_GOA_pedigree.csv @@ -0,0 +1,50 @@ +Group,B,PB,QB,Diet,F_Fishery/Subsistence +Toothed whales,0.8,0.6,0.6,0.8,0.3 +Gray whale,0.5,0.6,0.6,0.8,0.3 +Other baleen,0.8,0.6,0.6,0.8,0.1 +Other pinnipeds,0.5,0.6,0.8,0.8,0.3 +Procellarids,0.8,0.6,0.6,0.8,0.5 +Alcids piscivorous,0.5,0.6,0.6,0.8,0.5 +Larids,0.5,0.6,0.6,0.8,0.5 +Alcids planktivorous,0.5,0.6,0.6,0.8,0.5 +Other seabirds,0.8,0.6,0.6,0.8,0.5 +Cormorants,0.5,0.6,0.6,0.8,0.5 +Sharks,0.8,0.7,0.7,0.8,0.7 +Walleye pollock,0.8,0.4,0.4,0.1,0.3 +Pacific cod,0.8,0.4,0.4,0.1,0.7 +Pelagic forage fish,0.8,0.7,0.7,0.8,0.5 +Lg.-mouth flatfish,0.5,0.4,0.4,0.1,0.7 +Sm.-mouth flatfish,0.8,0.6,0.6,0.7,0.3 +Skates,0.5,0.7,0.7,0.8,0.7 +Other demersals,0.8,0.7,0.8,0.8,0.8 +Eelpouts,0.8,0.7,0.7,0.8,0.7 +Lg.-mouth sculpins,0.1,0.7,0.7,0.8,0.8 +Other sculpins,0.8,0.7,0.7,0.8,0 +Misc. shallow fish,0.8,0.7,0.7,0.7,0.7 +Octopods,0.8,0.7,0.7,0.8,0.4 +Squid,0.8,0.7,0.7,0.8,0.4 +Salmon returning,0.8,0.5,0.8,0.7,0.3 +Salmon outgoing,0.8,0.6,0.6,0.8,0 +Other crabs,0.8,0.6,0.8,0.8,0.5 +Shrimps,0.8,0.6,0.8,0.8,0.5 +Sea stars,0.5,0.6,0.7,0.8,0.8 +Brittle stars,0.5,0.6,0.7,0.8,0 +"Urchins, dollars, cucumbers",0.5,0.6,0.7,0.8,0.5 +Snails,0.8,0.6,0.7,0.8,0.3 +Misc. crustaceans,0.8,0.6,0.7,0.8,0 +Benthic amphipods,0.8,0.6,0.7,0.8,0 +Anemones,0.5,0.6,0.7,0.8,0.5 +Corals and sea pens,0.1,0.6,0.7,0.8,0.5 +Worms etc.,0.8,0.6,0.7,0.8,0 +Benthic urochordate,0.8,0.6,0.7,0.8,0.5 +Sponge,0.5,0.6,0.7,0.8,0.5 +Bivalves,0.8,0.6,0.7,0.8,0.3 +Polychaetes,0.8,0.6,0.7,0.8,0 +Scyphozoid jellies,0.5,0.6,0.6,0.8,0.5 +Other zooplankton,0.8,0.7,0.7,0.8,0 +Copepods,0.8,0.7,0.6,0.8,0 +Pelagic microbes,0.8,0.7,0.7,0.8,0 +Benthic microbes,0.8,0.7,0.7,0.1,0 +Primary production,0.8,0.7,0,0.01,0 +Pelagic detritus,0.8,0,0,0,0 +Benthic detritus,0.8,0,0,0,0 diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 7b0f1c36..c6f2024b 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,6 +5,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // rk4_run List rk4_run(List params, List instate, List forcing, List fishing, List stanzas, int StartYear, int EndYear); RcppExport SEXP _Rpath_rk4_run(SEXP paramsSEXP, SEXP instateSEXP, SEXP forcingSEXP, SEXP fishingSEXP, SEXP stanzasSEXP, SEXP StartYearSEXP, SEXP EndYearSEXP) { From 4483fdbed928679b201969f0d2ba9a378d2706b4 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 14 Sep 2023 15:29:54 -0400 Subject: [PATCH 6/6] Moved MzeroLoss and MigrateLoss before the NetProd assignment. --- src/ecosim.cpp | 1896 ++++++++++++++++++++++++------------------------ 1 file changed, 949 insertions(+), 947 deletions(-) diff --git a/src/ecosim.cpp b/src/ecosim.cpp index c1855f70..d4fc87c3 100644 --- a/src/ecosim.cpp +++ b/src/ecosim.cpp @@ -1,948 +1,950 @@ - -#include "ecosim.h" - -//################################################################---------- -// Runge-Kutta 4th order method for integrating Ecosim equations -// Currently does not contain aged-structured species. -// [[Rcpp::export]] -List rk4_run (List params, List instate, List forcing, List fishing, List stanzas, - int StartYear, int EndYear){ - - int y, m, dd, t; -// Input rates are in units of years or years^-1. Integration is wri tten so -// that integration timesteps always line up with months, for data reasons. -// STEPS_PER_YEAR should be 12 (for months), and STEPS_PER_MONTH sets the -// rk4 integration timestep. So effective integration timestep with respect -// to input rates (years) is 1/(12*STEPS_PER_MONTH). - const int STEPS_PER_MONTH = as(params["RK4_STEPS"]); - const double hh = DELTA_T/(double)STEPS_PER_MONTH; - -// Get some basic needed numbers from the params List - const int NUM_BIO = as(params["NUM_LIVING"]) + as(params["NUM_DEAD"]); - const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); - const int NumFishingLinks = as(params["NumFishingLinks"]); - -// Switches for run modes - const int BURN_YEARS = as(params["BURN_YEARS"]); - const NumericVector SENSE_LIMIT = as(params["SENSE_LIMIT"]); - const double LO_DISCARD = (SENSE_LIMIT[0]); - const double HI_DISCARD = (SENSE_LIMIT[1]); - int CRASH_YEAR = -1; - int MEASURE_MONTH = 5; - -// Flag for group-sepcific Integration method (NoIntegrate=0 means Fast Eq) - const NumericVector NoIntegrate = as(params["NoIntegrate"]); - -// Parameters needed directly for foraging time adjustment - const NumericVector B_BaseRef = as(params["B_BaseRef"]); - const NumericVector FtimeAdj = as(params["FtimeAdj"]); - const NumericVector FtimeQBOpt = as(params["FtimeQBOpt"]); -// FtimeAdj is monthly unit so adjust for sub-monthly integration - const NumericVector FtimeStep = FtimeAdj/STEPS_PER_MONTH; - -// Number of split groups - const int Nsplit = as(stanzas["Nsplit"]); - -// Parameter need to track catch by Gear - const NumericVector FishFrom = as(params["FishFrom"]); - -// Monthly output matrices - NumericMatrix out_Biomass(EndYear*12, NUM_BIO+1); - NumericMatrix out_Catch(EndYear*12, NUM_BIO+1); - NumericMatrix out_SSB(EndYear*12, NUM_BIO+1); - NumericMatrix out_rec(EndYear*12, NUM_BIO+1); - NumericMatrix out_Gear_Catch(EndYear*12, NumFishingLinks+1); -// Annual output matrices - NumericMatrix annual_Catch(EndYear, NUM_BIO+1); - NumericMatrix annual_Biomass(EndYear, NUM_BIO+1); - NumericMatrix annual_QB(EndYear, NUM_BIO+1); - NumericMatrix annual_Qlink(EndYear, NumPredPreyLinks+1); -// Accumulator for monthly catch values - NumericVector cum_Catch(NUM_BIO+1); - NumericVector cum_Gear_Catch(NumFishingLinks +1); - -//SML -// Update sums of split groups to total biomass for derivative calcs - if(Nsplit > 0){ - SplitSetPred(stanzas, instate); - } -//SML - -// Load state, set some initial values. Make sure state is COPY, not pointer - List state = clone(instate); - dd = StartYear * STEPS_PER_YEAR; // dd is monthly index for data storage - -// KYA 6/12/17 an initial derivative call just to declare deriv in right scope - List dyt = deriv_vector(params,state,forcing,fishing,stanzas,1,0,0); - NumericVector FoodGain = as(dyt["FoodGain"]); - NumericVector Qlink = as(dyt["Qlink"]); - - // MAIN LOOP STARTS HERE with years loop - for (y = StartYear; y <= EndYear; y++){ - if (y<1){stop("RK Year can't be less than 1");} - // Monthly loop - for (m = 0; m < STEPS_PER_YEAR; m++){ - cum_Catch = NumericVector(NUM_BIO+1); // monthly catch to accumulate - cum_Gear_Catch = NumericVector(NumFishingLinks+1); - dd = (y-1) * STEPS_PER_YEAR + m; - // Sub-monthly integration loop - for (t=0; t< STEPS_PER_MONTH; t++){ - double tt = (double)t*hh; // sub monthly timestep in years - // Load state vars (note: this creates pointers, not new vals) - NumericVector old_Biomass = as(state["Biomass"]); - NumericVector old_Ftime = as(state["Ftime"]); - - // Calculate base derivative and RK-4 derivative steps (overwrites YY) - List YY = state; - List k1 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt); - NumericVector kk1 = as(k1["DerivT"]); - - YY["Biomass"] = old_Biomass + 0.5*kk1*hh; - List k2 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + 0.5*hh); - NumericVector kk2 = as(k2["DerivT"]); - - YY["Biomass"] = old_Biomass + 0.5*kk2*hh; - List k3 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + 0.5*hh); - NumericVector kk3 = as(k3["DerivT"]); - - YY["Biomass"] = old_Biomass + kk3*hh; - List k4 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + hh); - NumericVector kk4 = as(k4["DerivT"]); - - // Take an rk4 step - NumericVector new_Biomass = old_Biomass + hh*(kk1 + 2*kk2 + 2*kk3 + kk4)/6.0; - - // Update Foraging time state variable - // pd term is used to indicate differrent values used for - // age-structured species, defaults to Biomass for non-aged structure - NumericVector pd = old_Biomass; - FoodGain = as(k1["FoodGain"]); - Qlink = as(k1["Qlink"]); - NumericVector new_Ftime = ifelse((FoodGain>0)&(pd>0), - 0.1 + 0.9*old_Ftime* - ((1.0-FtimeStep) + FtimeStep*FtimeQBOpt/(FoodGain/pd)), - old_Ftime); - - // Accumulate Catch (small timestep, so linear average) - NumericVector FishingLoss = as(k1["FishingLoss"]); - cum_Catch += (hh * FishingLoss/old_Biomass) * (new_Biomass+old_Biomass)/2.0; - - // Track catch by gear - NumericVector old_Biomass_flink = as(old_Biomass[FishFrom]); - NumericVector new_Biomass_flink = as(new_Biomass[FishFrom]); - NumericVector GearCatch = as(k1["GearCatch"]); - cum_Gear_Catch += (hh * GearCatch / old_Biomass_flink) * (new_Biomass_flink + old_Biomass_flink)/2.0; - - // Set state to new values, including min/max traps - state["Biomass"] = pmax(pmin(new_Biomass, B_BaseRef*BIGNUM), B_BaseRef*EPSILON); - state["Ftime"] = pmin(new_Ftime, 2.0); - }// end of sub-monthly (t-indexed) loop - - // Insert Monthly Stanza (split pool) update here - //SML - // Calculate new derivative - List dyt = deriv_vector(params, state, forcing, fishing, stanzas, y, m, 0); - if(Nsplit > 0){ - SplitUpdate(stanzas, state, forcing, dyt, y, m + 1); - SplitSetPred(stanzas, state); - } - - // Make a copy of the current state for bounds testing - NumericVector cur_Biomass = as(state["Biomass"]); - - // KYA 8/9/17 one of the NA or NaN flags is reading back as a negative integer (-2^32) - // Not sure why. This sets any negative biomass (assuming this means NaN) to NA_REAL - cur_Biomass = ifelse((cur_Biomass<0),NA_REAL,cur_Biomass); - - // If the run is during the "burn-in" years, and biomass goes - // into the discard range, set flag to exit the loop. Should set "bad" - // biomass values to NA - if (y < BURN_YEARS){ cur_Biomass = ifelse((cur_BiomassB_BaseRef*HI_DISCARD), - NA_REAL,cur_Biomass); - } - - // If biomass goes crazy or hits NA, exit loop with crash signal. Note it - // should still write the NA or INF values back to the output. - if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { - CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; - } - - - // Write to monthly output matricies (vector write) - out_Biomass( dd, _) = cur_Biomass; - out_SSB(dd, _) = cur_Biomass; - out_rec(dd, _) = cur_Biomass; - out_Catch( dd, _) = cum_Catch; - out_Gear_Catch(dd, _) = cum_Gear_Catch; - annual_Catch(y-1, _) = annual_Catch(y-1, _) + cum_Catch; - if (m==MEASURE_MONTH){ - annual_Biomass(y-1, _) = cur_Biomass; - annual_QB(y-1, _) = FoodGain/cur_Biomass; - annual_Qlink(y-1, _) = Qlink; - } - } // End of main months loop - - }// End of years loop - -// Write Last timestep (note: SSB and rec only used for age-structure species) - //out_Biomass( dd+1, _) = as(state["Biomass"]); - //out_SSB(dd+1, _) = as(state["Biomass"]); - //out_rec(dd+1, _) = as(state["Biomass"]); - //out_Catch( dd+1, _) = out_Catch( dd, _); - -// Create Rcpp list to output -List outdat = List::create( - _["out_Biomass"]=out_Biomass, - _["out_Catch"]=out_Catch, - _["out_Gear_Catch"]=out_Gear_Catch, - _["annual_Catch"]=annual_Catch, - _["annual_Biomass"]=annual_Biomass, - _["annual_QB"]=annual_QB, - _["annual_Qlink"]=annual_Qlink, - _["end_state"]=state, - _["crash_year"]=CRASH_YEAR); - -// Return is an Rcpp List - return(outdat); -} - -//-----#################################################################---- -// Adams_Basforth two-step method for integrating ecosim equations. -// Fixed monthly timestep with "fast integration" Walters et al. '97 method -// for faster-turnover species. -// Currently does not contain aged-structured species. -// [[Rcpp::export]] -List Adams_run (List params, List instate, List forcing, List fishing, List stanzas, - int StartYear, int EndYear, List InitDeriv){ - -int y, m, dd; - -// Get some basic needed numbers from the params List - const int NUM_BIO = as(params["NUM_LIVING"]) + as(params["NUM_DEAD"]); - const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); - const int NumFishingLinks = as(params["NumFishingLinks"]); - -// Forcing Biomass - //const int NumForcedBio = as(fitting["NumForcedBio"]); - //const IntegerVector BforceNum = as(fitting["BforceNum"]); - // KYA TODO 11/1/2017 put force_bybio in RK! - NumericMatrix force_bybio = as(forcing["ForcedBio"]); - -// Switches for run modes - const int BURN_YEARS = as(params["BURN_YEARS"]); - const NumericVector SENSE_LIMIT = as(params["SENSE_LIMIT"]); - const double LO_DISCARD = (SENSE_LIMIT[0]); - const double HI_DISCARD = (SENSE_LIMIT[1]); - int CRASH_YEAR = -1; - int MEASURE_MONTH = 5; - -// Flag for group-sepcific Integration method (NoIntegrate=0 means Fast Eq) - const NumericVector NoIntegrate = as(params["NoIntegrate"]); - -// Parameters needed directly for foraging time adjustment - const NumericVector B_BaseRef = as(params["B_BaseRef"]); - const NumericVector FtimeAdj = as(params["FtimeAdj"]); - const NumericVector FtimeQBOpt = as(params["FtimeQBOpt"]); - -// Parameters from stanzas - const int Nsplit = as(stanzas["Nsplit"]); - -// Parameter need to track catch by Gear - const NumericVector FishFrom = as(params["FishFrom"]); - -// Monthly output matrices - NumericMatrix out_Biomass( EndYear * 12, NUM_BIO + 1); - NumericMatrix out_Catch( EndYear * 12, NUM_BIO + 1); - NumericMatrix out_SSB(EndYear * 12, NUM_BIO + 1); - NumericMatrix out_rec(EndYear * 12, NUM_BIO + 1); - NumericMatrix out_Gear_Catch(EndYear*12, NumFishingLinks+1); -// Annual output matrices - NumericMatrix annual_Catch(EndYear, NUM_BIO+1); - NumericMatrix annual_Biomass(EndYear, NUM_BIO+1); - NumericMatrix annual_QB(EndYear, NUM_BIO+1); - NumericMatrix annual_Qlink(EndYear, NumPredPreyLinks+1); - -// Load state and call initial derivative (todo: allow other start times) -// Use Clone to make sure state/stanzas are copies of instate/instanzas, not pointers - List state = clone(instate); - //List stanzas = clone(instanzas); - - // Update sums of split groups to total biomass for derivative calcs - if(Nsplit > 0){ - SplitSetPred(stanzas, state); - } - - // Use the initial derivative calculated outside of function - List dyt = InitDeriv; - - dd = StartYear * STEPS_PER_YEAR; - -// MAIN LOOP STARTS HERE -// ASSUMES STEPS_PER_MONTH will always be 1.0, took out divisions - for (y = StartYear; y <= EndYear; y++){ - if (y<1){stop("Adams Year can't be less than 1");} - // Monthly loop - for (m = 0; m < STEPS_PER_YEAR; m++){ - dd = (y-1) * STEPS_PER_YEAR + m; // dd is index for monthly output - // Load old state and old derivative - NumericVector old_Biomass = as(state["Biomass"]); - NumericVector old_Ftime = as(state["Ftime"]); - NumericVector dydt0 = as(dyt["DerivT"]); - NumericVector stanzaPred = as(state["StanzaPred"]); - - // Calculate new derivative - dyt = deriv_vector(params, state, forcing, fishing, stanzas, y, m, 0); - - // Extract needed parts of the derivative - NumericVector dydt1 = as(dyt["DerivT"]); - NumericVector FoodGain = as(dyt["FoodGain"]); - NumericVector biomeq = as(dyt["biomeq"]); - NumericVector FishingLoss = as(dyt["FishingLoss"]); - NumericVector Qlink = as(dyt["Qlink"]); - - // Now Update the new State Biomass using Adams-Basforth - NumericVector new_Biomass = - ifelse( NoIntegrate == 0, - (1.0 - SORWT) * biomeq + SORWT * old_Biomass, - ifelse( NoIntegrate > 0, - old_Biomass + (DELTA_T / 2.0) * (3.0 * dydt1 - dydt0), - old_Biomass)); - - // Then Update Foraging Time - NumericVector pd = ifelse(NoIntegrate < 0, stanzaPred, old_Biomass); - NumericVector new_Ftime = ifelse((FoodGain > 0) & (pd > 0), - 0.1 + 0.9 * old_Ftime * ((1.0 - FtimeAdj) + FtimeAdj * FtimeQBOpt / - (FoodGain / pd)), - old_Ftime); - - // Monthly Stanza (split pool) update - if(Nsplit > 0){ - SplitUpdate(stanzas, state, forcing, dyt, y, m + 1); - SplitSetPred(stanzas, state); - } - new_Biomass = ifelse(NoIntegrate < 0, as(state["Biomass"]), new_Biomass); - - // Calculate catch assuming fixed Frate and exponential biomass change. - // kya 9/10/15 - replaced with linear, diff on monthly scale is minor - NumericVector new_Catch = (DELTA_T * FishingLoss / old_Biomass) * - (new_Biomass + old_Biomass) / 2.0; - - // Track catch by gear - NumericVector old_Biomass_flink = as(old_Biomass[FishFrom]); - NumericVector new_Biomass_flink = as(new_Biomass[FishFrom]); - NumericVector GearCatch = as(dyt["GearCatch"]); - NumericVector new_Gear_Catch = (DELTA_T * GearCatch / old_Biomass_flink) * - (new_Biomass_flink + old_Biomass_flink)/2.0; - - // NumericVector new_Catch = - // ifelse( new_Biomass==old_Biomass, - // FishingLoss*DELTA_T, - // (FishingLoss*DELTA_T/old_Biomass) * - // (new_Biomass-old_Biomass)/log(new_Biomass/old_Biomass) - // ); - - // KYA 9/13/17 - noticed that cur_Biomass is never copied back into state["Biomass"] after - // bounds testing. Error? Moved state["Biomass"] setting, hopefully nothing breaks... - // Set state to new values, including min/max traps - //state["Biomass"] = pmax(pmin(new_Biomass, B_BaseRef * BIGNUM), B_BaseRef * EPSILON); - //state["Ftime"] = pmin(new_Ftime, 2.0); - - // Make a copy of the current state for bounds testing - NumericVector cur_Biomass = pmax(pmin(new_Biomass, B_BaseRef * BIGNUM), B_BaseRef * EPSILON); // as(state["Biomass"]); - - NumericVector bforce = force_bybio((y-1) * STEPS_PER_YEAR + m, _); - cur_Biomass = ifelse(bforce>B_BaseRef * EPSILON, bforce, cur_Biomass); - - // insert forced biomass levels - //for (i=0; i=0){cur_Biomass[sp]=BforceVal(sp,m);} */ - //} - - // KYA 8/9/17 one of the NA or NaN flags is reading back as a negative integer (-2^32) - // Not sure why. This sets any negative biomass (assuming this means NaN) to NA_REAL - cur_Biomass = ifelse((cur_Biomass<0),NA_REAL,cur_Biomass); - - // If the run is during the "burn-in" years, and biomass goes - // into the discard range, set flag to exit the loop. Should set "bad" - // biomass values to NA - if (y < BURN_YEARS){ cur_Biomass = ifelse((cur_BiomassB_BaseRef*HI_DISCARD), - NA_REAL,cur_Biomass); - } - - // If biomass goes crazy or hits NA, exit loop with crash signal. Note it - // should still write the NA or INF values back to the output. - //NOJUV make sure crash tests work for juveniles. - - if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { - CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; - } - - // KYA 9/13/17 - Now copy cur_Biomass into state - state["Biomass"] = cur_Biomass; - state["Ftime"] = pmin(new_Ftime, 2.0); - - // Write to output matricies - out_Biomass( dd, _) = old_Biomass; - out_SSB(dd, _) = old_Biomass; - out_rec(dd, _) = old_Biomass; - out_Catch( dd, _) = new_Catch; - out_Gear_Catch(dd, _) = new_Gear_Catch; - annual_Catch(y-1, _) = annual_Catch(y-1, _) + new_Catch; - if (m==MEASURE_MONTH){ - annual_Biomass(y-1, _) = old_Biomass; - annual_QB(y-1, _) = FoodGain/old_Biomass; - annual_Qlink(y-1, _) = Qlink; - } - - //NOJUV for (i = 1; i <= juv_N; i++){ - //NOJUV out_SSB(dd, JuvNum[i]) = 0.0; - //NOJUV out_SSB(dd, AduNum[i]) = SpawnBio[i]; - //NOJUV out_rec(dd, AduNum[i]) = NageS(firstMoAdu[i], i) * WageS(firstMoAdu[i], i); - - } // End of main months loop - - }// End of years loop - -// Write Last timestep - //out_Biomass( dd+1, _) = as(state["Biomass"]); - //out_SSB(dd+1, _) = as(state["Biomass"]); - //out_rec(dd+1, _) = as(state["Biomass"]); - //out_Catch( dd+1, _) = out_Catch( dd, _); // the "next" time interval - //out_Gear_Catch(dd+1, _) = out_Gear_Catch(dd, _); -//NOJUV for (i = 1; i <= juv_N; i++){ -//NOJUV out_SSB(dd, JuvNum[i]) = 0.0; -//NOJUV out_SSB(dd, AduNum[i]) = SpawnBio[i]; -//NOJUV out_rec(dd, AduNum[i]) = NageS(firstMoAdu[i], i) * WageS(firstMoAdu[i], i); -//NOJUV } - -// Create Rcpp list to output - List outdat = List::create( - _["out_Biomass"]=out_Biomass, - _["out_Catch"]=out_Catch, - _["out_Gear_Catch"]=out_Gear_Catch, - _["annual_Catch"]=annual_Catch, - _["annual_Biomass"]=annual_Biomass, - _["annual_QB"]=annual_QB, - _["annual_Qlink"]=annual_Qlink, - _["end_state"]=state, - _["crash_year"]=CRASH_YEAR, - _["dyt"]=dyt); - -// Return is an Rcpp List - return(outdat); - -} - -//################################################################---------- -// Main derivative (dB/dt) calculations for ecosim model, using Rcpp vector -// package. -// [[Rcpp::export]] -List deriv_vector(List params, List state, List forcing, List fishing, List stanzas, - int inyear, int m, double tt){ - -int sp, links, prey, pred, gr, egr, dest, isp, ist, ieco; - - //Rcout << inyear <<" "<< m << std::endl; - if (inyear<1){stop("Derivative Year can't be less than 1");} - -// forcing time index (in months) - // KYA 11/1/17 - added offset to deal with 0 vs 1 indexing in forcing files - // (matters when trying to line up with "acutal" years) - const int y = inyear - 1; - const int dd = y*STEPS_PER_YEAR+m; - -// Base model size - number of groups and number of links (flows) by type - const int NUM_GROUPS = as(params["NUM_GROUPS"]); - const int NUM_LIVING = as(params["NUM_LIVING"]); - const int NUM_DEAD = as(params["NUM_DEAD"]); - const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); - const int NumFishingLinks = as(params["NumFishingLinks"]); - const int NumDetLinks = as(params["NumDetLinks"]); - const int COUPLED = as(params["COUPLED"]); - -// NUM_GROUPS length input vectors - const NumericVector B_BaseRef = as(params["B_BaseRef"]); - const NumericVector MzeroMort = as(params["MzeroMort"]); - const NumericVector UnassimRespFrac = as(params["UnassimRespFrac"]); - const NumericVector ActiveRespFrac = as(params["ActiveRespFrac"]); - const NumericVector HandleSelf = as(params["HandleSelf"]); - const NumericVector ScrambleSelf = as(params["ScrambleSelf"]); - //const NumericVector fish_Effort = as(params["fish_Effort"]); - -// NumPredPreyLinks Length vectors - const IntegerVector PreyFrom = as(params["PreyFrom"]); - const IntegerVector PreyTo = as(params["PreyTo"]); - const NumericVector QQ = as(params["QQ"]); - const NumericVector DD = as(params["DD"]); - const NumericVector VV = as(params["VV"]); - const NumericVector HandleSwitch = as(params["HandleSwitch"]); - const NumericVector PredPredWeight = as(params["PredPredWeight"]); - const NumericVector PreyPreyWeight = as(params["PreyPreyWeight"]); - -// NumFishingLinks lenghted vectors - const IntegerVector FishFrom = as(params["FishFrom"]); - const IntegerVector FishThrough = as(params["FishThrough"]); - const IntegerVector FishTo = as(params["FishTo"]); - const NumericVector FishQ = as(params["FishQ"]); - const IntegerVector DetFrom = as(params["DetFrom"]); - const IntegerVector DetTo = as(params["DetTo"]); - const NumericVector DetFrac = as(params["DetFrac"]); - -// Age-structured parameters - const int Nsplit = as(stanzas["Nsplit"]); - const NumericVector Nstanzas = as(stanzas["Nstanzas"]); - const NumericVector baseStanzaPred = as(stanzas["baseStanzaPred"]); - NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); - -// State vectors - const NumericVector state_Biomass = as(state["Biomass"]); - const NumericVector state_Ftime = as(state["Ftime"]); - const NumericVector stanzaPred = as(state["StanzaPred"]); - -//FISHING NumericVector TerminalF = as(params["TerminalF"]); -//FISHING NumericVector TARGET_BIO = as(params["TARGET_BIO"]); -//FISHING NumericVector TARGET_F = as(params["TARGET_F"]); -//FISHING NumericVector ALPHA = as(params["ALPHA"]); - -// "Environmental" forcing matrices (dd-indexed month x species) -// SHOULD BE CONST, but no row extraction for CONST (per Rcpp issues wiki) - NumericMatrix force_byprey = as(forcing["ForcedPrey"]); - NumericMatrix force_bymort = as(forcing["ForcedMort"]); - NumericMatrix force_bysearch = as(forcing["ForcedSearch"]); - NumericMatrix force_bymigrate = as(forcing["ForcedMigrate"]); - NumericMatrix force_byactresp = as(forcing["ForcedActresp"]); - -// Fishing forcing matrices (indexed year x species) -// SHOULD BE CONST, but no row extraction for CONST (per Rcpp issues wiki) - NumericMatrix FORCED_FRATE = as(fishing["ForcedFRate"]); - NumericMatrix FORCED_CATCH = as(fishing["ForcedCatch"]); - NumericMatrix EffortMat = as(fishing["ForcedEffort"]); - -// Components of derivative calculated here - NumericVector TotGain(NUM_GROUPS+1); - NumericVector TotLoss(NUM_GROUPS+1); - NumericVector LossPropToB(NUM_GROUPS+1); - NumericVector LossPropToQ(NUM_GROUPS+1); - NumericVector DerivT(NUM_GROUPS+1); - NumericVector biomeq(NUM_GROUPS+1); - NumericVector FoodLoss(NUM_GROUPS+1); - NumericVector FoodGain(NUM_GROUPS+1); - NumericVector UnAssimLoss(NUM_GROUPS+1); - NumericVector ActiveRespLoss(NUM_GROUPS+1); - NumericVector DetritalGain(NUM_GROUPS+1); - NumericVector FishingGain(NUM_GROUPS+1); - NumericVector MzeroLoss(NUM_GROUPS+1); - NumericVector FishingLoss(NUM_GROUPS+1); - NumericVector DetritalLoss(NUM_GROUPS+1); - NumericVector FishingThru(NUM_GROUPS+1); - NumericVector PredSuite(NUM_GROUPS+1); - NumericVector HandleSuite(NUM_GROUPS+1); - NumericVector GearCatch(NumFishingLinks+1); - NumericVector MigrateLoss(NUM_GROUPS+1); - -// Set effective biomass for pred/prey response -// default is B/Bref - NumericVector preyYY = state_Ftime * state_Biomass/B_BaseRef * force_byprey(dd,_); - NumericVector predYY = state_Ftime * state_Biomass/B_BaseRef * force_bysearch(dd,_); - -// Set functional response biomass for juvenile and adult groups (including foraging time) - if(Nsplit > 0){ - for (isp = 1; isp <=Nsplit; isp++){ - for(ist = 1; ist <= Nstanzas[isp]; ist++){ - ieco = EcopathCode(isp, ist); - if (baseStanzaPred[ieco] > 0){ - predYY[ieco] = state_Ftime[ieco] * stanzaPred[ieco] / - baseStanzaPred[ieco]; - } - } - } - } - -// Unroll Biomass Vectors (match pred, prey biomass for all links) - NumericVector PYY = preyYY[PreyFrom]; - NumericVector PDY = predYY[PreyTo]; - -// Summed predator and prey suites for joint handling time and/or scramble functional response - for (links=1; links<=NumPredPreyLinks; links++){ - PredSuite[PreyFrom[links]] += predYY[PreyTo[links] ] * PredPredWeight[links]; - HandleSuite[PreyTo[links]] += preyYY[PreyFrom[links]] * PreyPreyWeight[links]; - } - -// Unroll the suites into a NumPredPrey length vector - NumericVector PdSuite = PredSuite[PreyFrom]; - NumericVector PySuite = HandleSuite[PreyTo]; - NumericVector Hself = HandleSelf[PreyTo]; - NumericVector Sself = ScrambleSelf[PreyTo]; - -// // Main VECTOR CALC to calculate functional response for each predator/prey link -// // (3) Additive version: primary used and published in Aydin (2004) -// // KYA 3/2/2012 setting "COUPLED" to zero means species are density dependent -// // (based on their own modul) but don't interact otherwise. This can magically -// // create and destroy energy in the system but makes them act like a set -// // of independent surplus production models for comparison purposes -// NON-VECTOR VERSION: -// Q = QQ[links] * predYY[pred] * pow(preyYY[prey], COUPLED * HandleSwitch[links]) * -// ( DD[links] / ( DD[links] - 1.0 + -// pow(HandleSelf[pred] * preyYY[prey] + -// (1. - HandleSelf[pred]) * HandleSuite[pred], -// COUPLED * HandleSwitch[links])) )* -// ( VV[links] / ( VV[links] - 1.0 + -// ScrambleSelf[pred] * predYY[pred] + -// (1. - ScrambleSelf[pred]) * PredSuite[prey]) ); -// Rcpp VECTOR VERSION - NumericVector Q1 = - QQ * PDY * vpow(PYY, HandleSwitch * COUPLED) * - ( DD / ( DD-1.0 + vpow((1.-Hself)*PYY + Hself*PySuite, COUPLED*HandleSwitch)) ) * - ( VV / ( VV-1.0 + (1.-Sself)*PDY + Sself*PdSuite) ); - Q1[0] = 1.0; // get rid of NaN - moved from KYA's code 6/12/17 - -// No vector solution here as we need to sum by both links and species - for (links=1; links<=NumPredPreyLinks; links++){ - prey = PreyFrom[links]; - pred = PreyTo[links]; - // If model is uncoupled, food loss doesn't change with prey or predator levels. - if (COUPLED){ FoodLoss[prey] += Q1[links]; } - else{ FoodLoss[prey] += state_Biomass[prey] * QQ[links]/B_BaseRef[prey]; } - FoodGain[pred] += Q1[links]; - } - -// By Species Rates - UnAssimLoss = FoodGain * UnassimRespFrac; - ActiveRespLoss = FoodGain * ActiveRespFrac * force_byactresp(dd,_); - MzeroLoss = MzeroMort * state_Biomass; - - NumericVector NetProd = FoodGain - UnAssimLoss - ActiveRespLoss - MzeroLoss - FoodLoss; - -// FISHING FUNCTIONS (multiple options depending on fishing method) - -// // MOST OF THE FOLLOWING FISHING SPECIFICATION METHODS ARE NOT SUPPORTED -// // BY THE R-CODE, only fishing by effort (for gear) or by F-rate (for -// // species) is supported at the end. -// // -// // BY CURRENT R-CODE. ONLY -// // RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ -// // RFISH This sets EFFORT by time series of gear-target combinations -// // RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ -// // RFISH if -1 is an input value, uses TERMINAL F (last non-negative F) -// //RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ -// //RFISH if (y+m+d == 0){fish_Effort[gr]=1.0;} -// //RFISH else {fish_Effort[gr]=1.0;} // NOTE DEFAULT! THIS CAN BE CHANGED TO 1.0 -// //RFISH // Added 7/8/08 for forced effort -// //RFISH if (FORCED_EFFORT[gr][y] > -0.001) -// //RFISH {fish_Effort[gr]=FORCED_EFFORT[gr][y];} -// //RFISH -// //RFISH if ((FORCED_TARGET[gr]>0) && (FORCED_CATCH[gr][y]>-EPSILON)){ -// //RFISH totQ = 0.0; -// //RFISH sp = FORCED_TARGET[gr]; -// //RFISH for (links=1; links<=NumFishingLinks; links++){ -// //RFISH if ((FishingThrough[links] == gr) && -// //RFISH (FishingFrom[links]) == sp){ -// //RFISH totQ += FishingQ[links]; -// //RFISH } -// //RFISH } -// //RFISH fish_Effort[gr] = FORCED_CATCH[gr][y]/ -// //RFISH (totQ * state_Biomass[sp]); -// //RFISH if (FORCED_CATCH[gr][y] >= state_Biomass[sp]) -// //RFISH {fish_Effort[gr] = (1.0-EPSILON)*(state_Biomass[sp])/ -// //RFISH (totQ * state_Biomass[sp]);} -// //RFISH } -// //RFISH // By putting F after catch, Frates override absolute catch -// //RFISH if ((FORCED_FTARGET[gr]>0) && (FORCED_FRATE[gr][y]>-EPSILON)){ -// //RFISH totQ = 0.0; -// //RFISH sp = FORCED_FTARGET[gr]; -// //RFISH for (links=1; links<=NumFishingLinks; links++){ -// //RFISH if ((FishingThrough[links] == gr) && -// //RFISH (FishingFrom[links]) == sp){ -// //RFISH totQ += FishingQ[links]; -// //RFISH } -// //RFISH } -// //RFISH fish_Effort[gr] = FORCED_FRATE[gr][y]/totQ; -// //RFISH //if (FORCED_CATCH[gr][y] >= state_Biomass[sp]) -// //RFISH // {fish_Effort[gr] = (1.0-EPSILON)*(state_Biomass[sp])/ -// //RFISH // (totQ * state_Biomass[sp]);} -// //RFISH } -// //RFISH -// //RFISH //if ((y==0) && (m==0) && (d==0)){ -// //RFISH // cout << path_species[gr] << " " << FORCED_TARGET[gr] << " " << path_species[sp] << " " -// //RFISH // << state_Biomass[sp] << " " << FORCED_CATCH[gr][y] << " " -// //RFISH // << fish_Effort[gr] << endl; -// //RFISH //} -// //RFISH } -// - double caught; - // Apply specified Effort by Gear to catch (using Ecopath-set Q) - NumericVector Effort = (NumericVector)EffortMat(dd,_); - for (links=1; links<=NumFishingLinks; links++){ - prey = FishFrom[links]; - gr = FishThrough[links]; - dest = FishTo[links]; - egr = FishThrough[links] - (NUM_LIVING + NUM_DEAD); - caught = FishQ[links] * Effort[egr] * state_Biomass[prey]; - FishingLoss[prey] += caught; - FishingThru[gr] += caught; - FishingGain[dest] += caught; - GearCatch[links] = caught; - } - NumericVector FORCE_F = (NumericVector)FORCED_FRATE(y,_); - // Special "CLEAN" fisheries assuming q=1, so specified input is Frate - for (sp=1; sp<=NUM_LIVING+NUM_DEAD; sp++){ - caught = FORCED_CATCH(y, sp) + FORCE_F[sp] * state_Biomass[sp]; - // KYA Aug 2011 removed terminal effort option to allow negative fishing pressure - // if (caught <= -EPSILON) {caught = TerminalF[sp] * state_Biomass[sp];} - // KYA 10/6/17 Added productivity to Biomass limit for F>1 species (salmon inspired) - if (caught >= state_Biomass[sp] + NetProd[sp]){caught = (1.0 - EPSILON) * (state_Biomass[sp] + NetProd[sp]);} - if (caught<0){caught=0;} - FishingLoss[sp] += caught; - FishingThru[0] += caught; - FishingGain[0] += caught; - //if(sp==1){Rprintf("%d %g %g %g \n",sp,FORCED_FRATE(y,sp),caught,FishingLoss[sp]);} - //TerminalF[sp] = caught/state_Biomass[sp]; - } - -// KINKED CONTROL RULE - NEEDS INPUT of TARGET BIOMASS and TARGET CATCH - //FISHING double RefBio, maxcaught; - //FISHING for (sp=1; sp<=NUM_LIVING+NUM_DEAD; sp++){ - //FISHING if (TARGET_BIO[sp] > EPSILON){ - //FISHING RefBio = state_Biomass[sp] / TARGET_BIO[sp]; - //FISHING maxcaught = TARGET_F[sp] * state_Biomass[sp]; - //FISHING if (RefBio > 1.0) {caught = maxcaught;} - //FISHING else if (RefBio >= ALPHA[sp]) {caught = maxcaught * (RefBio - ALPHA[sp])/(1.0 - ALPHA[sp]);} - //FISHING else {caught = 0.0;} - //FISHING FishingLoss[sp] += caught; - //FISHING FishingThru[0] += caught; - //FISHING FishingGain[0] += caught; - //FISHING TerminalF[sp] = caught/state_Biomass[sp]; - //FISHING } - //FISHING } - -// DETRITUS - note: check interdetrital flow carefully, have had some issues -// (check by ensuring equlibrium run stays in equilibrium) - int liv, det; - double flow; - for (links=1; links<=NumDetLinks; links++){ - liv = DetFrom[links]; - det = DetTo[links]; - flow = DetFrac[links] * (MzeroLoss[liv] + UnAssimLoss[liv]); - DetritalGain[det] += flow; - if (liv > NUM_LIVING) {DetritalLoss[liv] += flow; } - } - for (sp=NUM_LIVING+1; sp<=NUM_LIVING+NUM_DEAD; sp++){ - MzeroLoss[sp] = 0.0; - } - -// Add mortality forcing - for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ - FoodLoss[i] *= force_bymort(dd, i); - MzeroLoss[i] *= force_bymort(dd, i); - } - -// Add migration forcing - MigrateLoss = clone(state_Biomass); - for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ - MigrateLoss[i] *= force_bymigrate(dd, i); - } - -// Sum up derivitive parts (vector sums) -// Override for group 0 (considered "the sun", never changing) - TotGain = FoodGain + DetritalGain + FishingGain; - LossPropToQ = UnAssimLoss + ActiveRespLoss; - LossPropToB = FoodLoss + MzeroLoss + FishingLoss + MigrateLoss + DetritalLoss; - TotGain[0] = 0; - LossPropToB[0] = 0; - LossPropToQ[0] = 0; - TotLoss = LossPropToQ + LossPropToB; - biomeq = TotGain/(TotLoss/state_Biomass); - biomeq[0] = 1.0; - DerivT = TotGain - TotLoss; - -// Rcpp List structure to return -// KYA 6/20/17 Rcpp bug (known) is max 18 items on List::create -// had to add Q1 (qlink), so removed LossPropToQ (used nowhere?) -// SML 8/8/17 - actually don't need most of these...commenting -// out to track catch by gear - List deriv = List::create( - //_["preyYY"]=preyYY, - //_["predYY"]=predYY, - _["TotGain"]=TotGain, - _["TotLoss"]=TotLoss, - _["DerivT"]=DerivT, - _["biomeq"]=biomeq, - _["LossPropToB"]=LossPropToB, - //_["LossPropToQ"]=LossPropToQ, - _["FoodLoss"]=FoodLoss, - _["FoodGain"]=FoodGain, - _["UnAssimLoss"]=UnAssimLoss, - _["ActiveRespLoss"]=ActiveRespLoss, - _["DetritalGain"]=DetritalGain, - _["FishingGain"]=FishingGain, - _["MzeroLoss"]=MzeroLoss, - _["FishingLoss"]=FishingLoss, - _["DetritalLoss"]=DetritalLoss, - _["FishingThru"]=FishingThru, - //_["PredSuite"]=PredSuite, - //_["HandleSuite"]=HandleSuite, - _["Qlink"]=Q1, - _["GearCatch"]=GearCatch - ); - -// Return is an Rcpp List - return(deriv); -} - -// SplitSetPred function called in sim stanza initialize and update -// This function simply sums up across stanzas to get population-level -// Biomass, Numbers, and Consumption -// [[Rcpp::export]] -int SplitSetPred(List stanzas, List state){ - int isp, ist, ia, ieco; - double Bt, pt, Nt; - - //stanza parameters - const int Nsplit = as(stanzas["Nsplit"]); - const NumericVector Nstanzas = as(stanzas["Nstanzas"]); - NumericMatrix Age1 = as(stanzas["Age1"]); - NumericMatrix Age2 = as(stanzas["Age2"]); - NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); - //Parts of Stanza State - NumericMatrix NageS = as(state["NageS"]); - NumericMatrix WageS = as(state["WageS"]); - NumericMatrix QageS = as(state["QageS"]); - NumericVector stanzaPred = as(state["StanzaPred"]); - //state parameters - NumericVector state_Biomass = as(state["Biomass"]); - NumericVector state_N = as(state["N"]); - - for (isp = 1; isp <= Nsplit; isp++){ - for (ist = 1; ist <= Nstanzas[isp]; ist++){ - ieco = EcopathCode(isp, ist); - Bt = 1e-30; - pt = 1e-30; - Nt = 1e-30; - for (ia = Age1(isp, ist); ia <= Age2(isp, ist); ia++){ - Bt = Bt + NageS(ia, isp) * WageS(ia, isp); - pt = pt + NageS(ia, isp) * QageS(ia, isp); - Nt = Nt + NageS(ia, isp); - } - state_Biomass[ieco] = Bt; - state_N[ieco] = Nt; - stanzaPred[ieco] = pt; - } - } - return(0); -} - -// SplitUpdate function -// Update numbers, weight, and biomass for multistanza groups -// [[Rcpp::export]] -int SplitUpdate(List stanzas, List state, List forcing, List deriv, int yr, int mon){ - int isp, ist, ia, ieco=0, last, first; //KYA 6/12/17 ieco=0 to stop annoying warning - double Su, Gf, Nt; - - //stanza parameters - const int Nsplit = as(stanzas["Nsplit"]); - const NumericVector Nstanzas = as(stanzas["Nstanzas"]); - const NumericVector vBM = as(stanzas["vBM"]); - const NumericVector Wmat = as(stanzas["Wmat"]); - //const NumericVector Wmat001 = as(stanzas["Wmat001"]); - //const NumericVector Wmat50 = as(stanzas["Wmat50"]); - //const NumericVector WmatSpread = as(stanzas["WmatSpread"]); - //const NumericVector Amat001 = as(stanzas["Amat001"]); - //const NumericVector Amat50 = as(stanzas["Amat50"]); - //const NumericVector AmatSpread = as(stanzas["AmatSpread"]); - const NumericVector baseEggsStanza = as(stanzas["baseEggsStanza"]); - const NumericVector RscaleSplit = as(stanzas["RscaleSplit"]); - const NumericVector RzeroS = as(stanzas["RzeroS"]); - const NumericVector RecPower = as(stanzas["RecPower"]); - const NumericVector vBGFd = as(stanzas["vBGFd"]); - const NumericVector SpawnEnergy = as(stanzas["SpawnEnergy"]); - const NumericVector SpawnX = as(stanzas["SpawnX"]); - const NumericVector baseSpawnBio = as(stanzas["baseSpawnBio"]); - // The following matrices should also be const - NumericMatrix SplitAlpha = as(stanzas["SplitAlpha"]); - NumericMatrix Age1 = as(stanzas["Age1"]); - NumericMatrix Age2 = as(stanzas["Age2"]); - NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); - // Parts of Stanza State - NumericVector SpawnBio = as(state["SpawnBio"]); - NumericVector EggsStanza = as(state["EggsStanza"]); - NumericMatrix NageS = as(state["NageS"]); - NumericMatrix WageS = as(state["WageS"]); - NumericMatrix QageS = as(state["QageS"]); - NumericVector stanzaPred = as(state["StanzaPred"]); - - //state parameters - const NumericVector state_Biomass = as(state["Biomass"]); - - //forcing parameters - NumericMatrix force_byrecs = as(forcing["ForcedRecs"]); - - //derivatives - const NumericVector LossPropToB = as(deriv["LossPropToB"]); - const NumericVector FoodGain = as(deriv["FoodGain"]); - - for (isp = 1; isp <= Nsplit; isp++){ - // Update numbers and body weights - SpawnBio[isp] = 0; - for(ist = 1; ist <= Nstanzas[isp]; ist++){ - ieco = EcopathCode(isp, ist); - Su = exp(-LossPropToB[ieco] / STEPS_PER_YEAR / state_Biomass[ieco]); - Gf = FoodGain[ieco] / stanzaPred[ieco]; - for(ia = Age1(isp, ist); ia <= Age2(isp, ist); ia++){ - NageS(ia, isp) = NageS(ia, isp) * Su; - WageS(ia, isp) = vBM[isp] * WageS(ia, isp) + Gf * SplitAlpha(ia, isp); - // KYA 5/7/18 - started to add alternate maturity method, commented out for now - //if(Wmat[isp]<0.0){ - // if ((WageS(ia, isp)>Wmat001[isp])&&(ia>Amat001[isp])){ - // SpawnBio[isp] += NageS(ia, isp) * WageS(ia, isp)/(1. + exp( - // -((WageS(ia, isp) - Wmat50[isp]) / WmatSpread[isp]) - // -((ia - Amat50[isp]) / AmatSpread[isp]) )); - // } - //} - //else{ - if(WageS(ia, isp) > Wmat[isp]){ - SpawnBio[isp] += NageS(ia, isp) * (WageS(ia, isp) - Wmat[isp]); - }; - //} - } - } - EggsStanza[isp] = SpawnBio[isp] * SpawnEnergy[isp] * SpawnX[isp] / - (SpawnX[isp] - 1.0 + (SpawnBio[isp] / baseSpawnBio[isp])); - EggsStanza[isp] *= force_byrecs(yr * STEPS_PER_YEAR + mon, ieco); - - //Rprintf("%g %g %g %g %g",isp,SpawnBio[isp],EggsStanza[isp],) - // Need to add monthly recruitment - - // now update n and wt looping backward over age - last = Age2(isp, Nstanzas[isp]); - first = Age1(isp, 1); - - Nt = NageS(last, isp) + NageS(last - 1, isp); - if(Nt == 0){Nt = 1e-30;} - - WageS(last, isp) = (WageS(last, isp) * NageS(last, isp) + WageS(last - 1, isp) * - NageS(last - 1, isp)) / Nt; - NageS(last, isp) = Nt; - - for(ia = last - 1; ia > first; ia--){ - NageS(ia, isp) = NageS(ia - 1, isp); - WageS(ia, isp) = WageS(ia - 1, isp); - } - - //Apply number of eggs to youngest slot. Includes Walter recruit power - if(baseEggsStanza[isp] > 0){ - NageS(first, isp) = RscaleSplit[isp] * RzeroS[isp] * pow(double(EggsStanza[isp] / - baseEggsStanza[isp]), double(RecPower[isp])); - } - WageS(first, isp) = 0; - - //Uses generalized vonB (exponent is d) - //Added for stability 4/13/07 (Unlucky Friday) - for(ia = 0; ia <= last; ia++){ - QageS(ia, isp) = pow(double(WageS(ia, isp)), double(vBGFd[isp])); - } - } - -return(0); + +#include "ecosim.h" + +//################################################################---------- +// Runge-Kutta 4th order method for integrating Ecosim equations +// Currently does not contain aged-structured species. +// [[Rcpp::export]] +List rk4_run (List params, List instate, List forcing, List fishing, List stanzas, + int StartYear, int EndYear){ + + int y, m, dd, t; +// Input rates are in units of years or years^-1. Integration is wri tten so +// that integration timesteps always line up with months, for data reasons. +// STEPS_PER_YEAR should be 12 (for months), and STEPS_PER_MONTH sets the +// rk4 integration timestep. So effective integration timestep with respect +// to input rates (years) is 1/(12*STEPS_PER_MONTH). + const int STEPS_PER_MONTH = as(params["RK4_STEPS"]); + const double hh = DELTA_T/(double)STEPS_PER_MONTH; + +// Get some basic needed numbers from the params List + const int NUM_BIO = as(params["NUM_LIVING"]) + as(params["NUM_DEAD"]); + const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); + const int NumFishingLinks = as(params["NumFishingLinks"]); + +// Switches for run modes + const int BURN_YEARS = as(params["BURN_YEARS"]); + const NumericVector SENSE_LIMIT = as(params["SENSE_LIMIT"]); + const double LO_DISCARD = (SENSE_LIMIT[0]); + const double HI_DISCARD = (SENSE_LIMIT[1]); + int CRASH_YEAR = -1; + int MEASURE_MONTH = 5; + +// Flag for group-sepcific Integration method (NoIntegrate=0 means Fast Eq) + const NumericVector NoIntegrate = as(params["NoIntegrate"]); + +// Parameters needed directly for foraging time adjustment + const NumericVector B_BaseRef = as(params["B_BaseRef"]); + const NumericVector FtimeAdj = as(params["FtimeAdj"]); + const NumericVector FtimeQBOpt = as(params["FtimeQBOpt"]); +// FtimeAdj is monthly unit so adjust for sub-monthly integration + const NumericVector FtimeStep = FtimeAdj/STEPS_PER_MONTH; + +// Number of split groups + const int Nsplit = as(stanzas["Nsplit"]); + +// Parameter need to track catch by Gear + const NumericVector FishFrom = as(params["FishFrom"]); + +// Monthly output matrices + NumericMatrix out_Biomass(EndYear*12, NUM_BIO+1); + NumericMatrix out_Catch(EndYear*12, NUM_BIO+1); + NumericMatrix out_SSB(EndYear*12, NUM_BIO+1); + NumericMatrix out_rec(EndYear*12, NUM_BIO+1); + NumericMatrix out_Gear_Catch(EndYear*12, NumFishingLinks+1); +// Annual output matrices + NumericMatrix annual_Catch(EndYear, NUM_BIO+1); + NumericMatrix annual_Biomass(EndYear, NUM_BIO+1); + NumericMatrix annual_QB(EndYear, NUM_BIO+1); + NumericMatrix annual_Qlink(EndYear, NumPredPreyLinks+1); +// Accumulator for monthly catch values + NumericVector cum_Catch(NUM_BIO+1); + NumericVector cum_Gear_Catch(NumFishingLinks +1); + +//SML +// Update sums of split groups to total biomass for derivative calcs + if(Nsplit > 0){ + SplitSetPred(stanzas, instate); + } +//SML + +// Load state, set some initial values. Make sure state is COPY, not pointer + List state = clone(instate); + dd = StartYear * STEPS_PER_YEAR; // dd is monthly index for data storage + +// KYA 6/12/17 an initial derivative call just to declare deriv in right scope + List dyt = deriv_vector(params,state,forcing,fishing,stanzas,1,0,0); + NumericVector FoodGain = as(dyt["FoodGain"]); + NumericVector Qlink = as(dyt["Qlink"]); + + // MAIN LOOP STARTS HERE with years loop + for (y = StartYear; y <= EndYear; y++){ + if (y<1){stop("RK Year can't be less than 1");} + // Monthly loop + for (m = 0; m < STEPS_PER_YEAR; m++){ + cum_Catch = NumericVector(NUM_BIO+1); // monthly catch to accumulate + cum_Gear_Catch = NumericVector(NumFishingLinks+1); + dd = (y-1) * STEPS_PER_YEAR + m; + // Sub-monthly integration loop + for (t=0; t< STEPS_PER_MONTH; t++){ + double tt = (double)t*hh; // sub monthly timestep in years + // Load state vars (note: this creates pointers, not new vals) + NumericVector old_Biomass = as(state["Biomass"]); + NumericVector old_Ftime = as(state["Ftime"]); + + // Calculate base derivative and RK-4 derivative steps (overwrites YY) + List YY = state; + List k1 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt); + NumericVector kk1 = as(k1["DerivT"]); + + YY["Biomass"] = old_Biomass + 0.5*kk1*hh; + List k2 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + 0.5*hh); + NumericVector kk2 = as(k2["DerivT"]); + + YY["Biomass"] = old_Biomass + 0.5*kk2*hh; + List k3 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + 0.5*hh); + NumericVector kk3 = as(k3["DerivT"]); + + YY["Biomass"] = old_Biomass + kk3*hh; + List k4 = deriv_vector(params,YY,forcing,fishing,stanzas,y,m,tt + hh); + NumericVector kk4 = as(k4["DerivT"]); + + // Take an rk4 step + NumericVector new_Biomass = old_Biomass + hh*(kk1 + 2*kk2 + 2*kk3 + kk4)/6.0; + + // Update Foraging time state variable + // pd term is used to indicate differrent values used for + // age-structured species, defaults to Biomass for non-aged structure + NumericVector pd = old_Biomass; + FoodGain = as(k1["FoodGain"]); + Qlink = as(k1["Qlink"]); + NumericVector new_Ftime = ifelse((FoodGain>0)&(pd>0), + 0.1 + 0.9*old_Ftime* + ((1.0-FtimeStep) + FtimeStep*FtimeQBOpt/(FoodGain/pd)), + old_Ftime); + + // Accumulate Catch (small timestep, so linear average) + NumericVector FishingLoss = as(k1["FishingLoss"]); + cum_Catch += (hh * FishingLoss/old_Biomass) * (new_Biomass+old_Biomass)/2.0; + + // Track catch by gear + NumericVector old_Biomass_flink = as(old_Biomass[FishFrom]); + NumericVector new_Biomass_flink = as(new_Biomass[FishFrom]); + NumericVector GearCatch = as(k1["GearCatch"]); + cum_Gear_Catch += (hh * GearCatch / old_Biomass_flink) * (new_Biomass_flink + old_Biomass_flink)/2.0; + + // Set state to new values, including min/max traps + state["Biomass"] = pmax(pmin(new_Biomass, B_BaseRef*BIGNUM), B_BaseRef*EPSILON); + state["Ftime"] = pmin(new_Ftime, 2.0); + }// end of sub-monthly (t-indexed) loop + + // Insert Monthly Stanza (split pool) update here + //SML + // Calculate new derivative + List dyt = deriv_vector(params, state, forcing, fishing, stanzas, y, m, 0); + if(Nsplit > 0){ + SplitUpdate(stanzas, state, forcing, dyt, y, m + 1); + SplitSetPred(stanzas, state); + } + + // Make a copy of the current state for bounds testing + NumericVector cur_Biomass = as(state["Biomass"]); + + // KYA 8/9/17 one of the NA or NaN flags is reading back as a negative integer (-2^32) + // Not sure why. This sets any negative biomass (assuming this means NaN) to NA_REAL + cur_Biomass = ifelse((cur_Biomass<0),NA_REAL,cur_Biomass); + + // If the run is during the "burn-in" years, and biomass goes + // into the discard range, set flag to exit the loop. Should set "bad" + // biomass values to NA + if (y < BURN_YEARS){ cur_Biomass = ifelse((cur_BiomassB_BaseRef*HI_DISCARD), + NA_REAL,cur_Biomass); + } + + // If biomass goes crazy or hits NA, exit loop with crash signal. Note it + // should still write the NA or INF values back to the output. + if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { + CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; + } + + + // Write to monthly output matricies (vector write) + out_Biomass( dd, _) = cur_Biomass; + out_SSB(dd, _) = cur_Biomass; + out_rec(dd, _) = cur_Biomass; + out_Catch( dd, _) = cum_Catch; + out_Gear_Catch(dd, _) = cum_Gear_Catch; + annual_Catch(y-1, _) = annual_Catch(y-1, _) + cum_Catch; + if (m==MEASURE_MONTH){ + annual_Biomass(y-1, _) = cur_Biomass; + annual_QB(y-1, _) = FoodGain/cur_Biomass; + annual_Qlink(y-1, _) = Qlink; + } + } // End of main months loop + + }// End of years loop + +// Write Last timestep (note: SSB and rec only used for age-structure species) + //out_Biomass( dd+1, _) = as(state["Biomass"]); + //out_SSB(dd+1, _) = as(state["Biomass"]); + //out_rec(dd+1, _) = as(state["Biomass"]); + //out_Catch( dd+1, _) = out_Catch( dd, _); + +// Create Rcpp list to output +List outdat = List::create( + _["out_Biomass"]=out_Biomass, + _["out_Catch"]=out_Catch, + _["out_Gear_Catch"]=out_Gear_Catch, + _["annual_Catch"]=annual_Catch, + _["annual_Biomass"]=annual_Biomass, + _["annual_QB"]=annual_QB, + _["annual_Qlink"]=annual_Qlink, + _["end_state"]=state, + _["crash_year"]=CRASH_YEAR); + +// Return is an Rcpp List + return(outdat); +} + +//-----#################################################################---- +// Adams_Basforth two-step method for integrating ecosim equations. +// Fixed monthly timestep with "fast integration" Walters et al. '97 method +// for faster-turnover species. +// Currently does not contain aged-structured species. +// [[Rcpp::export]] +List Adams_run (List params, List instate, List forcing, List fishing, List stanzas, + int StartYear, int EndYear, List InitDeriv){ + +int y, m, dd; + +// Get some basic needed numbers from the params List + const int NUM_BIO = as(params["NUM_LIVING"]) + as(params["NUM_DEAD"]); + const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); + const int NumFishingLinks = as(params["NumFishingLinks"]); + +// Forcing Biomass + //const int NumForcedBio = as(fitting["NumForcedBio"]); + //const IntegerVector BforceNum = as(fitting["BforceNum"]); + // KYA TODO 11/1/2017 put force_bybio in RK! + NumericMatrix force_bybio = as(forcing["ForcedBio"]); + +// Switches for run modes + const int BURN_YEARS = as(params["BURN_YEARS"]); + const NumericVector SENSE_LIMIT = as(params["SENSE_LIMIT"]); + const double LO_DISCARD = (SENSE_LIMIT[0]); + const double HI_DISCARD = (SENSE_LIMIT[1]); + int CRASH_YEAR = -1; + int MEASURE_MONTH = 5; + +// Flag for group-sepcific Integration method (NoIntegrate=0 means Fast Eq) + const NumericVector NoIntegrate = as(params["NoIntegrate"]); + +// Parameters needed directly for foraging time adjustment + const NumericVector B_BaseRef = as(params["B_BaseRef"]); + const NumericVector FtimeAdj = as(params["FtimeAdj"]); + const NumericVector FtimeQBOpt = as(params["FtimeQBOpt"]); + +// Parameters from stanzas + const int Nsplit = as(stanzas["Nsplit"]); + +// Parameter need to track catch by Gear + const NumericVector FishFrom = as(params["FishFrom"]); + +// Monthly output matrices + NumericMatrix out_Biomass( EndYear * 12, NUM_BIO + 1); + NumericMatrix out_Catch( EndYear * 12, NUM_BIO + 1); + NumericMatrix out_SSB(EndYear * 12, NUM_BIO + 1); + NumericMatrix out_rec(EndYear * 12, NUM_BIO + 1); + NumericMatrix out_Gear_Catch(EndYear*12, NumFishingLinks+1); +// Annual output matrices + NumericMatrix annual_Catch(EndYear, NUM_BIO+1); + NumericMatrix annual_Biomass(EndYear, NUM_BIO+1); + NumericMatrix annual_QB(EndYear, NUM_BIO+1); + NumericMatrix annual_Qlink(EndYear, NumPredPreyLinks+1); + +// Load state and call initial derivative (todo: allow other start times) +// Use Clone to make sure state/stanzas are copies of instate/instanzas, not pointers + List state = clone(instate); + //List stanzas = clone(instanzas); + + // Update sums of split groups to total biomass for derivative calcs + if(Nsplit > 0){ + SplitSetPred(stanzas, state); + } + + // Use the initial derivative calculated outside of function + List dyt = InitDeriv; + + dd = StartYear * STEPS_PER_YEAR; + +// MAIN LOOP STARTS HERE +// ASSUMES STEPS_PER_MONTH will always be 1.0, took out divisions + for (y = StartYear; y <= EndYear; y++){ + if (y<1){stop("Adams Year can't be less than 1");} + // Monthly loop + for (m = 0; m < STEPS_PER_YEAR; m++){ + dd = (y-1) * STEPS_PER_YEAR + m; // dd is index for monthly output + // Load old state and old derivative + NumericVector old_Biomass = as(state["Biomass"]); + NumericVector old_Ftime = as(state["Ftime"]); + NumericVector dydt0 = as(dyt["DerivT"]); + NumericVector stanzaPred = as(state["StanzaPred"]); + + // Calculate new derivative + dyt = deriv_vector(params, state, forcing, fishing, stanzas, y, m, 0); + + // Extract needed parts of the derivative + NumericVector dydt1 = as(dyt["DerivT"]); + NumericVector FoodGain = as(dyt["FoodGain"]); + NumericVector biomeq = as(dyt["biomeq"]); + NumericVector FishingLoss = as(dyt["FishingLoss"]); + NumericVector Qlink = as(dyt["Qlink"]); + + // Now Update the new State Biomass using Adams-Basforth + NumericVector new_Biomass = + ifelse( NoIntegrate == 0, + (1.0 - SORWT) * biomeq + SORWT * old_Biomass, + ifelse( NoIntegrate > 0, + old_Biomass + (DELTA_T / 2.0) * (3.0 * dydt1 - dydt0), + old_Biomass)); + + // Then Update Foraging Time + NumericVector pd = ifelse(NoIntegrate < 0, stanzaPred, old_Biomass); + NumericVector new_Ftime = ifelse((FoodGain > 0) & (pd > 0), + 0.1 + 0.9 * old_Ftime * ((1.0 - FtimeAdj) + FtimeAdj * FtimeQBOpt / + (FoodGain / pd)), + old_Ftime); + + // Monthly Stanza (split pool) update + if(Nsplit > 0){ + SplitUpdate(stanzas, state, forcing, dyt, y, m + 1); + SplitSetPred(stanzas, state); + } + new_Biomass = ifelse(NoIntegrate < 0, as(state["Biomass"]), new_Biomass); + + // Calculate catch assuming fixed Frate and exponential biomass change. + // kya 9/10/15 - replaced with linear, diff on monthly scale is minor + NumericVector new_Catch = (DELTA_T * FishingLoss / old_Biomass) * + (new_Biomass + old_Biomass) / 2.0; + + // Track catch by gear + NumericVector old_Biomass_flink = as(old_Biomass[FishFrom]); + NumericVector new_Biomass_flink = as(new_Biomass[FishFrom]); + NumericVector GearCatch = as(dyt["GearCatch"]); + NumericVector new_Gear_Catch = (DELTA_T * GearCatch / old_Biomass_flink) * + (new_Biomass_flink + old_Biomass_flink)/2.0; + + // NumericVector new_Catch = + // ifelse( new_Biomass==old_Biomass, + // FishingLoss*DELTA_T, + // (FishingLoss*DELTA_T/old_Biomass) * + // (new_Biomass-old_Biomass)/log(new_Biomass/old_Biomass) + // ); + + // KYA 9/13/17 - noticed that cur_Biomass is never copied back into state["Biomass"] after + // bounds testing. Error? Moved state["Biomass"] setting, hopefully nothing breaks... + // Set state to new values, including min/max traps + //state["Biomass"] = pmax(pmin(new_Biomass, B_BaseRef * BIGNUM), B_BaseRef * EPSILON); + //state["Ftime"] = pmin(new_Ftime, 2.0); + + // Make a copy of the current state for bounds testing + NumericVector cur_Biomass = pmax(pmin(new_Biomass, B_BaseRef * BIGNUM), B_BaseRef * EPSILON); // as(state["Biomass"]); + + NumericVector bforce = force_bybio((y-1) * STEPS_PER_YEAR + m, _); + cur_Biomass = ifelse(bforce>B_BaseRef * EPSILON, bforce, cur_Biomass); + + // insert forced biomass levels + //for (i=0; i=0){cur_Biomass[sp]=BforceVal(sp,m);} */ + //} + + // KYA 8/9/17 one of the NA or NaN flags is reading back as a negative integer (-2^32) + // Not sure why. This sets any negative biomass (assuming this means NaN) to NA_REAL + cur_Biomass = ifelse((cur_Biomass<0),NA_REAL,cur_Biomass); + + // If the run is during the "burn-in" years, and biomass goes + // into the discard range, set flag to exit the loop. Should set "bad" + // biomass values to NA + if (y < BURN_YEARS){ cur_Biomass = ifelse((cur_BiomassB_BaseRef*HI_DISCARD), + NA_REAL,cur_Biomass); + } + + // If biomass goes crazy or hits NA, exit loop with crash signal. Note it + // should still write the NA or INF values back to the output. + //NOJUV make sure crash tests work for juveniles. + + if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) { + CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR; + } + + // KYA 9/13/17 - Now copy cur_Biomass into state + state["Biomass"] = cur_Biomass; + state["Ftime"] = pmin(new_Ftime, 2.0); + + // Write to output matricies + out_Biomass( dd, _) = old_Biomass; + out_SSB(dd, _) = old_Biomass; + out_rec(dd, _) = old_Biomass; + out_Catch( dd, _) = new_Catch; + out_Gear_Catch(dd, _) = new_Gear_Catch; + annual_Catch(y-1, _) = annual_Catch(y-1, _) + new_Catch; + if (m==MEASURE_MONTH){ + annual_Biomass(y-1, _) = old_Biomass; + annual_QB(y-1, _) = FoodGain/old_Biomass; + annual_Qlink(y-1, _) = Qlink; + } + + //NOJUV for (i = 1; i <= juv_N; i++){ + //NOJUV out_SSB(dd, JuvNum[i]) = 0.0; + //NOJUV out_SSB(dd, AduNum[i]) = SpawnBio[i]; + //NOJUV out_rec(dd, AduNum[i]) = NageS(firstMoAdu[i], i) * WageS(firstMoAdu[i], i); + + } // End of main months loop + + }// End of years loop + +// Write Last timestep + //out_Biomass( dd+1, _) = as(state["Biomass"]); + //out_SSB(dd+1, _) = as(state["Biomass"]); + //out_rec(dd+1, _) = as(state["Biomass"]); + //out_Catch( dd+1, _) = out_Catch( dd, _); // the "next" time interval + //out_Gear_Catch(dd+1, _) = out_Gear_Catch(dd, _); +//NOJUV for (i = 1; i <= juv_N; i++){ +//NOJUV out_SSB(dd, JuvNum[i]) = 0.0; +//NOJUV out_SSB(dd, AduNum[i]) = SpawnBio[i]; +//NOJUV out_rec(dd, AduNum[i]) = NageS(firstMoAdu[i], i) * WageS(firstMoAdu[i], i); +//NOJUV } + +// Create Rcpp list to output + List outdat = List::create( + _["out_Biomass"]=out_Biomass, + _["out_Catch"]=out_Catch, + _["out_Gear_Catch"]=out_Gear_Catch, + _["annual_Catch"]=annual_Catch, + _["annual_Biomass"]=annual_Biomass, + _["annual_QB"]=annual_QB, + _["annual_Qlink"]=annual_Qlink, + _["end_state"]=state, + _["crash_year"]=CRASH_YEAR, + _["dyt"]=dyt); + +// Return is an Rcpp List + return(outdat); + +} + +//################################################################---------- +// Main derivative (dB/dt) calculations for ecosim model, using Rcpp vector +// package. +// [[Rcpp::export]] +List deriv_vector(List params, List state, List forcing, List fishing, List stanzas, + int inyear, int m, double tt){ + +int sp, links, prey, pred, gr, egr, dest, isp, ist, ieco; + + //Rcout << inyear <<" "<< m << std::endl; + if (inyear<1){stop("Derivative Year can't be less than 1");} + +// forcing time index (in months) + // KYA 11/1/17 - added offset to deal with 0 vs 1 indexing in forcing files + // (matters when trying to line up with "acutal" years) + const int y = inyear - 1; + const int dd = y*STEPS_PER_YEAR+m; + +// Base model size - number of groups and number of links (flows) by type + const int NUM_GROUPS = as(params["NUM_GROUPS"]); + const int NUM_LIVING = as(params["NUM_LIVING"]); + const int NUM_DEAD = as(params["NUM_DEAD"]); + const int NumPredPreyLinks = as(params["NumPredPreyLinks"]); + const int NumFishingLinks = as(params["NumFishingLinks"]); + const int NumDetLinks = as(params["NumDetLinks"]); + const int COUPLED = as(params["COUPLED"]); + +// NUM_GROUPS length input vectors + const NumericVector B_BaseRef = as(params["B_BaseRef"]); + const NumericVector MzeroMort = as(params["MzeroMort"]); + const NumericVector UnassimRespFrac = as(params["UnassimRespFrac"]); + const NumericVector ActiveRespFrac = as(params["ActiveRespFrac"]); + const NumericVector HandleSelf = as(params["HandleSelf"]); + const NumericVector ScrambleSelf = as(params["ScrambleSelf"]); + //const NumericVector fish_Effort = as(params["fish_Effort"]); + +// NumPredPreyLinks Length vectors + const IntegerVector PreyFrom = as(params["PreyFrom"]); + const IntegerVector PreyTo = as(params["PreyTo"]); + const NumericVector QQ = as(params["QQ"]); + const NumericVector DD = as(params["DD"]); + const NumericVector VV = as(params["VV"]); + const NumericVector HandleSwitch = as(params["HandleSwitch"]); + const NumericVector PredPredWeight = as(params["PredPredWeight"]); + const NumericVector PreyPreyWeight = as(params["PreyPreyWeight"]); + +// NumFishingLinks lenghted vectors + const IntegerVector FishFrom = as(params["FishFrom"]); + const IntegerVector FishThrough = as(params["FishThrough"]); + const IntegerVector FishTo = as(params["FishTo"]); + const NumericVector FishQ = as(params["FishQ"]); + const IntegerVector DetFrom = as(params["DetFrom"]); + const IntegerVector DetTo = as(params["DetTo"]); + const NumericVector DetFrac = as(params["DetFrac"]); + +// Age-structured parameters + const int Nsplit = as(stanzas["Nsplit"]); + const NumericVector Nstanzas = as(stanzas["Nstanzas"]); + const NumericVector baseStanzaPred = as(stanzas["baseStanzaPred"]); + NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); + +// State vectors + const NumericVector state_Biomass = as(state["Biomass"]); + const NumericVector state_Ftime = as(state["Ftime"]); + const NumericVector stanzaPred = as(state["StanzaPred"]); + +//FISHING NumericVector TerminalF = as(params["TerminalF"]); +//FISHING NumericVector TARGET_BIO = as(params["TARGET_BIO"]); +//FISHING NumericVector TARGET_F = as(params["TARGET_F"]); +//FISHING NumericVector ALPHA = as(params["ALPHA"]); + +// "Environmental" forcing matrices (dd-indexed month x species) +// SHOULD BE CONST, but no row extraction for CONST (per Rcpp issues wiki) + NumericMatrix force_byprey = as(forcing["ForcedPrey"]); + NumericMatrix force_bymort = as(forcing["ForcedMort"]); + NumericMatrix force_bysearch = as(forcing["ForcedSearch"]); + NumericMatrix force_bymigrate = as(forcing["ForcedMigrate"]); + NumericMatrix force_byactresp = as(forcing["ForcedActresp"]); + +// Fishing forcing matrices (indexed year x species) +// SHOULD BE CONST, but no row extraction for CONST (per Rcpp issues wiki) + NumericMatrix FORCED_FRATE = as(fishing["ForcedFRate"]); + NumericMatrix FORCED_CATCH = as(fishing["ForcedCatch"]); + NumericMatrix EffortMat = as(fishing["ForcedEffort"]); + +// Components of derivative calculated here + NumericVector TotGain(NUM_GROUPS+1); + NumericVector TotLoss(NUM_GROUPS+1); + NumericVector LossPropToB(NUM_GROUPS+1); + NumericVector LossPropToQ(NUM_GROUPS+1); + NumericVector DerivT(NUM_GROUPS+1); + NumericVector biomeq(NUM_GROUPS+1); + NumericVector FoodLoss(NUM_GROUPS+1); + NumericVector FoodGain(NUM_GROUPS+1); + NumericVector UnAssimLoss(NUM_GROUPS+1); + NumericVector ActiveRespLoss(NUM_GROUPS+1); + NumericVector DetritalGain(NUM_GROUPS+1); + NumericVector FishingGain(NUM_GROUPS+1); + NumericVector MzeroLoss(NUM_GROUPS+1); + NumericVector FishingLoss(NUM_GROUPS+1); + NumericVector DetritalLoss(NUM_GROUPS+1); + NumericVector FishingThru(NUM_GROUPS+1); + NumericVector PredSuite(NUM_GROUPS+1); + NumericVector HandleSuite(NUM_GROUPS+1); + NumericVector GearCatch(NumFishingLinks+1); + NumericVector MigrateLoss(NUM_GROUPS+1); + +// Set effective biomass for pred/prey response +// default is B/Bref + NumericVector preyYY = state_Ftime * state_Biomass/B_BaseRef * force_byprey(dd,_); + NumericVector predYY = state_Ftime * state_Biomass/B_BaseRef * force_bysearch(dd,_); + +// Set functional response biomass for juvenile and adult groups (including foraging time) + if(Nsplit > 0){ + for (isp = 1; isp <=Nsplit; isp++){ + for(ist = 1; ist <= Nstanzas[isp]; ist++){ + ieco = EcopathCode(isp, ist); + if (baseStanzaPred[ieco] > 0){ + predYY[ieco] = state_Ftime[ieco] * stanzaPred[ieco] / + baseStanzaPred[ieco]; + } + } + } + } + +// Unroll Biomass Vectors (match pred, prey biomass for all links) + NumericVector PYY = preyYY[PreyFrom]; + NumericVector PDY = predYY[PreyTo]; + +// Summed predator and prey suites for joint handling time and/or scramble functional response + for (links=1; links<=NumPredPreyLinks; links++){ + PredSuite[PreyFrom[links]] += predYY[PreyTo[links] ] * PredPredWeight[links]; + HandleSuite[PreyTo[links]] += preyYY[PreyFrom[links]] * PreyPreyWeight[links]; + } + +// Unroll the suites into a NumPredPrey length vector + NumericVector PdSuite = PredSuite[PreyFrom]; + NumericVector PySuite = HandleSuite[PreyTo]; + NumericVector Hself = HandleSelf[PreyTo]; + NumericVector Sself = ScrambleSelf[PreyTo]; + +// // Main VECTOR CALC to calculate functional response for each predator/prey link +// // (3) Additive version: primary used and published in Aydin (2004) +// // KYA 3/2/2012 setting "COUPLED" to zero means species are density dependent +// // (based on their own modul) but don't interact otherwise. This can magically +// // create and destroy energy in the system but makes them act like a set +// // of independent surplus production models for comparison purposes +// NON-VECTOR VERSION: +// Q = QQ[links] * predYY[pred] * pow(preyYY[prey], COUPLED * HandleSwitch[links]) * +// ( DD[links] / ( DD[links] - 1.0 + +// pow(HandleSelf[pred] * preyYY[prey] + +// (1. - HandleSelf[pred]) * HandleSuite[pred], +// COUPLED * HandleSwitch[links])) )* +// ( VV[links] / ( VV[links] - 1.0 + +// ScrambleSelf[pred] * predYY[pred] + +// (1. - ScrambleSelf[pred]) * PredSuite[prey]) ); +// Rcpp VECTOR VERSION + NumericVector Q1 = + QQ * PDY * vpow(PYY, HandleSwitch * COUPLED) * + ( DD / ( DD-1.0 + vpow((1.-Hself)*PYY + Hself*PySuite, COUPLED*HandleSwitch)) ) * + ( VV / ( VV-1.0 + (1.-Sself)*PDY + Sself*PdSuite) ); + Q1[0] = 1.0; // get rid of NaN - moved from KYA's code 6/12/17 + +// No vector solution here as we need to sum by both links and species + for (links=1; links<=NumPredPreyLinks; links++){ + prey = PreyFrom[links]; + pred = PreyTo[links]; + // If model is uncoupled, food loss doesn't change with prey or predator levels. + if (COUPLED){ FoodLoss[prey] += Q1[links]; } + else{ FoodLoss[prey] += state_Biomass[prey] * QQ[links]/B_BaseRef[prey]; } + FoodGain[pred] += Q1[links]; + } + +// By Species Rates + UnAssimLoss = FoodGain * UnassimRespFrac; + ActiveRespLoss = FoodGain * ActiveRespFrac * force_byactresp(dd,_); + MzeroLoss = MzeroMort * state_Biomass; + + + // Add mortality forcing + for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ + FoodLoss[i] *= force_bymort(dd, i); + MzeroLoss[i] *= force_bymort(dd, i); + } + + // Add migration forcing + MigrateLoss = clone(state_Biomass); + for (int i=1; i<=NUM_DEAD+NUM_LIVING; i++){ + MigrateLoss[i] *= force_bymigrate(dd, i); + } + + NumericVector NetProd = FoodGain - UnAssimLoss - ActiveRespLoss - MzeroLoss - FoodLoss - MigrateLoss; + +// FISHING FUNCTIONS (multiple options depending on fishing method) + +// // MOST OF THE FOLLOWING FISHING SPECIFICATION METHODS ARE NOT SUPPORTED +// // BY THE R-CODE, only fishing by effort (for gear) or by F-rate (for +// // species) is supported at the end. +// // +// // BY CURRENT R-CODE. ONLY +// // RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ +// // RFISH This sets EFFORT by time series of gear-target combinations +// // RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ +// // RFISH if -1 is an input value, uses TERMINAL F (last non-negative F) +// //RFISH for (gr=NUM_LIVING+NUM_DEAD+1; gr<=NUM_GROUPS; gr++){ +// //RFISH if (y+m+d == 0){fish_Effort[gr]=1.0;} +// //RFISH else {fish_Effort[gr]=1.0;} // NOTE DEFAULT! THIS CAN BE CHANGED TO 1.0 +// //RFISH // Added 7/8/08 for forced effort +// //RFISH if (FORCED_EFFORT[gr][y] > -0.001) +// //RFISH {fish_Effort[gr]=FORCED_EFFORT[gr][y];} +// //RFISH +// //RFISH if ((FORCED_TARGET[gr]>0) && (FORCED_CATCH[gr][y]>-EPSILON)){ +// //RFISH totQ = 0.0; +// //RFISH sp = FORCED_TARGET[gr]; +// //RFISH for (links=1; links<=NumFishingLinks; links++){ +// //RFISH if ((FishingThrough[links] == gr) && +// //RFISH (FishingFrom[links]) == sp){ +// //RFISH totQ += FishingQ[links]; +// //RFISH } +// //RFISH } +// //RFISH fish_Effort[gr] = FORCED_CATCH[gr][y]/ +// //RFISH (totQ * state_Biomass[sp]); +// //RFISH if (FORCED_CATCH[gr][y] >= state_Biomass[sp]) +// //RFISH {fish_Effort[gr] = (1.0-EPSILON)*(state_Biomass[sp])/ +// //RFISH (totQ * state_Biomass[sp]);} +// //RFISH } +// //RFISH // By putting F after catch, Frates override absolute catch +// //RFISH if ((FORCED_FTARGET[gr]>0) && (FORCED_FRATE[gr][y]>-EPSILON)){ +// //RFISH totQ = 0.0; +// //RFISH sp = FORCED_FTARGET[gr]; +// //RFISH for (links=1; links<=NumFishingLinks; links++){ +// //RFISH if ((FishingThrough[links] == gr) && +// //RFISH (FishingFrom[links]) == sp){ +// //RFISH totQ += FishingQ[links]; +// //RFISH } +// //RFISH } +// //RFISH fish_Effort[gr] = FORCED_FRATE[gr][y]/totQ; +// //RFISH //if (FORCED_CATCH[gr][y] >= state_Biomass[sp]) +// //RFISH // {fish_Effort[gr] = (1.0-EPSILON)*(state_Biomass[sp])/ +// //RFISH // (totQ * state_Biomass[sp]);} +// //RFISH } +// //RFISH +// //RFISH //if ((y==0) && (m==0) && (d==0)){ +// //RFISH // cout << path_species[gr] << " " << FORCED_TARGET[gr] << " " << path_species[sp] << " " +// //RFISH // << state_Biomass[sp] << " " << FORCED_CATCH[gr][y] << " " +// //RFISH // << fish_Effort[gr] << endl; +// //RFISH //} +// //RFISH } +// + double caught; + // Apply specified Effort by Gear to catch (using Ecopath-set Q) + NumericVector Effort = (NumericVector)EffortMat(dd,_); + for (links=1; links<=NumFishingLinks; links++){ + prey = FishFrom[links]; + gr = FishThrough[links]; + dest = FishTo[links]; + egr = FishThrough[links] - (NUM_LIVING + NUM_DEAD); + caught = FishQ[links] * Effort[egr] * state_Biomass[prey]; + FishingLoss[prey] += caught; + FishingThru[gr] += caught; + FishingGain[dest] += caught; + GearCatch[links] = caught; + } + NumericVector FORCE_F = (NumericVector)FORCED_FRATE(y,_); + // Special "CLEAN" fisheries assuming q=1, so specified input is Frate + for (sp=1; sp<=NUM_LIVING+NUM_DEAD; sp++){ + caught = FORCED_CATCH(y, sp) + FORCE_F[sp] * state_Biomass[sp]; + // KYA Aug 2011 removed terminal effort option to allow negative fishing pressure + // if (caught <= -EPSILON) {caught = TerminalF[sp] * state_Biomass[sp];} + // KYA 10/6/17 Added productivity to Biomass limit for F>1 species (salmon inspired) + if (caught >= state_Biomass[sp] + NetProd[sp]){caught = (1.0 - EPSILON) * (state_Biomass[sp] + NetProd[sp]);} + if (caught<0){caught=0;} + FishingLoss[sp] += caught; + FishingThru[0] += caught; + FishingGain[0] += caught; + //if(sp==1){Rprintf("%d %g %g %g \n",sp,FORCED_FRATE(y,sp),caught,FishingLoss[sp]);} + //TerminalF[sp] = caught/state_Biomass[sp]; + } + +// KINKED CONTROL RULE - NEEDS INPUT of TARGET BIOMASS and TARGET CATCH + //FISHING double RefBio, maxcaught; + //FISHING for (sp=1; sp<=NUM_LIVING+NUM_DEAD; sp++){ + //FISHING if (TARGET_BIO[sp] > EPSILON){ + //FISHING RefBio = state_Biomass[sp] / TARGET_BIO[sp]; + //FISHING maxcaught = TARGET_F[sp] * state_Biomass[sp]; + //FISHING if (RefBio > 1.0) {caught = maxcaught;} + //FISHING else if (RefBio >= ALPHA[sp]) {caught = maxcaught * (RefBio - ALPHA[sp])/(1.0 - ALPHA[sp]);} + //FISHING else {caught = 0.0;} + //FISHING FishingLoss[sp] += caught; + //FISHING FishingThru[0] += caught; + //FISHING FishingGain[0] += caught; + //FISHING TerminalF[sp] = caught/state_Biomass[sp]; + //FISHING } + //FISHING } + +// DETRITUS - note: check interdetrital flow carefully, have had some issues +// (check by ensuring equlibrium run stays in equilibrium) + int liv, det; + double flow; + for (links=1; links<=NumDetLinks; links++){ + liv = DetFrom[links]; + det = DetTo[links]; + flow = DetFrac[links] * (MzeroLoss[liv] + UnAssimLoss[liv]); + DetritalGain[det] += flow; + if (liv > NUM_LIVING) {DetritalLoss[liv] += flow; } + } + for (sp=NUM_LIVING+1; sp<=NUM_LIVING+NUM_DEAD; sp++){ + MzeroLoss[sp] = 0.0; + } + + +// Sum up derivitive parts (vector sums) +// Override for group 0 (considered "the sun", never changing) + TotGain = FoodGain + DetritalGain + FishingGain; + LossPropToQ = UnAssimLoss + ActiveRespLoss; + LossPropToB = FoodLoss + MzeroLoss + FishingLoss + MigrateLoss + DetritalLoss; + TotGain[0] = 0; + LossPropToB[0] = 0; + LossPropToQ[0] = 0; + TotLoss = LossPropToQ + LossPropToB; + biomeq = TotGain/(TotLoss/state_Biomass); + biomeq[0] = 1.0; + DerivT = TotGain - TotLoss; + +// Rcpp List structure to return +// KYA 6/20/17 Rcpp bug (known) is max 18 items on List::create +// had to add Q1 (qlink), so removed LossPropToQ (used nowhere?) +// SML 8/8/17 - actually don't need most of these...commenting +// out to track catch by gear + List deriv = List::create( + //_["preyYY"]=preyYY, + //_["predYY"]=predYY, + _["TotGain"]=TotGain, + _["TotLoss"]=TotLoss, + _["DerivT"]=DerivT, + _["biomeq"]=biomeq, + _["LossPropToB"]=LossPropToB, + //_["LossPropToQ"]=LossPropToQ, + _["FoodLoss"]=FoodLoss, + _["FoodGain"]=FoodGain, + _["UnAssimLoss"]=UnAssimLoss, + _["ActiveRespLoss"]=ActiveRespLoss, + _["DetritalGain"]=DetritalGain, + _["FishingGain"]=FishingGain, + _["MzeroLoss"]=MzeroLoss, + _["FishingLoss"]=FishingLoss, + _["DetritalLoss"]=DetritalLoss, + _["FishingThru"]=FishingThru, + //_["PredSuite"]=PredSuite, + //_["HandleSuite"]=HandleSuite, + _["Qlink"]=Q1, + _["GearCatch"]=GearCatch + ); + +// Return is an Rcpp List + return(deriv); +} + +// SplitSetPred function called in sim stanza initialize and update +// This function simply sums up across stanzas to get population-level +// Biomass, Numbers, and Consumption +// [[Rcpp::export]] +int SplitSetPred(List stanzas, List state){ + int isp, ist, ia, ieco; + double Bt, pt, Nt; + + //stanza parameters + const int Nsplit = as(stanzas["Nsplit"]); + const NumericVector Nstanzas = as(stanzas["Nstanzas"]); + NumericMatrix Age1 = as(stanzas["Age1"]); + NumericMatrix Age2 = as(stanzas["Age2"]); + NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); + //Parts of Stanza State + NumericMatrix NageS = as(state["NageS"]); + NumericMatrix WageS = as(state["WageS"]); + NumericMatrix QageS = as(state["QageS"]); + NumericVector stanzaPred = as(state["StanzaPred"]); + //state parameters + NumericVector state_Biomass = as(state["Biomass"]); + NumericVector state_N = as(state["N"]); + + for (isp = 1; isp <= Nsplit; isp++){ + for (ist = 1; ist <= Nstanzas[isp]; ist++){ + ieco = EcopathCode(isp, ist); + Bt = 1e-30; + pt = 1e-30; + Nt = 1e-30; + for (ia = Age1(isp, ist); ia <= Age2(isp, ist); ia++){ + Bt = Bt + NageS(ia, isp) * WageS(ia, isp); + pt = pt + NageS(ia, isp) * QageS(ia, isp); + Nt = Nt + NageS(ia, isp); + } + state_Biomass[ieco] = Bt; + state_N[ieco] = Nt; + stanzaPred[ieco] = pt; + } + } + return(0); +} + +// SplitUpdate function +// Update numbers, weight, and biomass for multistanza groups +// [[Rcpp::export]] +int SplitUpdate(List stanzas, List state, List forcing, List deriv, int yr, int mon){ + int isp, ist, ia, ieco=0, last, first; //KYA 6/12/17 ieco=0 to stop annoying warning + double Su, Gf, Nt; + + //stanza parameters + const int Nsplit = as(stanzas["Nsplit"]); + const NumericVector Nstanzas = as(stanzas["Nstanzas"]); + const NumericVector vBM = as(stanzas["vBM"]); + const NumericVector Wmat = as(stanzas["Wmat"]); + //const NumericVector Wmat001 = as(stanzas["Wmat001"]); + //const NumericVector Wmat50 = as(stanzas["Wmat50"]); + //const NumericVector WmatSpread = as(stanzas["WmatSpread"]); + //const NumericVector Amat001 = as(stanzas["Amat001"]); + //const NumericVector Amat50 = as(stanzas["Amat50"]); + //const NumericVector AmatSpread = as(stanzas["AmatSpread"]); + const NumericVector baseEggsStanza = as(stanzas["baseEggsStanza"]); + const NumericVector RscaleSplit = as(stanzas["RscaleSplit"]); + const NumericVector RzeroS = as(stanzas["RzeroS"]); + const NumericVector RecPower = as(stanzas["RecPower"]); + const NumericVector vBGFd = as(stanzas["vBGFd"]); + const NumericVector SpawnEnergy = as(stanzas["SpawnEnergy"]); + const NumericVector SpawnX = as(stanzas["SpawnX"]); + const NumericVector baseSpawnBio = as(stanzas["baseSpawnBio"]); + // The following matrices should also be const + NumericMatrix SplitAlpha = as(stanzas["SplitAlpha"]); + NumericMatrix Age1 = as(stanzas["Age1"]); + NumericMatrix Age2 = as(stanzas["Age2"]); + NumericMatrix EcopathCode = as(stanzas["EcopathCode"]); + // Parts of Stanza State + NumericVector SpawnBio = as(state["SpawnBio"]); + NumericVector EggsStanza = as(state["EggsStanza"]); + NumericMatrix NageS = as(state["NageS"]); + NumericMatrix WageS = as(state["WageS"]); + NumericMatrix QageS = as(state["QageS"]); + NumericVector stanzaPred = as(state["StanzaPred"]); + + //state parameters + const NumericVector state_Biomass = as(state["Biomass"]); + + //forcing parameters + NumericMatrix force_byrecs = as(forcing["ForcedRecs"]); + + //derivatives + const NumericVector LossPropToB = as(deriv["LossPropToB"]); + const NumericVector FoodGain = as(deriv["FoodGain"]); + + for (isp = 1; isp <= Nsplit; isp++){ + // Update numbers and body weights + SpawnBio[isp] = 0; + for(ist = 1; ist <= Nstanzas[isp]; ist++){ + ieco = EcopathCode(isp, ist); + Su = exp(-LossPropToB[ieco] / STEPS_PER_YEAR / state_Biomass[ieco]); + Gf = FoodGain[ieco] / stanzaPred[ieco]; + for(ia = Age1(isp, ist); ia <= Age2(isp, ist); ia++){ + NageS(ia, isp) = NageS(ia, isp) * Su; + WageS(ia, isp) = vBM[isp] * WageS(ia, isp) + Gf * SplitAlpha(ia, isp); + // KYA 5/7/18 - started to add alternate maturity method, commented out for now + //if(Wmat[isp]<0.0){ + // if ((WageS(ia, isp)>Wmat001[isp])&&(ia>Amat001[isp])){ + // SpawnBio[isp] += NageS(ia, isp) * WageS(ia, isp)/(1. + exp( + // -((WageS(ia, isp) - Wmat50[isp]) / WmatSpread[isp]) + // -((ia - Amat50[isp]) / AmatSpread[isp]) )); + // } + //} + //else{ + if(WageS(ia, isp) > Wmat[isp]){ + SpawnBio[isp] += NageS(ia, isp) * (WageS(ia, isp) - Wmat[isp]); + }; + //} + } + } + EggsStanza[isp] = SpawnBio[isp] * SpawnEnergy[isp] * SpawnX[isp] / + (SpawnX[isp] - 1.0 + (SpawnBio[isp] / baseSpawnBio[isp])); + EggsStanza[isp] *= force_byrecs(yr * STEPS_PER_YEAR + mon, ieco); + + //Rprintf("%g %g %g %g %g",isp,SpawnBio[isp],EggsStanza[isp],) + // Need to add monthly recruitment + + // now update n and wt looping backward over age + last = Age2(isp, Nstanzas[isp]); + first = Age1(isp, 1); + + Nt = NageS(last, isp) + NageS(last - 1, isp); + if(Nt == 0){Nt = 1e-30;} + + WageS(last, isp) = (WageS(last, isp) * NageS(last, isp) + WageS(last - 1, isp) * + NageS(last - 1, isp)) / Nt; + NageS(last, isp) = Nt; + + for(ia = last - 1; ia > first; ia--){ + NageS(ia, isp) = NageS(ia - 1, isp); + WageS(ia, isp) = WageS(ia - 1, isp); + } + + //Apply number of eggs to youngest slot. Includes Walter recruit power + if(baseEggsStanza[isp] > 0){ + NageS(first, isp) = RscaleSplit[isp] * RzeroS[isp] * pow(double(EggsStanza[isp] / + baseEggsStanza[isp]), double(RecPower[isp])); + } + WageS(first, isp) = 0; + + //Uses generalized vonB (exponent is d) + //Added for stability 4/13/07 (Unlucky Friday) + for(ia = 0; ia <= last; ia++){ + QageS(ia, isp) = pow(double(WageS(ia, isp)), double(vBGFd[isp])); + } + } + +return(0); } \ No newline at end of file