Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change_tv() should be able to add tv parameters when there are none #329

Open
Tracked by #334
kellijohnson-NOAA opened this issue Oct 17, 2021 · 1 comment
Open
Tracked by #334
Assignees
Labels
topic --- OM pertains to the operating model (OM) topic --- vignette information within a vignette or ideas for vignettes type --- documentation requires changes to the docs type --- upkeep general package maintenance work that makes future development #' easier

Comments

@kellijohnson-NOAA
Copy link
Contributor

The Introduction vignette as written makes me think that change_tv() doesn't declare environmental linkages for parameters. It currently says

Currently, the `change_tv` function only works to add time-varying properties to a time-invariant parameter. It cannot alter the properties of parameters that already vary with time. Also, it will not work with custom environmental linkages. Environmental linkages for all parameters in the OM must be declared by a single line i.e., `0 #_custom_mg-env_setup (0/1)` prior to using `change_tv`. Additionally, SS does not allow more than one stock recruit parameter to vary with time. Therefore, if the `.ctl` file already has a stock recruit parameter that varies with time and you try to implement another, the function will fail.

I would hope that this is done automatically, but I need to double check.

@kellijohnson-NOAA kellijohnson-NOAA added topic --- vignette information within a vignette or ideas for vignettes topic --- OM pertains to the operating model (OM) labels Oct 17, 2021
@kellijohnson-NOAA kellijohnson-NOAA self-assigned this Oct 17, 2021
@k-doering-NOAA
Copy link
Contributor

I think the environmental linkage is declared, it is just hard coded to always use link option 2:

ss3sim/R/change_tv.r

Lines 221 to 235 in 0d50a0e

# Set the environmental link and environmental var (8th element)
# where a 3 digit value is put in to specify link and env var. 2 is used
# for an additive link. (e.g., to sepecify an additive link with env. var 3,
# put 203 as the 8th element.)
# link = 2 use an additive fxn of environmental variable (g)
# value of g in year y (env(y,-g))
# param`(y) = param + link*env(y,-g)
val[8] <- as.numeric(paste0("2", "0", dat.varnum.counter))
ss3.ctl[par.ch] <- paste(c(val, "#", names(temp.data)[i]), collapse = " ")
dat <- data.frame("Yr" = ss3.dat$styr:ss3.dat$endyr,
"Variable" = dat.varnum.counter,
"Value" = temp.data[i])
colnames(dat) <- c("Yr", "Variable", "Value")
ss3.dat.tbl <- rbind(ss3.dat.tbl, dat)
}

change_tv does need some refactoring, as it is still using grep statements rather than the list element names when read in the r4ss read/write functions.

@kellijohnson-NOAA kellijohnson-NOAA added type --- documentation requires changes to the docs status --- wip work in progress labels Oct 18, 2021
@kellijohnson-NOAA kellijohnson-NOAA removed the status --- wip work in progress label Nov 9, 2021
@kellijohnson-NOAA kellijohnson-NOAA added the type --- upkeep general package maintenance work that makes future development #' easier label Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic --- OM pertains to the operating model (OM) topic --- vignette information within a vignette or ideas for vignettes type --- documentation requires changes to the docs type --- upkeep general package maintenance work that makes future development #' easier
Projects
None yet
Development

No branches or pull requests

2 participants