Quote from: https://csdms.colorado.edu/wiki/Model:ModelParameterDictionary
The Model Parameter Dictionary is a tool for numerical modelers to easily read and access model parameters from a simple formatted input (text) file. Each parameter has a KEY, which identifies the parameter, and a VALUE, which can be a number or a string. A ModelParameterDictionary object reads model parameters from an input file to a Dictionary, and provides functions for the user to look up particular parameters by key name.
The format of the input file looks like:
PI: the text "PI" is an example of a KEY 3.1416 AVOGADROS_NUMBER: this is another 6.022e23 FAVORITE_FRUIT: yet another mangoes NUMBER_OF_MANGO_WALKS: this one is an integer 4 ALSO_LIKES_APPLES: this is a boolean true
Example code that reads these parameters from a file called "myinputs.txt":
my_param_dict = ModelParameterDictionary()
my_param_dict.read_from_file( 'myinputs.txt' )
pi = my_param_dict.read_float( 'PI' )
avogado = my_param_dict.read_float( 'AVOGADROS_NUMBER' )
fruit = my_param_dict.read_string( 'FAVORITE_FRUIT' )
nmang = my_param_dict.read_int( 'NUMBER_OF_MANGO_WALKS' )
apples_ok = my_param_dict.read_bool( 'ALSO_LIKES_APPLES' )
As in Python, hash marks (#) denote comments. The rules are that each key must have one and only one parameter value, and each value must appear on a separate line immediately below the key line.
Also available are functions to read input parameters from the command line (e.g., read_float_cmdline( 'PI' ) )