Closed mle2718 closed 2 years ago
I think this is related to options where the original assessment history is simulated by implementing the historical F and R estimated by the model and the assumed M. I think all that's needed here is a .csv with those estimates called yellowtailflounderGB.csv, but I believe @mdmazur and @lkerr have been working with these options recently so they would have a good sense. Alternatively you should be able to set histAssess <- FALSE in set_om_parameters_global.R to use parameters burnFmsyScalar and burnFsd along with the stock recruitment relationship during the entire burn-in period.
"histAssess <- FALSE in set_om_parameters_global.R to use parameters burnFmsyScalar and burnFsd " @samtruesdell : Easy enough to do, I will give this a shot.
Yes, in the short term I would suggest doing what Sam suggests-the stock magnitudes may be a little off, but we can get you the assessment history F and R values to input
progress.
Error in eval(substitute(expr), e) : object 'waa_mis' not found
> traceback()
6: eval(substitute(expr), e)
5: eval(substitute(expr), e)
4: within.list(stock, {
dat_file <- ReadASAP3DatFile(paste("assessment/ASAP/", stockName,
".dat", sep = ""))
dat_file$dat$year1 <- fmyearIdx - ncaayear
styear <- fmyearIdx - ncaayear
if (mproc[m, "Lag"] == "TRUE") {
endyear <- y - 2
}
else if (mproc[m, "Lag"] == "FALSE") {
endyear <- y - 1
}
N_rows <- length(styear:endyear)
dat_file$dat$n_years <- N_rows
dat_file$dat$M <- matrix(get_dwindow(natM, styear, endyear),
nrow = N_rows, ncol = page)
if (M_mis == TRUE) {
dat_file$dat$M <- matrix(M_mis_val, nrow = N_rows, ncol = page)
}
dat_file$dat$maturity <- matrix(get_dwindow(mat, styear,
endyear), nrow = N_rows)
dat_file$dat$WAA_mats <- matrix(get_dwindow(waa, styear,
endyear), nrow = N_rows)
if (waa_mis == TRUE) {
dat_file$dat$WAA_mats <- t(replicate(N_rows, waa[1, ]))
}
dat_file$dat$sel_block_assign <- matrix(1, nrow = N_rows,
1)
dat_file$dat$CAA_mats <- cbind(get_dwindow(obs_paaCN, styear,
endyear), get_dwindow(obs_sumCW, styear, endyear))
dat_file$dat$DAA_mats <- matrix(0, nrow = N_rows, ncol = page +
1)
dat_file$dat$prop_rel_mats <- matrix(0, nrow = N_rows, ncol = page)
dat_file$dat$IAA_mats <- cbind(seq(styear, endyear), get_dwindow(obs_sumIN,
styear, endyear), rep(oe_sumIN, N_rows), get_dwindow(obs_paaIN,
styear, endyear), rep(oe_paaIN, N_rows))
dat_file$dat$recruit_cv <- matrix(pe_RSA, nrow = N_rows,
1)
dat_file$dat$catch_cv <- matrix(0.05, nrow = N_rows, 1)
dat_file$dat$discard_cv <- matrix(0, nrow = N_rows, 1)
dat_file$dat$catch_Neff <- matrix(oe_paaCN, nrow = N_rows,
1)
dat_file$dat$discard_Neff <- matrix(0, nrow = N_rows, 1)
if (mproc[m, "Lag"] == "TRUE") {
dat_file$dat$nfinalyear <- y - 1
}
else if (mproc[m, "Lag"] == "FALSE") {
dat_file$dat$nfinalyear <- y
}
dat_file$dat$proj_ini <- c((y), -1, 3, -99, 1)
dat_file$dat$R_avg_start <- styear
dat_file$dat$R_avg_end <- endyear - 10
if (Sys.info()["sysname"] == "Windows") {
WriteASAP3DatFile(fname = paste("assessment/ASAP/", stockName,
"_", r, "_", y, ".dat", sep = ""), dat.object = dat_file,
header.text = paste(stockName, "Simulation", r, "Year",
y, sep = "_"))
WriteASAP3DatFile(fname = paste("assessment/ASAP/ASAP3.dat",
sep = ""), dat.object = dat_file, header.text = paste(stockName,
"Simulation", r, "Year", y, sep = "_"))
asapEst <- try(system("assessment/ASAP/ASAP3.exe", show.output.on.console = FALSE))
res <- dget("assessment/ASAP/ASAP3.rdat")
saveRDS(res, file = paste("assessment/ASAP/", stockName,
"_", r, "_", y, ".rdat", sep = ""))
}
if (Sys.info()["sysname"] == "Linux") {
WriteASAP3DatFile(fname = paste(rundir, "/", stockName,
"_", r, "_", y, ".dat", sep = ""), dat.object = dat_file,
header.text = paste(stockName, "Simulation", r, "Year",
y, sep = "_"))
WriteASAP3DatFile(fname = paste(rundir, "/ASAP3.dat",
sep = ""), dat.object = dat_file, header.text = paste(stockName,
"Simulation", r, "Year", y, sep = "_"))
tempwd <- getwd()
setwd(rundir)
if (runClass == "HPCC") {
asapEst <- try(system("singularity exec $WINEIMG wine ASAP3.EXE",
wait = TRUE))
}
else if (runClass == "neptune") {
asapEst <- try(system("./ASAP3", wait = TRUE))
}
while (!file.exists("ASAP3.rdat")) {
Sys.sleep(1)
}
res <- dget("ASAP3.rdat")
saveRDS(res, file = paste(rundir, "/", stockName, "_",
r, "_", y, ".rdat", sep = ""))
setwd(tempwd)
}
})
3: within(stock, {
dat_file <- ReadASAP3DatFile(paste("assessment/ASAP/", stockName,
".dat", sep = ""))
dat_file$dat$year1 <- fmyearIdx - ncaayear
styear <- fmyearIdx - ncaayear
if (mproc[m, "Lag"] == "TRUE") {
endyear <- y - 2
}
else if (mproc[m, "Lag"] == "FALSE") {
endyear <- y - 1
}
N_rows <- length(styear:endyear)
dat_file$dat$n_years <- N_rows
dat_file$dat$M <- matrix(get_dwindow(natM, styear, endyear),
nrow = N_rows, ncol = page)
if (M_mis == TRUE) {
dat_file$dat$M <- matrix(M_mis_val, nrow = N_rows, ncol = page)
}
dat_file$dat$maturity <- matrix(get_dwindow(mat, styear,
endyear), nrow = N_rows)
dat_file$dat$WAA_mats <- matrix(get_dwindow(waa, styear,
endyear), nrow = N_rows)
if (waa_mis == TRUE) {
dat_file$dat$WAA_mats <- t(replicate(N_rows, waa[1, ]))
}
dat_file$dat$sel_block_assign <- matrix(1, nrow = N_rows,
1)
dat_file$dat$CAA_mats <- cbind(get_dwindow(obs_paaCN, styear,
endyear), get_dwindow(obs_sumCW, styear, endyear))
dat_file$dat$DAA_mats <- matrix(0, nrow = N_rows, ncol = page +
1)
dat_file$dat$prop_rel_mats <- matrix(0, nrow = N_rows, ncol = page)
dat_file$dat$IAA_mats <- cbind(seq(styear, endyear), get_dwindow(obs_sumIN,
styear, endyear), rep(oe_sumIN, N_rows), get_dwindow(obs_paaIN,
styear, endyear), rep(oe_paaIN, N_rows))
dat_file$dat$recruit_cv <- matrix(pe_RSA, nrow = N_rows,
1)
dat_file$dat$catch_cv <- matrix(0.05, nrow = N_rows, 1)
dat_file$dat$discard_cv <- matrix(0, nrow = N_rows, 1)
dat_file$dat$catch_Neff <- matrix(oe_paaCN, nrow = N_rows,
1)
dat_file$dat$discard_Neff <- matrix(0, nrow = N_rows, 1)
if (mproc[m, "Lag"] == "TRUE") {
dat_file$dat$nfinalyear <- y - 1
}
else if (mproc[m, "Lag"] == "FALSE") {
dat_file$dat$nfinalyear <- y
}
dat_file$dat$proj_ini <- c((y), -1, 3, -99, 1)
dat_file$dat$R_avg_start <- styear
dat_file$dat$R_avg_end <- endyear - 10
if (Sys.info()["sysname"] == "Windows") {
WriteASAP3DatFile(fname = paste("assessment/ASAP/", stockName,
"_", r, "_", y, ".dat", sep = ""), dat.object = dat_file,
header.text = paste(stockName, "Simulation", r, "Year",
y, sep = "_"))
WriteASAP3DatFile(fname = paste("assessment/ASAP/ASAP3.dat",
sep = ""), dat.object = dat_file, header.text = paste(stockName,
"Simulation", r, "Year", y, sep = "_"))
asapEst <- try(system("assessment/ASAP/ASAP3.exe", show.output.on.console = FALSE))
res <- dget("assessment/ASAP/ASAP3.rdat")
saveRDS(res, file = paste("assessment/ASAP/", stockName,
"_", r, "_", y, ".rdat", sep = ""))
}
if (Sys.info()["sysname"] == "Linux") {
WriteASAP3DatFile(fname = paste(rundir, "/", stockName,
"_", r, "_", y, ".dat", sep = ""), dat.object = dat_file,
header.text = paste(stockName, "Simulation", r, "Year",
y, sep = "_"))
WriteASAP3DatFile(fname = paste(rundir, "/ASAP3.dat",
sep = ""), dat.object = dat_file, header.text = paste(stockName,
"Simulation", r, "Year", y, sep = "_"))
tempwd <- getwd()
setwd(rundir)
if (runClass == "HPCC") {
asapEst <- try(system("singularity exec $WINEIMG wine ASAP3.EXE",
wait = TRUE))
}
else if (runClass == "neptune") {
asapEst <- try(system("./ASAP3", wait = TRUE))
}
while (!file.exists("ASAP3.rdat")) {
Sys.sleep(1)
}
res <- dget("ASAP3.rdat")
saveRDS(res, file = paste(rundir, "/", stockName, "_",
r, "_", y, ".rdat", sep = ""))
setwd(tempwd)
}
}) at get_ASAP.R#6
2: get_ASAP(stock = tempStock) at get_advice.R#24
1: get_advice(stock = stock[[i]])
To fix that error somehwere in yellowtailflounderGB.R put a line that reads: waa_mis<-FALSE. You can set it to true if you want there to be a weight-at-age misspecification in the stock assessment.
@mdmazur this is something that I can safely commit to master, right? ~M
On Mon, May 16, 2022 at 6:14 PM mdmazur @.***> wrote:
To fix that error somehwere in yellowtailflounderGB.R put a line that reads: waa_mis<-FALSE. You can set it to true if you want there to be a weight-at-age misspecification in the stock assessment.
— Reply to this email directly, view it on GitHub https://github.com/lkerr/groundfish-MSE/issues/214#issuecomment-1128189109, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIT5KA7W4HQWXNC3LLXBTF3VKLCB7ANCNFSM5VWLMHHA . You are receiving this because you authored the thread.Message ID: @.***>
--
Min-Yang Lee(he/him/his what's this https://www.glsen.org/activity/pronouns-guide-glsen)
Economist, Northeast Fisheries Science Center
NOAA Fisheries | U.S. Department of Commerce
Office: (508) 495-4704
www.fisheries.noaa.gov
I've created the branch https://github.com/lkerr/groundfish-MSE/tree/ytfGB_fix from the ml_ASAP branch to troubleshoot ytfGB
hist_assess<-FALSE waa_mis<-FALSE
still get some error messages,
Error in eval(substitute(expr), e) : object 'Rpar_mis' not found. It looks like there's a few other parameters that need to get set in yellowtailflounderGB.R. I'm not comfortable setting them myself: I'm sure I'll do something ridiculous while getting it to run that will be overlooked and that will cause some problems later on.
Those changes can be committed to the master branch. Rpar_mis can be set the same as Rpar in yellowtailflounderGB.R. Rpar_mis are the recruitment parameters that are used if there is a recruitment misspecification. If there is no misspecification, they will not be used. So it does not matter what it is set to unless the recruitment misspecification is turned on.
I think I already did this in the dev branch, as well as adding pe_RSA and pe_IA. I'll double check that I pushed it!
@jerellejesse the waa_mis, M_mis, R_mis
are in dev for pollock and yellowtailflounderGB da96032d3f353591f8c48d48e6f59129ca4ffaa4. Also for haddockGB in b75ef42c06d3dbcb13259e121c7fdb8187f8b906.
I don't see pe_RSA
or pe_IA
but I might be looking in the wrong place.
those changes should close this issue.
Yellowtail will work if histAssess <- FALSE in set_om_parameters_global and minCatch is FALSE in mproc. It is still on my list to grab the data need for this functionality.
Still get this for just yellowtailGB when I set those options:
Error in matrix(pe_RSA, nrow = N_rows, 1) : object 'pe_RSA' not found traceback points to
in get_ASAP dat_file$dat$recruit_cv <- matrix(pe_RSA, nrow = N_rows, 1)
Sorry, you might have to update from the dev branch!
@jerellejesse thanks! Of course I'd need to do that. Works now.
When I set
And run the model, I get this error message:
I looked in that folder and sure enough, those there isn't a yellowtailflounderGB assessment history file.