Improving open_nwp function and dev-dependency change in pyproject.toml#404
Improving open_nwp function and dev-dependency change in pyproject.toml#404Sukh-P merged 5 commits intoopenclimatefix:mainfrom
open_nwp function and dev-dependency change in pyproject.toml#404Conversation
… of optional-dependeices , hence the pip install -e .[dev] doesn't work.
…en new providers are added, and removed the if pattern along with adding Callable type annotation.
open_nwp function and dev-dependency change in pyproject.tomlopen_nwp function and dev-dependency change in pyproject.toml
… instead of optional-dependeices , hence the pip install -e .[dev] doesn't work." due to CI failures. This reverts commit a7500da.
|
I have reverted |
AUdaltsova
left a comment
There was a problem hiding this comment.
Hi, great to see you around & good spot! Really nice bit of type hinting there. Left a couple of comments but good to go otherwise I think, thanks!
Hi @AUdaltsova , Thanks for the review, I have made the necessary changes, this should be good now ! |
|
Hey both, just wanted to bring this comment/issue linked in it to your attention #379 (comment) which is related to a refactoring idea for this file and moving away from having unique loaders for each NWP since in fact for at least those in the same coord system like lat long they could be handled by a more generic loader, not saying this should block this change but maybe something to think about for the next change related to this, thanks |
|
Hi @Sukh-P, yeah I thought about that but I don't think it's being actively worked on right now/is ready to be implemented any time soon (maybe I'm wrong!), so I don't think there's any harm in this being merged in the meantime as the work is done already anyway. Lmk if you disagree! |
|
So I agree that this shouldn't block this but I think this further change which can be implemented now basically if someone has capacity to pick it up (@siddharth7113 might be hinting in your direction here ha) would probably have a larger impact in terms of simplifying and reducing lines of code |
|
Oh ok I see! @siddharth7113 would you be interested in taking up that issue? I think that would require putting in some renaming logic (different NWP sources might have different coordinate names that we rename into the same things), but then the lat-lon NWPs go through the same logic which can be shared between them, I think @Sukh-P recons 3-4 loaders can be removed after this. Let me know if you'd like to take this up! |
Hey @Sukh-P @AUdaltsova , Yeah I could work on that, I am trying to understand how |
|
Hi @siddharth7113, amazing, thanks for taking this up! Yeah maybe for cleanliness would be better to have a separate PR, and this one we would close for now as the new one should supersede it. Thanks again & reach out if you have questions! |
|
Hi @siddharth7113 I spoke to @AUdaltsova and I realised I muddied the water with my interjection and confused things, we decided that this PR can be merged in (I'll give it a quick review again after your latest changes) and then the additional changes I suggested if you're happy to work on that can be added on top of this in a separate PR, this way the PRs can be kept small, I can add you to that issue and give you more direction as well if you want it, hope that's alright, apologies all for the confusion! |
|
@siddharth7113 will merge this in and tag you on the other issue related to these loader files, thanks! |
No worries @Sukh-P , Thanks for merging this one, I 'll start working on the other issue soon ! |
Pull Request
Description
While going through the code base I found in
nwp.pythe functionopen_nwphas anif-elseblock which requires changing everytime new provider is added, I modifed logic outside of the function to update in a private dictionaries, instead of addingif-else.While installing(Reverted due to CI breaking)devdependency, I observed that these were grouped under[dependency-groups], I changed it to[project.optional-dependencies]to make theuv pip install -e .[dev]work. (If this was intentional, I can revert the changes.)Fixes #
How Has This Been Tested?
All tests passes, except one unrelated test being skipped
test_load_gfsI haven't run
blackorruffsince on runningblack, it is reformatting more than 50 files, there is no definedpre-commitIf your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?
Checklist: