Closed wrongkindofdoctor closed 2 months ago
@wrongkindofdoctor - can you try passing it as a list? Sorry for the delayed response here.
ex.
for case_name, case_d in case_dict.items():
path_regex = re.compile(r'({})'.format(case_name)). # Search for the case_name group in the path entries
freq = case_d.varlist.T.frequency
for v in case_d.varlist.iter_vars():
cat_subset = cat.search(activity_id=case_d.convention,
standard_name=v.standard_name,
frequency=freq,
realm=v.realm,
path=[path_regex]
)
@mgrover1 sorry for the late response. I just got around to testing passing the re.compile
object as a list to cat.search
, and this resolves the issue. Thanks for your help!
Here's a quick checklist in what to include:
intake_esm.show_versions()
[x] Minimal, self-contained copy-pastable example that generates the issue if possible. Please be concise with code posted. See guidelines below on how to provide a good bug report:
Description
I am trying to pass a python
re.compile
object for one of the column entries in an intake catalog search following the example in the code comments. However, the search method expects values to be iterables in thequery
dict, and throws an error when trying to resolve the re.compile object.What I Did
The path_regex object passed to catalog
_search.search
method:path_regex has the following attributes:
Thus,
values.pattern
seems like it is what the search method should be using in thefor value in values
loop ifvalues
is an re.compile object Stack traceVersion information: output of
intake_esm.show_versions()