-
Notifications
You must be signed in to change notification settings - Fork 169
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
Refactoring steps-nowcast #436
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #436 +/- ##
==========================================
+ Coverage 83.89% 84.03% +0.13%
==========================================
Files 160 160
Lines 12902 13031 +129
==========================================
+ Hits 10824 10950 +126
- Misses 2078 2081 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
hi @sidekock , first of all, thanks for taking up this heroic task :-)
which part? to run the test locally you need to setup the test data correctly, see https://pysteps.readthedocs.io/en/stable/user_guide/example_data.html#example-data and https://pysteps.readthedocs.io/en/stable/developer_guide/test_pysteps.html
I agree with you, _check_inputs seems well in line with the complexity of the other methods, and feels like breaking it down into smaller pieces would somewhat overcrow your class. I silenced this issue on codacy. |
@mats-knmi @RubenImhoff Could you take a look at this and give feedback? That way I can go on to the blending version. I don't want to start working on that one if this one is not in a finalized state. |
@sidekock, I will try to do so asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sidekock, super nice work! Thanks a lot for picking up this tremendous task. I like that we use a class now, it is much cleaner this way.
I think all looks good, but I've made some suggestions to change some variable names to a longer name.
In addition, perhaps utils.nowcast_main_loop
also can use a refactor based on the refactor here. In this nowcast_main_loop
, the subtimesteps
are also used. I remember that we were discussing about this during the hackathon. Perhaps this is the time to clean that up a bit, too? I might be the most difficult/unreadable part of the code.
I agree this might be worth looking at but the thing I am a bit worried about is the that this loop is used for all nowcasters so minor changes could affect the code in a lot of different places. I was thinking to tackle the loop in the blending first (since that only affect one place) and then transfer what I learned back. Its a bit of double work but it seems easier to debug that way what works and does not work. Any feedback on the way I split up the code? |
@sidekock Should this be merged? |
I am sorry for only commenting now. I have been busy with some other stuff. I will go over the changes and leave some input where I have it. If you don't want to hold off merging, that's fine since Ruben already reviewed this. Maybe you can then take my input along in the next steps of the refactoring |
I have left my comments, let me know what you think. Again, sorry for taking so long to get back to you. Overall the code looks much more manageable now, compared to what it looked like before. |
Let me use the feedback of Mats. I will contact you once it is ready to be merged. |
… and found some first declartions in the code that where not in the init
…recast runs in a row
@mats-knmi could you look through the changes to give some feedback? I will look at the 'private' variables next week if I have time. In general, I think this approach is much cleaner compared to what we had before. We see what is changed and what type it is (state or param) and what is loaded (config, state or param) for each method. For the 'private' discussion, I have taken a small look at the StackOverflow page but do not yet see how I would use this at this moment. Most variables in the code are part of a dataclass so can I still make then private then? |
Co-authored-by: mats-knmi <145579783+mats-knmi@users.noreply.github.com>
Looks good, I added 2 small comments on the type hinting, but other than that I think this makes it a lot nicer indeed. Regarding the private discussion: |
Thanks for all the feedback @mats-knmi and @RubenImhoff. The new version of the code feels much more readable now! I made the last changes and will soon start on the real challenge: the blending code :) |
@dnerini the Static code analysis is complaining again because I changed the name of the method "__check_inputs". Would it be possible to disable this once more? That way, all tests should pass now |
@sidekock I resolved all my comments that are fully resolved now, I left 2 open, since those are not fully resolved yet. I think the docstring comment is important to still address, but the one about passing |
The new naming is now applied and the documentation is provided. |
@mats-knmi if all the requested changes are present, would you please approve the changes? Then I know I can start working on the blending part after the merge |
Yes they are approved. |
@dnerini I think this is ready to be merged with the master branch |
Fantastic work! 🙌 |
I started with the steps nowcast because that seemed more straightforward to tackle first. Since both methods should look alike, they must both be changed. I can't figure out how to run the test locally, so I will have to wait and see what the pull request test gives me as feedback.
This is a first suggestion how to split up the code but look forward to suggestions and improvments