Closed kellijohnson-NOAA closed 2 years ago
Also, we need to decide what to include as "data objects". For example would results from C1 with run_om()
be read back into R and stored as an object so users do not have to run anything but have access to the results? We could do this but just store one iteration or maybe 10 to do the plotting? @Bai-Li-NOAA I am not sure how big these data objects would be or if you even want them stored.
I agree that it is not the best practice to use global variables inside of a function. The fleet_num bug is a good example. Populating the list in save_initial_input() with the values from a case and then always changing those using base_case = FALSE sounds good.
Generating 100 sims instead of 120 is okay to do in C1, but it is easier to start with a bigger number because the EM sometimes has some convergence issues for some of the iterations. This way, we can make sure we have 100 sets of converged results in the end.
Currently, the results from the last iteration of C1 are stored in R and results from all iterations are stored locally and it is about 50KB per iteration. I think we can use the last iteration of C1 for plotting and not read the rest of the results in the R environment. We can use run_em() to load OM results and run estimation models.
run_OM()
is super fast. So, I think setting the default of om_sim_num = 120
would be fine.
Going forward I will
generate_case()
save_initial_input()
save_initial_input()
in the code base and change to using the new format of C1 as the defaults and augmenting the case from thereQuestions for @Bai-Li-NOAA
om_input
and om_output
saved?om_input_C1_100
and om_output_C1_100
or would you prefer shorter names?om_input
, om_output
, and em_input
. om_input_C1_100
and om_output_C1_100
works fine with meI will work on
Uses
generate_case()
in README.md instead of huge block of code.Creates two TODO's for @Bai-Li-NOAA. One is a documentation and another is checking that generating 100 sims instead of 120 and throwing 20 away is okay to do in C1.
Failed to implement lexical scoping :( I am so sad about this. I tried to populate my workspace with all of the needed objects inside of
generate_case()
but when I would callsave_initial_input()
it would ALWAYS use the .GlobalEnv rather than the local environment ofgenerate_case()
. The way the list is created now does not facilitate checking that all of the needed list members are present. So, ifsave_initial_input()
were to add a list itemgenerate_case()
would fail to ensure that the new item is present. I am happy to change things here if someone has a different way of coding this. I honestly think that a good option here would just be to populate the list insave_initial_input()
with the values from case 1 or any other case and then always change those usingbase_case = FALSE
. This option would clean up the code base because it is not the best practice to use global variables inside of a function.Before this moves from draft to an actual pull request there are additional calls in example and inside some functions that might be able to use
generate_case()
instead of starting from scratch.