-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I have the "status 1" error with a certain model, which is weird.
The example case inherent to the package works perfectly.
system.file('extdata', 'cod_model.tgz', package = 'Rgadget') %>%
untar(exdir = path.expand('./gadget_example/'))
setwd('gadget_example/cod_model')
callGadget(s=1, i = 'WGTS/params.final', log = 'logfile')
But with a different model (from the tutorial https://heima.hafro.is/~bthe/getting_started.html), it reports status 1 persistently no matter how many times I erase the whole model file.
gd <- gadget.variant.dir("simple_model") # invoke this command to create a folder
schedule <- expand.grid(year = 1:10, step = 1:4) %>%
arrange(year)
gadgetfile("Modelfiles/time",
file_type = "time",
components = list(list(firstyear = min(schedule$year),
firststep = 1,
lastyear = max(schedule$year),
laststep = 4,
notimesteps = c(4,3,3,3,3)))) %>% # number of time steps and step length in months
write.gadget.file(gd)
gadgetfile("Modelfiles/area",
file_type = "area",
components = list(list(areas = 1,
size = 1,
temperature = schedule %>%
mutate(area = 1, temperature = 5)))) %>%
write.gadget.file(gd)
stock <- gadgetstock("simple_stock", gd, missingOkay = TRUE)
stock %>%
gadget_update("stock", # the component to update
livesonareas = 1, # below are keys to update
maxage = 1,
minage = 1,
minlength = 0,
maxlength = 2,
dl = 1)
stock <-
stock %>%
gadget_update("stock",
livesonareas = 1, # below are keys to update
maxage = 1,
minage = 1,
minlength = 0,
maxlength = 2,
dl = 1) %>%
gadget_update("doesgrow", 0) %>%
gadget_update("naturalmortality", 0) %>%
gadget_update("refweight", data = tibble(length = 0:2, mean = 0:2)) %>%
gadget_update("initialconditions",
normalparam = tibble(age = 1,
area = 1,
age.factor = 1, # number of fish at a certain age from a specific area,
area.factor = 1, # you need to multiply the area.factor with the age.factor
mean = 1, # mean length
stddev = 0.1, # sd
alpha = 1, # weight length relationship a
beta = 1)) # weight length relationship b
stock %>%
write.gadget.file(gd)
fs::dir_ls(gd)
Sys.setenv(GADGET_WORKING_DIR = normalizePath(gd))
callGadget(s = 1, main = "main", ignore.stderr = FALSE, log = "simple_log")
As the tutorial file suggested, status 1 is a consequence of old files. So I deleted all the other files and tried over and over. But the issue persists. I checked the log file (simple_log). An error occurs at line 31 as:
Gadget version 2.3.99 running on MSI Sun Mar 29 15:51:36 2020
Log file to record Gadget actions that take place during this run
Starting Gadget from directory: E:\phd\Gadget\simple_model
using data from directory: E:\phd\Gadget\simple_model
Checking to see if file params.out can be opened ... OK
Checking to see if file main can be opened ... OK
Opening file main
Checking to see if file Modelfiles/time can be opened ... OK
Opening file Modelfiles/time
Read time file - number of timesteps 40
Closing file Modelfiles/time
Checking to see if file Modelfiles/area can be opened ... OK
Opening file Modelfiles/area
Warning in area - found no temperature data
Warning in area - temperature data doesnt span time range
Discarded invalid temperature data - number of invalid entries 36
Read temperature data - number of entries 0
Read area file - number of areas 1
Closing file Modelfiles/area
Checking to see if file simple_stock can be opened ... OK
Opening file simple_stock
Checking to see if file Aggfiles/simple_stock.stock.len.agg can be opened ... OK
Opening file Aggfiles/simple_stock.stock.len.agg
Read length aggregation file - number of entries 2
Closing file Aggfiles/simple_stock.stock.len.agg
Read basic stock data for stock simple_stock
Read growth data for stock simple_stock
Error in file simple_stock - failed to read formula data
Do you have any idea what could be wrong with this model?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels