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
datafolder 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.resourcesis used to get a path to the file through the package.- Parameters:
dataset – The name of the folder containing the desired file, within the
datafolder. For example,openeito access the OpenEI dataset. This dataset cannot be nested, e.g.,dataset/subdatasetordataset.subdatasetwill not work.filename – The name of the desired file, within the
datasetfolder.
- Returns:
A path to the desired file.