credit.preblock._utils

credit.preblock._utils#

Functions#

_parse_variable_selection(→ list)

The goal of this function is to expand partial variables in variable_list based on the keys in state_dict.

Module Contents#

credit.preblock._utils._parse_variable_selection(variable_list: list, state_dict: dict, data_types: list = None) list#

The goal of this function is to expand partial variables in variable_list based on the keys in state_dict. For example, if variable_list contains “ERA5/prognostic/3d”, then this function should expand that partial name to include every variable in state_dict that has the matching partial name.

Parameters:
  • variable_list (list) – A list of partial or full variable names. An empty list means that all variables should be used.

  • state_dict (dict) – A dictionary of the data state following the CREDIT convention, nested as

  • types (state_dict[data_type][source][var_name]. The data)

  • key (highest level)

  • source (then the)

  • "era5/prognostic/3d/temperature"). ((e.g.)

  • data_types (list) – A list of data types to include. If None, all data types will be included.

Returns:

The full variable names from state_dict matched by variable_list, with duplicates removed and order preserved.

Return type:

list