mpas_tools.config.MpasConfigParser.getexpression

MpasConfigParser.getexpression(section, option, dtype=None, use_numpyfunc=False)[source]

Get an option as an expression (typically a list, though tuples and dicts are also available). The expression is required to have valid python syntax, so that string entries are required to be in single or double quotes.

Parameters:
  • section (str) – The section in the config file

  • option (str) – The option in the config file

  • dtype ({Type[bool], Type[int], Type[float], Type[list], Type[tuple], Type[str]}, optional) – If supplied, each element in a list or tuple, or each value in a dictionary are cast to this type. This is likely most useful for ensuring that all elements in a list of numbers are of type float, rather than int, when the distinction is important.

  • use_numpyfunc (bool, optional) – If True, the expression is evaluated including functionality from the numpy package (which can be referenced either as numpy or np).