-
Notifications
You must be signed in to change notification settings - Fork 24
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
Abstract routines out of gcpy/plot.py into smaller modules within the gcpy/plot folder #263
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the initial commit of the GCPy plot modules refactoring. We have split up gcpy/plot.py into: gcpy/plot/core.py gcpy/plot/six_plot.py gcpy/plot/single_panel.py gcpy/plot/compare_single_level.py gcpy/plot/compare_zonal_mean.py Some issues remain but we just wanted to stash code here before moving on. These issues will be resolved in subsequent commits. Signed-off-by: Bob Yantosca <[email protected]>
gcpy/plot/compare_single_level.py - Break up strings across multiple lines to avoid "line-too-long" warning from Pylint - Trimmed trailing whitespace gcpy/plot/compare_zonal_mean.py - Convert target_index from numpy.int64 to int, to avoid a Pylint "Sequence index" warning. (List indices must be int but not numpy.int32 or numpy.int64) - Break up strings across multiple lines to avoid "line-too-long" warning from Pylint - Now import six_panel_subplot names from gcpy.plot.core (so no need to call core.six_panel_subplot_names). - Removed if __name__ == "__main__" block gcpy/plot/core.py - Removed unused import statement (as per Pylint) - Removed "self" from call to super().__init in MidpointLogNorm class - Removed if __name__ == "__main__" block gcpy/plot/single_panel.py - Now import normalize_colors from gcpy.plot.core (and replace the core.normalize_colors call with normalize_colors) - Removed if __name__ == "__main__" block gcpy/plot/six_plot.py - Remove unused import statements - Remove debug print statements Signed-off-by: Bob Yantosca <[email protected]>
gcpy/plot/six_plot.py - Split the computation of vmin, vmax for absdiff and ratio plots into separate functions called by compute_vmin_vmax_for_plot - Make sure that all functions return a value (to avoid an "inconsistent-return-statements" warning by Pylint - Updated comments - Trimmed trailing whitespace Signed-off-by: Bob Yantosca <[email protected]>
gcpy/benchmark_funcs.py - Now import constants individually from gcpy.constants - Import compare_single_level from gcpy.plot.compare_single_level - Import compare_zonal_mean from gcpy.plot.compare_zonal_mean - Remove unneeded "warning_format" variable gcpy/examples/diagnostics/compare_diags.py - Remove unused import for xarray - Import functions individually from gcpy.util - Import constants individually from gcpy.constants - Import compare_single_level from gcpy.plot.compare_single_level - Import compare_zonal_mean from gcpy.plot.compare_zonal_mean - Now use dataset_reader to return the proper reader - Fix exception handling gcpy/examples/plotting/plot_comparisons.py - Import compare_single_level from gcpy.plot.compare_single_level - Import compare_zonal_mean from gcpy.plot.compare_zonal_mean gcpy/examples/plotting/plot_single_panel.py - Import single_panel from gcpy.plot.single_panel gcpy/examples/timeseries/mda8_o3_timeseries - Update plot styles for Matplolib 3.7.2 gcpy/gcpy_plot_style - Removed, this is now in the plot folder gcpy/plot.py - Removed, this has now been split up to other modules in the plot folder gcpy/gcpy gcpy/gcpy.examples - Remove these extraneous files Signed-off-by: Bob Yantosca <[email protected]>
yantosca
added
category: Feature Request
New feature or request
topic: Colors and Display
Issues pertaining to color scales or other display issues
topic: Benchmark Plots and Tables
Issues pertaining to generating plots/tables from benchmark output
labels
Sep 21, 2023
gcpy/benchmark/benchmark_slurm.sh - Now activate the "gcpy_env" environment, which is the same name in the default environment.yml file (and in the documentation) Signed-off-by: Bob Yantosca <[email protected]>
gcpy/six_plot.py - In routine "colorbar_for_small_data_range", now use pos = [vmin, vmin+vrange*0.25, vmin+vrange*0.5, vmin+vrange*0.75, vmax] which should place the intermediate tickpoints symmetrically. Signed-off-by: Bob Yantosca <[email protected]>
This merge brings the feature/plot-subdir up-to-date with the dev branch (which now has the fixes for regridding that were added by PR #266). Signed-off-by: Bob Yantosca <[email protected]>
docs/environment_files/environment.yml - Add the "tk" library to the GCPy python environment YAML file Signed-off-by: Bob Yantosca <[email protected]>
lizziel
requested changes
Oct 24, 2023
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.
This looks good to merge. I just added one comment on a typo I found in a comment.
gcpy/examples/diagnostics/compare_diags.py - Fixed typo "thed" -> "the" Signed-off-by: Bob Yantosca <[email protected]>
CHANGELOG.md - Now state that the 'tk' package has been added to the docs/environment_files/environment.yml file. Signed-off-by: Bob Yantosca <[email protected]>
Also updated CHANGELOG.md to state that the |
msulprizio
approved these changes
Oct 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
category: Feature Request
New feature or request
topic: Benchmark Plots and Tables
Issues pertaining to generating plots/tables from benchmark output
topic: Colors and Display
Issues pertaining to color scales or other display issues
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR we have moved GCPy's plotting capability out of the monolithic module
gcpy/plot.py
into smaller modules in thegcpy/plot
folder. These are:gcpy/plot/core.py
: Contains common functions and definitions used by other plotting routines.gcpy/plot/single_panel.py
: Module containing thesingle_panel
routine, which creates a single-panel plot.gcpy/plot/six_plot.py
: Module containing thesix_plot
routine (which callssingle_panel
6 times to create a comparison plot), plus several helper functions that were abstracted and refactored for clarity.gcpy/plot/compare_single_level.py
: Module containing thecompare_single_level
routine (creates a 6-panel comparison plot at a single model level).gcpy/plot/compare_zonal_mean.py
: Module containing thecompare_zonal_mean
routine (creates a 6-panel comparison with zonal means).gcpy/plot/gcpy_plot_style
: Style sheet with several plot attribute settings (moved from thegcpy/
folder).gcpy/plot/colormaps/
: Folder with colormap definitions (moved fromgcpy/colormaps
).gcpy/plot/__init__.py
: Import scriptImport statements and other plot settings have now been updated accordingly in the following scripts:
gcpy/benchmark_funcs.py
gcpy/examples/diagnostics/compare_diags.py
gcpy/examples/plotting/plot_single_level.py
gcpy/examples/plotting/plot_comparisons.py
gcpy/examples/timeseries/mda8_o3_timeseries.py
The plotting code in GCPy is now much cleaner and easier to understand. Also, plotting-only functionality is now able to be abstracted from the benchmarking code.
I have confirmed that the benchmark plotting codes are able to run with these modifications.