smartgrid.make_env.find_profile_data¶
- smartgrid.make_env.find_profile_data(dataset: str, filename: str) str [source]¶
Finds a data file from the data folder.
The
data
folder can be either:accessible through a relative path, e.g., because the source code was cloned (
./data/path/to/the/desired/file
).accessible through imports, e.g., because the package was installed.
How to access files in this folder depends on the actual case; this function (hopefully) solves this problem, by checking first whether the files are directly accessible (through relative paths). If they are not,
importlib.resources
is used to get a path to the file through the package.- Parameters:
dataset – The name of the folder containing the desired file, within the
data
folder. For example,openei
to access the OpenEI dataset. This dataset cannot be nested, e.g.,dataset/subdataset
ordataset.subdataset
will not work.filename – The name of the desired file, within the
dataset
folder.
- Returns:
A path to the desired file.