make_gadget_stockfile: Make Gadget stockfile

Description Usage Arguments Value Examples

Description

Make a list of class gadget_stock that can be used to write out a Gadget stockfile

Usage

1

Arguments

...

A list of named elements. The names of these elements must correspond to arguments found in Gadget stockfiles (i.e. for growth, use growth = list(), for spawning, use spawning = list(), etc), see Gadget User Guide. Chapter 4. Stock Files.

Value

A list of class gadget_stock containing information about that stock to be used by Gadget

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# setup basic stock information
minage <- 1
maxage <- 10
minlength <- 1
maxlength <- 100
dl <- 1
alpha <- 1e-04
beta <- 3
reflength <- seq(minlength, maxlength, dl)
stock_info <-
    list(stockname = "cod", livesonareas = 1,
         minage = minage, maxage = maxage,
         minlength = minlength, maxlength = maxlength, dl = dl)

# setup refweightfile
stock_refwgt <-
    data.frame(len = reflength,
               weight = alpha * reflength ^ beta)

# setup growth
stock_growth <-
    list(growthfunction = "lengthvbsimple",
         growthparameters =
             c(to_gadget_formula(quote(cod.linf)),
               to_gadget_formula(quote(cod.k)),
               0.001, 3))
# setup naturalmortality
stock_m <- rep(0.2, 10)

# setup initial conditions
init_data <-
    normalparamfile(age = seq(minage, maxage, 1),
                    area = 1,
                    age.factor = "#cod.init.age",
                    area.factor = "#cod.init.area",
                    mean = vb_formula("cod", minage:maxage),
                    sd = 1:10,
                    alpha = alpha,
                    beta = beta)
stock_initcond <- list(normalparamfile = init_data)

# setup spawning
stock_spawnfile <-
    make_gadget_spawnfile(
      stockname = "cod",
      start_year = 1,
      end_year = 10,
      recruitment = ricker_formula("cod")
    )

# create gadget stockfile
cod <-
   make_gadget_stockfile(stock = stock_info,
                         refweightfile = stock_refwgt,
                         growth = stock_growth,
                         naturalmortality = stock_m,
                         iseaten = 1,
                         initialconditions = stock_initcond,
                         spawning = stock_spawnfile)

inspktrgadget/gadgetSim documentation built on May 10, 2019, 9:51 a.m.