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

Local file cache #696

Merged
merged 9 commits into from
Sep 14, 2022
Merged

Conversation

Rlamboll
Copy link
Collaborator

Done to resolve #681

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Adding to RELEASE_NOTES.md (remove section after adding to RELEASE_NOTES.md)

Please add a single line in the release notes similar to the following:

- (#XX)[http://link-to-pr.com] Added feature which does something

Description of PR

Please describe the changes introduced by this PR.

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #696 (4acc5dd) into main (4bd16a9) will increase coverage by 0.0%.
The diff coverage is 97.8%.

@@          Coverage Diff          @@
##            main    #696   +/-   ##
=====================================
  Coverage   94.8%   94.9%           
=====================================
  Files         58      58           
  Lines       5856    5900   +44     
=====================================
+ Hits        5557    5600   +43     
- Misses       299     300    +1     
Impacted Files Coverage Δ
pyam/iiasa.py 86.8% <95.6%> (+0.7%) ⬆️
pyam/__init__.py 67.5% <100.0%> (ø)
tests/test_iiasa.py 97.8% <100.0%> (+0.2%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Rlamboll!

I'm worried about two issues:

  1. By accepting only csv files for the local copy, you loose all meta indicators, which can be very relevant
  2. The query is not actually stored, so if you do (as you do in the test
    df = lazy_read_iiasa("some/file.csv", TEST_API, model="model_a")
    and then
    df = lazy_read_iiasa("some/file.csv", TEST_API, model="model_b")
    you will get a different result for the second call depending on whether any data changed in the database in the meantime.

pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
tests/test_iiasa.py Outdated Show resolved Hide resolved
pyam/iiasa.py Show resolved Hide resolved
pyam/iiasa.py Outdated Show resolved Hide resolved
@Rlamboll
Copy link
Collaborator Author

Rlamboll commented Sep 1, 2022

I've enabled it to read xls(x) files, but I don't think it's possible to do proper checks that the filters are applied in only a more restrictive sense without spending a significant period of time querying the database, which is what we're trying to avoid in the first place. I've expanded the documentation to make it clear that it's on the user to look out for this. This is consistent with how the code is currently used.

Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% convinced about this new feature because there might be confusion when a user queries for different filters than what is stored in the local cache. I'll approve, merge, and then create an issue for future improvements.

@danielhuppmann danielhuppmann merged commit d7d9b45 into IAMconsortium:main Sep 14, 2022
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

Successfully merging this pull request may close these issues.

Easy-to-use data download tools
2 participants