How to use the xgcm.models.mitgcm.utils.parse_available_diagnostics function in xgcm

To help you get started, we’ve selected a few xgcm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xgcm / xgcm / xgcm / models / mitgcm / mds_store.py View on Github external
def _get_all_data_variables(dirname, layers):
    """"Put all the relevant data metadata into one big dictionary."""
    allvars = [state_variables]
    # add others from available_diagnostics.log
    fname = os.path.join(dirname, 'available_diagnostics.log')
    if os.path.exists(fname):
        available_diags = parse_available_diagnostics(fname, layers)
        allvars.append(available_diags)
    metadata = _concat_dicts(allvars)

    # Now add the suffix '-T' to every diagnostic. This is a somewhat hacky
    # way to increase the coverage of possible output filenames.
    # But it doesn't work in python3!!!
    extra_metadata = xr.core.pycompat.OrderedDict()
    for name, val in metadata.items():
        newname = name + '-T'
        extra_metadata[newname] = val
    metadata = _concat_dicts([metadata, extra_metadata])

    return metadata