Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search_data_catalog crashes if the result is empty #42

Closed
1 task done
RondeauG opened this issue Aug 1, 2022 · 0 comments · Fixed by #92
Closed
1 task done

search_data_catalog crashes if the result is empty #42

RondeauG opened this issue Aug 1, 2022 · 0 comments · Fixed by #92
Assignees
Labels
bug Something isn't working

Comments

@RondeauG
Copy link
Contributor

RondeauG commented Aug 1, 2022

Setup Information

  • xscen version: 0.2.3

Description

If search_data_catalog fails to find valid entries, the code crashes instead of returning a warning and/or an empty dictionary.

Steps To Reproduce

 cat = xs.extraction.search_data_catalogs(DC, variables_and_freqs={"tas": "D"}, other_search_criteria={"source": "make_it_crash"})

Will result in:

Traceback (most recent call last):
  File ".../pycharm-community-2017.3.4/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<string>", line 1, in <module>
  File ".../xscen/config.py", line 163, in _wrapper
    return func(*args, **kwargs)
  File ".../xscen/extraction.py", line 149, in search_data_catalogs
    for (sim_id,), scat in catalog.iter_unique("id"):
  File ".../xscen/catalog.py", line 198, in iter_unique
    for values in itertools.product(*map(self.unique, columns)):
  File ".../xscen/catalog.py", line 186, in unique
    raise ValueError("Catalog is empty.")
ValueError: Catalog is empty.

Additional context

No response

Contribution

  • I would be willing/able to open a Pull Request to address this bug.
@RondeauG RondeauG added the bug Something isn't working label Aug 1, 2022
@RondeauG RondeauG self-assigned this Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant