You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The keys returned by catalog.keys() point to unique datasets in an intake-esm catalog (if queries are constructed using only the catalog.groupby_attrs). I have found it useful in some circumstances to get the values of the fields used to construct the keys; rather than a parsing the key string itself, I think this merits a method and wonder whether this should be part of intake-esm.
Here's a prototype implementation of such a method.
defget_keys_info(cat):
"""return a dictionary with the values of components of the keys in an intake catalog Example: key_info = { "20C.ocn.pop.h.1": { "experiment": "20C", "component": "ocn", "stream": "pop.h", "member_id": 1, }, } """# generate a list of lists with all possible values of each groupby_attr# this is already being done in intake-esmiterables= [cat.unique(columns=key)[key]['values'] forkeyincat.groupby_attrs]
# generate a dictionary of keys with the values of its attributeskey_info= {}
forvaluesinproduct(*iterables):
key=cat.sep.join([str(v) forvinvalues])
ifkeyincat.keys():
key_info[key] = {k: values[i] fori, kinenumerate(cat.groupby_attrs)}
returnkey_info
The text was updated successfully, but these errors were encountered:
The keys returned by
catalog.keys()
point to unique datasets in an intake-esm catalog (if queries are constructed using only thecatalog.groupby_attrs
). I have found it useful in some circumstances to get the values of the fields used to construct the keys; rather than a parsing the key string itself, I think this merits a method and wonder whether this should be part of intake-esm.Here's a prototype implementation of such a method.
The text was updated successfully, but these errors were encountered: