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

ENH: Allow multiple datasets directories to be specified in YAML input #214

Open
bocklund opened this issue Oct 4, 2021 · 1 comment
Open

Comments

@bocklund
Copy link
Member

bocklund commented Oct 4, 2021

Sometimes it is useful to load datasets from different filesystem locations, for example if one folder contains hand-curated data and another contains automatically generated data.

In code, it would be pretty simple to handle this. Instead of

from espei.datasets import load_datasets, recursive_glob
directory = '/path/to/directory/'
load_datasets(recursive_glob(directory))

we could do

from itertools import chain
from espei.datasets import load_datasets, recursive_glob
directories = ['/path/to/directory_1/', '/path/to/directory_2/']
load_datasets(chain(*map(recursive_glob, directories)))
@bocklund
Copy link
Member Author

bocklund commented Jan 6, 2022

Alternatively:

from espei.datasets import load_datasets, recursive_glob
directories = ['/path/to/directory_1/', '/path/to/directory_2/']
globbed_files = sum(map(recursive_glob, directories), [])
load_datasets(globbed_files)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant