-
Notifications
You must be signed in to change notification settings - Fork 124
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
fix hardcoded text elements in the plots of the forecast class #769
Conversation
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.
Looks good to me. There are two variable names still containing wind (wind_map_file_name, wind_map_file_name_full) which could also be adjusted.
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.
Looks good to me. I didn't realize the split was because of the linter. I guess the previous version would've been also good then (maybe better for some), although I personally still like the new version better.
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.
I find a lot of inconsistencies in the code of these plots. But since we want to overhaul the entire class and make it more useful until then without changing any of its "logic", I think it's fine.
Are you sure about the wordings, though? I find figure titles usually unnecessary. The default "explain text" states what I would use as a colorbar label, e.g. "Mean Wind Damage" or "Total Building Damage". There is no need to repeat this information in the title, imho.
climada/engine/test/test_forecast.py
Outdated
save_fig=False, close_fig=True) | ||
forecast.plot_exceedence_prob(run_datetime=dt.datetime(2017,12,31), | ||
threshold=5000, save_fig=False, close_fig=True) | ||
|
||
threshold=5000, explain_str='test text', |
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.
Since there is quite some fiddling with titles, it might make sense to assert if the correct figure title is set with something like
ax = forecast.plot_exceedence_prob(explain_str="Something from the title")
self.assertIn(ax.get_title(), "Something from the title")
I agree with waiting to improve the plots when we do the overhaul of the entire class. About the need of titles: as there is a lot of forecast specific information in the plot titles (actually one of the features of the class), I find using the title to quickly spot the type of plot quite useful. But luckily you don't have to agree, because from now on you can assign an empty string to the "explain text" to have no repetition of the colorbar label. |
@ThomasRoosli True! 😁 Could you have a look at my suggestions and comment/commit/adapt them at your convenience? Then we are ready to merge! |
rework text about Text in Forecast class plots Co-authored-by: Lukas Riedel <[email protected]>
Add linebreaks Co-authored-by: Lukas Riedel <[email protected]>
@peanutfun I added the suggested functionality in the tests and additionally some more asserts and structure. |
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.
Looks very good now, thanks for improving the new tests! I'll see ich the pipeline succeeds and merge afterwards
Changes proposed in this PR:
This PR fixes #
PR Author Checklist
develop
)PR Reviewer Checklist