gadget-framework / rgadget

Rgadget is a set of useful utilities for gadget
6 stars 12 forks source link

gadget_update() does not print datafile for doesspawn #78

Closed pfrater closed 7 years ago

pfrater commented 7 years ago

When using gadget_update("doesspawn") the function doesn't seem to recognize that the correct format should yield

...
doesspawn  1
spawnfile  <nameOfFile>
...

Instead it outputs the exact contents of given to the spawnfile argument. Rather, it should create a file much the same way that gadget_update("initialconditions", normalparam = data_frame()) creates a <stock>.init.normalparam file.

Am I missing something here, or perhaps I'm stating the incorrect argument? I'm guessing this is just not implemented yet? See the MRE below. Notice how under initialconditions in the output there are parameters followed by a path for the normalparamfile, whereas under doesspawn it simply returns the parameters that are fed to it in the spawnfile argument.

library(Rgadget)

gadgetstock("zebrafish", "~", missingOkay = TRUE) %>%
    gadget_update("stock",
                  minage=1,
                  maxage=2,
                  minlength=1,
                  maxlength=2,
                  dl=1,
                  livesonareas=1) %>%
    gadget_update("initialconditions",
                  normalparam = data_frame(age=1:2,area=1,age.factor=1,
                                           area.factor=1,mean=1,stddev=1,
                                           alpha=1,beta=1)) %>%
    gadget_update("doesspawn",
                  spawnfile = data_frame(spawnsteps="should be name of file",
                                         spawnareas="instead of direct parameters"))
bthe commented 7 years ago

The spawnfile should be a gadgetfile object, e.g. https://github.com/fishvice/gadget-models/blob/master/forward.R#L168 and then everything should work as planned.

pfrater commented 7 years ago

Aha!! Thank you!