Issue 99 from url#101
Conversation
for more information, see https://pre-commit.ci
| >>> accessor = DataAccessor(data_source="dea_energy_storage", version="v1.0") | ||
| >>> dp = accessor.download("https://example.com/data") |
There was a problem hiding this comment.
Unclear: Does this load the version from the specified URL, or does it use the information from data_source and version somehow?
What if those two are not specified?
What if those two are specified but the URL target is a different one?
| Download and load technology data from a remote URL. | ||
|
|
||
| This method downloads technologies.json and sources.json files from the | ||
| specified base URL and loads them into a DataPackage instance. The sources.json |
There was a problem hiding this comment.
The file is also stored somewhere, right? Add where / how it is stored.
| Examples | ||
| -------- | ||
| >>> accessor = DataAccessor(data_source="dea_energy_storage", version="v1.0") | ||
| >>> dp = accessor.download("https://example.com/data") |
There was a problem hiding this comment.
Can we use a better URL for the example? e.g. just point at one of the data packages from this repository: https://raw.githubusercontent.com/open-energy-transition/technology-data/refs/heads/issue_99_from_url/src/technologydata/parsers/dea_energy_storage/v10/
| if not base_url.endswith("/"): | ||
| base_url += "/" |
There was a problem hiding this comment.
Or use urljoin :) https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urljoin
| assert dp.name == "manual_input_usa" | ||
| assert dp.version == "v0.13.4" | ||
| assert len(dp.sources) == 1 | ||
| assert len(dp.technologies) == 85 |
There was a problem hiding this comment.
For the test to work reliably, better to point to a static URL, rather than the branch's HEAD URL. Else the len(...) might change.
Closes #99
Changes proposed in this Pull Request
Checklist
doc.environment.yaml(if applicable).doc/release_notes.rstof the upcoming release is included.