esm_catalog_utils.case_metadata_to_esm_datastore#
- esm_catalog_utils.case_metadata_to_esm_datastore(case_metadata, exclude_dirs=['rest'], path_parser=<function parse_path_cesm>, file_parser=<function parse_file_cesm>, esm_datastore_in=None, use_dask=False)#
Generate esm_datastore object for files specified by case metadata.
- Parameters:
case_metadata (dict) –
Dictionary of case metadata. It should have the following keys and corresponding values:
”case”: name of case
”output_dirs”: list of directories containing output from case
exclude_dirs (list of str, optional) – Files in directories listed in exclude_dirs are disregarded.
path_parser (callable, optional) – Function that returns a dictionary of attributes derived from pathnames of files in output_dirs. These attributes are included in columns of the DataFrame of the returned esm_datastore.
file_parser (callable, optional) – Function that returns a dictionary of attributes derived from the contents of files in output_dirs. These attributes are included in columns of the DataFrame of the returned esm_datastore.
esm_datastore_in (esm_datastore, optional) – If provided, then return an esm_datastore object with entries appended to esm_datastore_in. The paths determined from case_metadata are checked for existence in esm_datastore_in’s DataFrame df. If the path is present in df and the file’s size differs from its size in esm_datastore_in, then the entry for that path is recreated. A ValueError is raised if df does not have an size column.
use_dask (bool, optional) – If True, the parsing of file contents is performed in parallel using
dask.delayed. Default is False.
- Return type:
esm_datastore