Mimi Framework

Setting parameter with more than 2 dimensions

Hi team,

I need to set a few other parameters in my migration extension of FUND. One of them has 3 and not just 2 dimensions: Parameter(index=[regions,regions,agegroups]).
Yet in the FUND helper file describing the loadparameters and prepparameters! functions, it seems that it’s not possible to load any file with more than 2 dimensions (3 columns).

Is there an easy way to remedy to this?


Hi @hbenveniste,

Good question! I’m not a FUND expert, but I assume this means there aren’t any existing 3 dimensional parameters pulled from CSVs in FUND right now. If having an option for a third dimension seems useful you should post an Issue on FUND with that suggestion.

In the meantime though, let’s find a way for you to do it yourself! Can you shoot me the repo URL so I can take a look at your structure? I assume you are currently using the MimiFUND.load_default_parameters! function within your code and passing it your data directory path?

Depending on your use case, there are a few options I can see:

  1. Create a modified version of the load_default_parameters! function to use a prepparameters handle 4 columns. This doesn’t seem great though because you want to be able to use the latest and greatest version of FUND functions without worrying you’re getting behind, so I think #2 below is probably better.

  2. Write your own function or call to load a 3d CSV file, or this specific one, which could look a lot like some of the MimiFUND.load_default_parameters! function. You’d need to keep the file OUTSIDE of the path that you pass to load_default_parameters) so that function doesn’t pick it up. Then you could …

  • add it to your params_mig dictionary manually for consistency and then do your normal call indexing into that dictionary
set_param!(m, :comp, :param, param_mig["param"])
  • just call set_param!(m, :migration, :param, values where values is the variable holding your loaded CSV data
set_param!(m, :comp, :param, values)

What do you think? Sorry I don’t know the structure of your code exactly but we can keep talking this out to make sure we get a good solution.

Thanks @lrennels, approach 2 works!