You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now when we add a component to a model, we can optionally set its first and last. If they are set there are set the component's first and lastwill not change if the model time dimension is changed (they have a first_free and last_free flag that is set to false. If they are not set, they will take the first and last of the model itself, and vary freely with the model, so if someone calls set_dimension(:time, values on the model, that time will propagate through the components and change the first and last of the components.
This creates a problem in the FUND_FAIR case:
We start with
m = MimiFUND.get_model(;nsteps = 551 )
Currently, m runs from 1950 to 2500, and the components and model all have first and last of 1950 and 2500 respectively. Now we want to widen the time dimension so that we can couple FAIR, so we call:
set_dimension!(m, :time, collect(1765:2500))
add_comp!(m, MimiFAIR_composite, after = MimiFUND_emissionscomposite)
The problem now is that this time dimension automatically flows through all the FUND components, so all FUND components have a first and last of 1765 and 2500 respectively ... which is wrong!
Thus we need a user-facing function to retroactively set first for the FUND components. This should call my existing functions Mimi.propagate_time! (or Mimi._propagate_firstlast!) under the hood and will look something like this ...
set_firstlast!(m::ModelDef, comp_name::Symbol; first = NothingInt, last = NothingInt)
so that we can call
m = MimiFUND.get_model(;nsteps = 551 )
set_dimension!(m, :time, collect(1765:2500))
add_comp!(m, MimiFAIR_composite, after = MimiFUND_emissionscomposite)
set_firstlast!(m, MimiFUND_emissionscomposite, first = 1950);
set_firstlast!(m, MimiFUND_climatecomposite, first = 1950);
set_firstlast!(m, MimiFUND_impactscomposite, first = 1950);
Ideas for the name? I guess it could be update_firstlast!? Also can we put this in the exported API or should I keep it out?
The text was updated successfully, but these errors were encountered:
Right now when we add a component to a model, we can optionally set its
first
andlast
. If they are set there are set the component'sfirst
andlast
will not change if the model time dimension is changed (they have afirst_free
andlast_free
flag that is set tofalse
. If they are not set, they will take the first and last of the model itself, and vary freely with the model, so if someone callsset_dimension(:time, values
on the model, that time will propagate through the components and change thefirst
andlast
of the components.This creates a problem in the FUND_FAIR case:
We start with
Currently,
m
runs from 1950 to 2500, and the components and model all have first and last of 1950 and 2500 respectively. Now we want to widen the time dimension so that we can couple FAIR, so we call:The problem now is that this time dimension automatically flows through all the FUND components, so all FUND components have a
first
andlast
of 1765 and 2500 respectively ... which is wrong!Thus we need a user-facing function to retroactively set
first
for the FUND components. This should call my existing functionsMimi.propagate_time!
(orMimi._propagate_firstlast!
) under the hood and will look something like this ...set_firstlast!(m::ModelDef, comp_name::Symbol; first = NothingInt, last = NothingInt)
so that we can call
Ideas for the name? I guess it could be
update_firstlast!
? Also can we put this in the exported API or should I keep it out?The text was updated successfully, but these errors were encountered: