-
Notifications
You must be signed in to change notification settings - Fork 3
Description
here's a current example of ClefException:
ClefException Traceback (most recent call last)
in
1 constraints = {'v': 'tas', 'm': 'MIROC5', 'table': 'day', 'experiment': 'rcp85', 'activity': 'CMIP'}
----> 2 results = search(s, project='cmip5', **constraints)
~/.local/lib/python3.6/site-packages/clef/code.py in search(session, project, **kwargs)
40 project=project.upper()
41 valid_keys = get_keys(project)
---> 42 args = check_keys(valid_keys, kwargs)
43 vocabularies = load_vocabularies(project)
44 check_values(vocabularies, project, args)
~/.local/lib/python3.6/site-packages/clef/code.py in check_keys(valid_keys, kwargs)
208 if facet==[]:
209 raise ClefException(
--> 210 f"Warning {key} is not a valid constraint name"
211 f"Valid constraints are:\n{valid_keys.values()}")
212 else:
ClefException: Warning activity is not a valid constraint nameValid constraints are:
dict_values([['source_id', 'model', 'm'], ['realm'], ['time_frequency', 'frequency', 'f'], ['variable_id', 'variable', 'v'], ['experiment_id', 'experiment', 'e'], ['table_id', 'table', 'cmor_table', 't'], ['member_id', 'member', 'ensemble', 'en', 'mi'], ['institution_id', 'institution', 'institute'], ['experiment_family']])
The message at the bottom is quite neat but still all the error stack is shown. This might be confusing for the user who might think that's something that needs to be solved at code level, while we want this to be an exception we can handle.
It is also inconsistent we what we're still doing for the ESGF search.
For example just running clef cmip5 will show only:
Too many results 2292512, try limiting your search:
https://esgf.nci.org.au/search/esgf-nci?query=&type=File&distrib=True&replica=False&latest=True&project=CMIP5
We discussed a solution to this already, I'm not sure if it got lost in all the latest merges or if it wasn't implemented yet