From ed7d180451d1b76da3f6fd6e1740f9bcc725b980 Mon Sep 17 00:00:00 2001 From: Julie Prestopnik Date: Mon, 9 Jun 2025 10:33:28 -0600 Subject: [PATCH 01/50] Feature METplus2857 main v3.1 support (#512) * Making index consistent with other METplus repositories * Initial commit of overview --- docs/Users_Guide/index.rst | 3 +- docs/Users_Guide/overview.rst | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 docs/Users_Guide/overview.rst diff --git a/docs/Users_Guide/index.rst b/docs/Users_Guide/index.rst index 1cc0cbf92..9b2730acf 100644 --- a/docs/Users_Guide/index.rst +++ b/docs/Users_Guide/index.rst @@ -65,6 +65,8 @@ Atmospheric Research (NCAR), sponsored by National Science Foundation. :titlesonly: :numbered: 4 + overview + release-notes installation line box @@ -94,7 +96,6 @@ Atmospheric Research (NCAR), sponsored by National Science Foundation. fv3_physics tcmpr_plots scatter - release-notes references diff --git a/docs/Users_Guide/overview.rst b/docs/Users_Guide/overview.rst new file mode 100644 index 000000000..0365ac52e --- /dev/null +++ b/docs/Users_Guide/overview.rst @@ -0,0 +1,55 @@ +******** +Overview +******** + +Purpose and Organization of the User's Guide +============================================ + +The goal of this User’s Guide is to provide basic information for users of +METplotpy. METplotpy is a Python-based plotting library designed to generate +a wide range of diagnostic and verification visualizations. It helps users +interpret verification statistics through meaningful plots, making it easier +to evaluate forecast performance and model behavior. + +The METplotpy User's Guide is organized as follows. An overview of METplotpy +can be found below. The guide also includes information about how to create +a variety of plots and diagrams including, for example but not limited to, +box plots, bar plots, performance diagrams, reliability diagrams, and more. + +The Developmental Testbed Center (DTC) +====================================== + +METplotpy has been developed, and will be maintained and enhanced, by the +Developmental Testbed Center (DTC; http://www.dtcenter.org/ ). +The main goal of the DTC is to serve as a bridge between operations and +research, to facilitate the activities of these two important components of +the numerical weather prediction (NWP) community. The DTC provides an +environment that is functionally equivalent to the operational environment +in which the research community can test model enhancements; the operational +community benefits from DTC testing and evaluation of models before new models +are implemented operationally. METplotpy serves both the research and +operational communities in this way - offering capabilities for researchers +to test their own enhancements to models and providing a capability for +the DTC to evaluate the strengths and weaknesses of advances in NWP +prior to operational implementation. + +METplotpy will also be available to DTC visitors and to the modeling community +for testing and evaluation of new model capabilities, applications in new +environments, and so on. + +Future Development Plans +======================== + +METplotpy is an evolving software package. New capabilities are planned in +controlled, successive version releases. Bug fixes and user-identified +problems will be addressed as they are found. Plans are also in place to +incorporate new capabilities and options in future releases of METplotpy. + +User Support +============ + +METplotpy is one component of the larger METplus system for which user support +is provided through the +`METplus GitHub Discussions Forum `_, +as described in the +`METplus User's Guide `_. From 69c28d14f43295987a6a3b1f4b395da2db6c4360 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Mon, 9 Jun 2025 10:59:24 -0600 Subject: [PATCH 02/50] Per #515, remove deprecated import (#516) --- .../contributed/stratosphere_diagnostics/stratosphere_plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py b/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py index d95099c3c..d6da90892 100644 --- a/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py +++ b/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py @@ -109,7 +109,7 @@ def plot_qbo_phase_circuits(inits,periods,rean_qbo_pcs,rfcst_qbo_pcs,outfile): def plot_qbo_phase_space(rean_qbo_pcs,eofs,ptitle,outfile): - from mpl_toolkits.axes_grid1.inset_locator import (inset_axes, InsetPosition, mark_inset) + from mpl_toolkits.axes_grid1.inset_locator import (inset_axes, mark_inset) fig = plt.figure(4) From 6239d5a43f6de3ec631bbae0652355078ede87d5 Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Fri, 27 Jun 2025 14:53:41 -0600 Subject: [PATCH 03/50] Update base_plot.py comment out the pio.kaleido.scope line, this is now causing tests to fail due to kaleido warning for deprecations in September 2025 --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 4897c0f0e..27d68a74b 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -28,7 +28,7 @@ from metplotpy.plots.context_filter import ContextFilter # set kaleido to use single process to prevent GPU errors in containers -pio.kaleido.scope.chromium_args += ("--single-process",) +# pio.kaleido.scope.chromium_args += ("--single-process",) class BasePlot: """A class that provides methods for building Plotly plot's common features From 4dedb9f90e544f83f1b6bff2940ee1d7f759ee55 Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Fri, 27 Jun 2025 17:31:05 -0600 Subject: [PATCH 04/50] Update base_plot.py backing out the latest from pio.kaleido line. WARNING: GHA tests may fail due to upcoming deprecation and warnings that emanate due to Python 3.12 still features that will be deprecated. --- metplotpy/plots/base_plot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 27d68a74b..e1001edbc 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -28,7 +28,8 @@ from metplotpy.plots.context_filter import ContextFilter # set kaleido to use single process to prevent GPU errors in containers -# pio.kaleido.scope.chromium_args += ("--single-process",) +# NOTE: this may result in GHA tests failing due to impending deprecations in kaleido +pio.kaleido.scope.chromium_args += ("--single-process",) class BasePlot: """A class that provides methods for building Plotly plot's common features From 0b165a254d0465342ac5a465f62b0377c3d278a1 Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Fri, 27 Jun 2025 18:20:43 -0600 Subject: [PATCH 05/50] Update test_scatter.py Tests pass outside of GHA. Something in GHA is causing issues with Python 3.12 and kaleido (causes AssertionError in kaleido) --- test/scatter/test_scatter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/scatter/test_scatter.py b/test/scatter/test_scatter.py index aee0593f4..e232dd3d9 100644 --- a/test/scatter/test_scatter.py +++ b/test/scatter/test_scatter.py @@ -23,6 +23,7 @@ def read_config(config_filename) -> dict: return parms except yaml.YAMLError as exc: print(exc) +@pytest.mark.skip("Skipping until GHA issue with Python 3.12 and kaleido are resolved") def test_files_exist(): """ Generate a scatter plot from reformatted MPR Usecase data and From e272a1e935323f84a9d1f2ac06965d63c25296d2 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 30 Jun 2025 07:47:01 -0600 Subject: [PATCH 06/50] Remove soon to be deprecated call to plotly.io.kaleido.scope --- metplotpy/plots/base_plot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index e1001edbc..0a7e139d7 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -29,7 +29,10 @@ # set kaleido to use single process to prevent GPU errors in containers # NOTE: this may result in GHA tests failing due to impending deprecations in kaleido -pio.kaleido.scope.chromium_args += ("--single-process",) + +# kaleido.scope will be deprecated after September 2025 +# using plotly.io.defaults.* instead is recommended, but there is no way to add chromium args in this package. +#pio.kaleido.scope.chromium_args += ("--single-process",) class BasePlot: """A class that provides methods for building Plotly plot's common features From 6a0e26285771106b4cd066cf2222bc9cf4bdc228 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 30 Jun 2025 11:41:31 -0600 Subject: [PATCH 07/50] Comment out soon-to-be deprecated call to plolty.io.kaleido.scope --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 0a7e139d7..a85bcf461 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -31,7 +31,7 @@ # NOTE: this may result in GHA tests failing due to impending deprecations in kaleido # kaleido.scope will be deprecated after September 2025 -# using plotly.io.defaults.* instead is recommended, but there is no way to add chromium args in this package. +# using plotly.io.defaults.* is recommended, but there is no way to add chromium args in this package. #pio.kaleido.scope.chromium_args += ("--single-process",) class BasePlot: From ea2f281831122abbf0c730b5f1964d397c358c16 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 08:44:19 -0600 Subject: [PATCH 08/50] add call to install chrome --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index a85bcf461..03bc84e80 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -33,7 +33,7 @@ # kaleido.scope will be deprecated after September 2025 # using plotly.io.defaults.* is recommended, but there is no way to add chromium args in this package. #pio.kaleido.scope.chromium_args += ("--single-process",) - +pio.install_chrome() class BasePlot: """A class that provides methods for building Plotly plot's common features like title, axis, legend. From 9cbe7cb230858e956b1bebb8a0a699fa3a6a6bbb Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 08:45:23 -0600 Subject: [PATCH 09/50] Add test_* to trigger and setup test to use test_requirements.txt --- .github/workflows/unit_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 514f051a6..2a971058d 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -11,6 +11,7 @@ on: - feature_* - main_* - bugfix_* + - test_* paths-ignore: - 'docs/**' - '.github/pull_request_template.md' @@ -48,7 +49,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi # Checking the branch name, not necessary but useful when setting things up. From d62311664da3648461b7e75a9ff4a7e9a5e59897 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 08:46:03 -0600 Subject: [PATCH 10/50] To test plotly/kaleido updates --- test_requirements.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test_requirements.txt diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 000000000..443427f44 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,16 @@ +Cartopy==0.24.0 +matplotlib==3.10.3 +metcalcpy==2.1 +metpy==1.7.0 +netcdf4==1.7.2 +numpy==2.3.1 +pandas==2.3.0 +Pillow==11.3.0 +plotly==6.1.1 +pyproj==3.7.1 +pyresample==1.34.2 +PyYAML==6.0.2 +PyYAML==6.0.2 +scipy==1.16.0 +setuptools==80.9.0 +xarray==2025.6.1 From 0b6f185c3180a14a96b80ca19297bdf9edc8161f Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:25:09 -0600 Subject: [PATCH 11/50] Try using kaleido_get_chrome_sync --- metplotpy/plots/base_plot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 03bc84e80..fca03e877 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -33,7 +33,14 @@ # kaleido.scope will be deprecated after September 2025 # using plotly.io.defaults.* is recommended, but there is no way to add chromium args in this package. #pio.kaleido.scope.chromium_args += ("--single-process",) -pio.install_chrome() + +# this does not work +#pio.install_chrome() + +import kaleido +kaleido.get_chrome_sync() + + class BasePlot: """A class that provides methods for building Plotly plot's common features like title, axis, legend. From dd03b3fae1dd65d750fdef51819e1c2033754790 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:30:23 -0600 Subject: [PATCH 12/50] Update import to use ploty.io._kaleido --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index fca03e877..1a9af6804 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -37,7 +37,7 @@ # this does not work #pio.install_chrome() -import kaleido +from plotly.io import _kaleido as kaleido kaleido.get_chrome_sync() From 2422aa8bc256cdf2836f5fa59941352297f68656 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:37:26 -0600 Subject: [PATCH 13/50] Using latest import, invoke the get_chrome() method instead of get_chrome_sync() --- metplotpy/plots/base_plot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 1a9af6804..099bcde9e 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -38,7 +38,8 @@ #pio.install_chrome() from plotly.io import _kaleido as kaleido -kaleido.get_chrome_sync() +#kaleido.get_chrome_sync() +kaleido.get_chrome() class BasePlot: From 183315995c9f323a1efcd5fd33794cfe43b341db Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:53:00 -0600 Subject: [PATCH 14/50] explicitly pip install kaleido 1.0 --- .github/workflows/unit_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 2a971058d..5d523831b 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -50,6 +50,7 @@ jobs: run: | python -m pip install --upgrade pip if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi + pip install --upgrade kaleido # Checking the branch name, not necessary but useful when setting things up. From 96d33fa8b3e56b8e66aae52932cfa71a4a07ad4f Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:57:51 -0600 Subject: [PATCH 15/50] Add Google Chrome action --- .github/workflows/unit_tests.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 5d523831b..c692971ad 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -52,6 +52,9 @@ jobs: if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi pip install --upgrade kaleido + - name: Install Google Chrome for Plotly + - uses: browser-actions/setup-chrome@v1 + - run: chrome --version # Checking the branch name, not necessary but useful when setting things up. # - name: Extract branch name From 0a37fce9c55a2a42ef3056996a5780e678713ea4 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 09:59:29 -0600 Subject: [PATCH 16/50] fix syntax error --- .github/workflows/unit_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index c692971ad..4ff88b09e 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -52,8 +52,8 @@ jobs: if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi pip install --upgrade kaleido + - uses: browser-actions/setup-chrome@v1 - name: Install Google Chrome for Plotly - - uses: browser-actions/setup-chrome@v1 - run: chrome --version # Checking the branch name, not necessary but useful when setting things up. From fec296140d7969ac5fd9b55f2a3d54b708de610c Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 10:02:49 -0600 Subject: [PATCH 17/50] remove - from the run command --- .github/workflows/unit_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 4ff88b09e..097c558ce 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -54,7 +54,7 @@ jobs: - uses: browser-actions/setup-chrome@v1 - name: Install Google Chrome for Plotly - - run: chrome --version + run: chrome --version # Checking the branch name, not necessary but useful when setting things up. # - name: Extract branch name From e00bfffcfeb263fae71d023acd92e763273cf14a Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 11:29:58 -0600 Subject: [PATCH 18/50] Explicitly get the Chrome environment, bypass the calls to plotly.io.kaleido for installing chrome, which already exists --- metplotpy/plots/base_plot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 099bcde9e..6b615dbf7 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -38,8 +38,7 @@ #pio.install_chrome() from plotly.io import _kaleido as kaleido -#kaleido.get_chrome_sync() -kaleido.get_chrome() +os.environ['CHROME_INSTALL'] class BasePlot: From 141ec5e7bfcaaf09564d68a7924ef41df3a3e2b0 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 11:31:05 -0600 Subject: [PATCH 19/50] Set up a CHROME_INSTALL path and save it as an environment --- .github/workflows/unit_tests.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 097c558ce..628b006fc 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -22,6 +22,8 @@ on: pull_request: types: [opened, reopened, synchronize] + + jobs: build: @@ -52,10 +54,17 @@ jobs: if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi pip install --upgrade kaleido + - uses: browser-actions/setup-chrome@v1 - name: Install Google Chrome for Plotly - run: chrome --version - + run: | + chrome --version + #${{ steps.setup-chrome.outputs.chrome-path }} --version + no-sudo + env: + CHROME_INSTALL: ${{ steps.setup-chrome.outputs.chrome-path }} --version + + # Checking the branch name, not necessary but useful when setting things up. # - name: Extract branch name # shell: bash From 077517d85422c3d4e11813ad421cd68a8c045455 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 11:33:33 -0600 Subject: [PATCH 20/50] remove no-sudo --- .github/workflows/unit_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 628b006fc..28911e57a 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -60,9 +60,9 @@ jobs: run: | chrome --version #${{ steps.setup-chrome.outputs.chrome-path }} --version - no-sudo env: CHROME_INSTALL: ${{ steps.setup-chrome.outputs.chrome-path }} --version + # Checking the branch name, not necessary but useful when setting things up. From 6119238885ebfd8783b3acd48fb58e9051b7d1ab Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 11:34:26 -0600 Subject: [PATCH 21/50] removed extra line at top of file --- .github/workflows/unit_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 28911e57a..c4e7d233a 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -1,6 +1,5 @@ # This workflow will install Python dependencies, run tests the specified Python version # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python 3.12 tests on: From c49572bc0dc3f561d40897b9b5a1714e7ef55ff5 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 11:35:27 -0600 Subject: [PATCH 22/50] move env definition by indenting --- .github/workflows/unit_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index c4e7d233a..4a2aff212 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -59,8 +59,8 @@ jobs: run: | chrome --version #${{ steps.setup-chrome.outputs.chrome-path }} --version - env: - CHROME_INSTALL: ${{ steps.setup-chrome.outputs.chrome-path }} --version + env: + CHROME_INSTALL: ${{ steps.setup-chrome.outputs.chrome-path }} --version From ceab0dc7b28c94ddad332c04d027de94fcac0d3a Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 13:00:42 -0600 Subject: [PATCH 23/50] Removed all imports that didn't work and the soon to be deprecated reference to kaleido.scope. Running after installing Chrome without setting an ENV variable. --- metplotpy/plots/base_plot.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 6b615dbf7..4db7ad98e 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -34,11 +34,6 @@ # using plotly.io.defaults.* is recommended, but there is no way to add chromium args in this package. #pio.kaleido.scope.chromium_args += ("--single-process",) -# this does not work -#pio.install_chrome() - -from plotly.io import _kaleido as kaleido -os.environ['CHROME_INSTALL'] class BasePlot: From 659ffae868a7c56224c66d51378b93801d6c4f2a Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 13:02:13 -0600 Subject: [PATCH 24/50] Remove any attempt to set an env --- .github/workflows/unit_tests.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 4a2aff212..87672e045 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -58,9 +58,7 @@ jobs: - name: Install Google Chrome for Plotly run: | chrome --version - #${{ steps.setup-chrome.outputs.chrome-path }} --version - env: - CHROME_INSTALL: ${{ steps.setup-chrome.outputs.chrome-path }} --version + ${{ steps.setup-chrome.outputs.chrome-path }} --version From 71c7df87c5296fd295d8a4803a7550e0396d946e Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 13:04:05 -0600 Subject: [PATCH 25/50] Remove the --version to the path under the chrome installation --- .github/workflows/unit_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 87672e045..a030e2ada 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -58,7 +58,7 @@ jobs: - name: Install Google Chrome for Plotly run: | chrome --version - ${{ steps.setup-chrome.outputs.chrome-path }} --version + ${{ steps.setup-chrome.outputs.chrome-path }} From 89f1ff6fcce604300dd360220bdca5f81413870f Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 1 Jul 2025 13:06:51 -0600 Subject: [PATCH 26/50] Remove skip --- test/scatter/test_scatter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/scatter/test_scatter.py b/test/scatter/test_scatter.py index e232dd3d9..aee0593f4 100644 --- a/test/scatter/test_scatter.py +++ b/test/scatter/test_scatter.py @@ -23,7 +23,6 @@ def read_config(config_filename) -> dict: return parms except yaml.YAMLError as exc: print(exc) -@pytest.mark.skip("Skipping until GHA issue with Python 3.12 and kaleido are resolved") def test_files_exist(): """ Generate a scatter plot from reformatted MPR Usecase data and From fb2ec739577c59e2a0f86b06263b67bfc73ffa8e Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Tue, 1 Jul 2025 14:00:56 -0600 Subject: [PATCH 27/50] Update test_requirements.txt match up with requirements.txt except for kaleido and plotly --- test_requirements.txt | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/test_requirements.txt b/test_requirements.txt index 443427f44..eeb792d5f 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,16 +1,21 @@ -Cartopy==0.24.0 -matplotlib==3.10.3 -metcalcpy==2.1 -metpy==1.7.0 -netcdf4==1.7.2 -numpy==2.3.1 -pandas==2.3.0 -Pillow==11.3.0 -plotly==6.1.1 -pyproj==3.7.1 -pyresample==1.34.2 -PyYAML==6.0.2 -PyYAML==6.0.2 -scipy==1.16.0 -setuptools==80.9.0 -xarray==2025.6.1 + +imageio>=2.37.0 +imutils>=0.5.4 +kaleido>=1.0.0 +matplotlib>=3.10.0 +metpy>=1.6.3 +netcdf4>=1.7.2 +numpy>=2.2.2 +opencv-python>=4.10.0 +pandas>=2.2.3 +pint>=0.24.4 +plotly>=6.1.1 +pytest>=8.3.4 +pyyaml>=6.0.2 +scikit-image>=0.25.1 +scipy>=1.15.1 +xarray>=2025.1.2 +eofs>=2.0.0 +cartopy>=0.24.0 +scikit-learn>=1.6.1 +cmocean>=4.0.3 From 41791d4cec0087b4b7a3afef39c25b59caa67f83 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Thu, 3 Jul 2025 07:58:25 -0600 Subject: [PATCH 28/50] Attempt to get chrome via kaleido.get_chrome_sync() --- metplotpy/plots/base_plot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 0a7e139d7..43f515fcf 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -31,8 +31,12 @@ # NOTE: this may result in GHA tests failing due to impending deprecations in kaleido # kaleido.scope will be deprecated after September 2025 -# using plotly.io.defaults.* instead is recommended, but there is no way to add chromium args in this package. -#pio.kaleido.scope.chromium_args += ("--single-process",) +# using plotly.io.defaults.* instead is recommended, but there is no way to add chromium args in this package +# because Chrome is being used from now on. +# pio.kaleido.scope.chromium_args += ("--single-process",) +# pio.install_chrome() +import kaleido +kaleido.get_chrome_sync() class BasePlot: """A class that provides methods for building Plotly plot's common features From afb2d387d329e18c644672e586e88fce66eb3d9e Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:48:03 -0600 Subject: [PATCH 29/50] Update unit_tests.yaml Comment out installation of Chrome for now but don't delete it in the event that Chrome will need to be explicitly available. --- .github/workflows/unit_tests.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index a030e2ada..c040725a4 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -54,11 +54,11 @@ jobs: pip install --upgrade kaleido - - uses: browser-actions/setup-chrome@v1 - - name: Install Google Chrome for Plotly - run: | - chrome --version - ${{ steps.setup-chrome.outputs.chrome-path }} +# - uses: browser-actions/setup-chrome@v1 +# - name: Install Google Chrome for Plotly +# run: | +# chrome --version +# ${{ steps.setup-chrome.outputs.chrome-path }} From 9a32b75ce16a62027a6d854384ed49c24f4c5cdd Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:50:36 -0600 Subject: [PATCH 30/50] Update base_plot.py Remove old comment and update to reflect upcoming changes to kaleido --- metplotpy/plots/base_plot.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 3c6dfa95a..9b35d5102 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -27,11 +27,8 @@ from .config import Config from metplotpy.plots.context_filter import ContextFilter -# set kaleido to use single process to prevent GPU errors in containers -# NOTE: this may result in GHA tests failing due to impending deprecations in kaleido - -# kaleido.scope will be deprecated after September 2025 - +# kaleido 0.x will be deprecated after September 2025 and Chrome will no longer +# be included with kaleido from version 1.0.0. Explicitly get Chrome via call to kaleido. import kaleido kaleido.get_chrome_sync() From e080cc251967cbd7ddf7ba1133b52bbd73cdf572 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Thu, 3 Jul 2025 14:18:17 -0600 Subject: [PATCH 31/50] Replace test_requirements.txt with requirements.txt --- .github/workflows/unit_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index c040725a4..702a7ec89 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -50,7 +50,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install --upgrade kaleido From 18691548eef72f64d5fa82436b3b092cccf38f12 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Thu, 3 Jul 2025 14:19:30 -0600 Subject: [PATCH 32/50] Update Plotly from 6.0.0 to 6.1.1 and kaleido from 0.2.1 to 1.0.0 --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3aafb80e6..eeb792d5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ + imageio>=2.37.0 imutils>=0.5.4 -kaleido>=0.2.1 +kaleido>=1.0.0 matplotlib>=3.10.0 metpy>=1.6.3 netcdf4>=1.7.2 @@ -8,7 +9,7 @@ numpy>=2.2.2 opencv-python>=4.10.0 pandas>=2.2.3 pint>=0.24.4 -plotly>=6.0.0 +plotly>=6.1.1 pytest>=8.3.4 pyyaml>=6.0.2 scikit-image>=0.25.1 @@ -18,4 +19,3 @@ eofs>=2.0.0 cartopy>=0.24.0 scikit-learn>=1.6.1 cmocean>=4.0.3 - From 3998c648270a1d6e1943af35430fb2e47cabbcfd Mon Sep 17 00:00:00 2001 From: jprestop Date: Mon, 7 Jul 2025 14:55:04 -0600 Subject: [PATCH 33/50] Adding modulefile for new machine ursa --- .../installation/modulefiles/3.1.0_ursa | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/scripts/installation/modulefiles/3.1.0_ursa diff --git a/internal/scripts/installation/modulefiles/3.1.0_ursa b/internal/scripts/installation/modulefiles/3.1.0_ursa new file mode 100644 index 000000000..9ffb356e9 --- /dev/null +++ b/internal/scripts/installation/modulefiles/3.1.0_ursa @@ -0,0 +1,25 @@ +#%Module###################################################################### +## +## METplotpy +## +proc ModulesHelp { } { + puts stderr "Sets up the paths and environment variables to use the METplotpy-3.1.0. + *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" +} + +prereq intel-oneapi-compilers/2025.1.1 + +setenv METPLOTPY_SOURCE /contrib/METplotpy/METplotpy-3.1.0 +setenv METPLOTPY_BASE /contrib/METplotpy/METplotpy-3.1.0 + +prepend-path PATH /scratch3/BMC/dtc/METplus/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin +prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/contributed +prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots/performance_diagram +prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots +prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy +prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0 +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/contributed +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots/performance_diagram +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.1.0 From e2e52b7f94aa39f6bc679b06c7b3b232c26d07cc Mon Sep 17 00:00:00 2001 From: MWin <3753118+bikegeek@users.noreply.github.com> Date: Tue, 8 Jul 2025 08:02:57 -0600 Subject: [PATCH 34/50] Feature 525 update plotly kaleido (#526) * Update conf.py update version for 3.20 beta1 development * Feature 504 installation files (#511) * Update Orion file for Python 3.12 * Per #504, updating Casper file for Python 3.12 * Per # 504, updating compiler for Orion * Per #504, updating hera file for Python 3.12 * Per #504, updating jet file for Python 3.12 * Feature METplus2857 support (#513) * Making index consistent with other METplus repositories * Initial commit of overview * Bugfix #515 develop - remove deprecated import (#517) * Per #515, remove deprecated import * remove additional unused import to resolve SQ * Update base_plot.py Comment out pio.kaleido.scope.chromium line. Python 3.12 updates with updated deprecations in kaleido will cause some tests to fail due to these warnings. * Remove soon to be deprecated call to plotly.io.kaleido.scope * Comment out soon-to-be deprecated call to plolty.io.kaleido.scope * add call to install chrome * Add test_* to trigger and setup test to use test_requirements.txt * To test plotly/kaleido updates * Try using kaleido_get_chrome_sync * Update import to use ploty.io._kaleido * Using latest import, invoke the get_chrome() method instead of get_chrome_sync() * explicitly pip install kaleido 1.0 * Add Google Chrome action * fix syntax error * remove - from the run command * Explicitly get the Chrome environment, bypass the calls to plotly.io.kaleido for installing chrome, which already exists * Set up a CHROME_INSTALL path and save it as an environment * remove no-sudo * removed extra line at top of file * move env definition by indenting * Removed all imports that didn't work and the soon to be deprecated reference to kaleido.scope. Running after installing Chrome without setting an ENV variable. * Remove any attempt to set an env * Remove the --version to the path under the chrome installation * Remove skip * Update test_requirements.txt match up with requirements.txt except for kaleido and plotly * Attempt to get chrome via kaleido.get_chrome_sync() * Update unit_tests.yaml Comment out installation of Chrome for now but don't delete it in the event that Chrome will need to be explicitly available. * Update base_plot.py Remove old comment and update to reflect upcoming changes to kaleido * Replace test_requirements.txt with requirements.txt * Update Plotly from 6.0.0 to 6.1.1 and kaleido from 0.2.1 to 1.0.0 * Adding modulefile for new machine ursa --------- Co-authored-by: Julie Prestopnik Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com> --- .github/workflows/unit_tests.yaml | 15 +++++++++-- docs/conf.py | 2 +- .../installation/modulefiles/3.1.0_casper | 2 +- .../installation/modulefiles/3.1.0_hera | 2 +- .../installation/modulefiles/3.1.0_jet | 2 +- .../installation/modulefiles/3.1.0_orion | 4 +-- .../installation/modulefiles/3.2.0_ursa | 25 +++++++++++++++++++ .../stratosphere_plots.py | 4 ++- metplotpy/plots/base_plot.py | 8 +++--- requirements.txt | 6 ++--- test/scatter/test_scatter.py | 1 - test_requirements.txt | 21 ++++++++++++++++ 12 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 internal/scripts/installation/modulefiles/3.2.0_ursa create mode 100644 test_requirements.txt diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 514f051a6..702a7ec89 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -1,6 +1,5 @@ # This workflow will install Python dependencies, run tests the specified Python version # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python 3.12 tests on: @@ -11,6 +10,7 @@ on: - feature_* - main_* - bugfix_* + - test_* paths-ignore: - 'docs/**' - '.github/pull_request_template.md' @@ -21,6 +21,8 @@ on: pull_request: types: [opened, reopened, synchronize] + + jobs: build: @@ -49,8 +51,17 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install --upgrade kaleido - + +# - uses: browser-actions/setup-chrome@v1 +# - name: Install Google Chrome for Plotly +# run: | +# chrome --version +# ${{ steps.setup-chrome.outputs.chrome-path }} + + + # Checking the branch name, not necessary but useful when setting things up. # - name: Extract branch name # shell: bash diff --git a/docs/conf.py b/docs/conf.py index d1a976ad8..5fbd7fbae 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ copyright = '2025, NSF NCAR' author = 'UCAR/NSF NCAR, NOAA, CSU/CIRA, and CU/CIRES' author_list = 'Fisher, H., D. Adriaansen, C. Kalb, D. Fillmore, T. Jensen, L. Goodrich, M. Win-Gildenmeister and T. Burek' -version = '3.1.0-rc1' +version = '3.2.0-beta1-dev' verinfo = version release = f'{version}' release_year = '2025' diff --git a/internal/scripts/installation/modulefiles/3.1.0_casper b/internal/scripts/installation/modulefiles/3.1.0_casper index 09db94448..2d786c42e 100644 --- a/internal/scripts/installation/modulefiles/3.1.0_casper +++ b/internal/scripts/installation/modulefiles/3.1.0_casper @@ -10,7 +10,7 @@ proc ModulesHelp { } { module load ncarenv/24.12 module load intel/2024.2.1 -prepend-path PATH /glade/work/dtcrt/METplus/casper/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +prepend-path PATH /glade/work/dtcrt/METplus/casper/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin setenv METPLOTPY_SOURCE /glade/work/dtcrt/METplus/casper/components/METplotpy/installations/METplotpy-3.1.0 setenv METPLOTPY_BASE /glade/work/dtcrt/METplus/casper/components/METplotpy/installations/METplotpy-3.1.0 diff --git a/internal/scripts/installation/modulefiles/3.1.0_hera b/internal/scripts/installation/modulefiles/3.1.0_hera index 4e4165e91..07f1c960e 100644 --- a/internal/scripts/installation/modulefiles/3.1.0_hera +++ b/internal/scripts/installation/modulefiles/3.1.0_hera @@ -12,7 +12,7 @@ prereq intel/2024.2.1 setenv METPLOTPY_SOURCE /contrib/METplotpy/METplotpy-3.1.0 setenv METPLOTPY_BASE /contrib/METplotpy/METplotpy-3.1.0 -prepend-path PATH /scratch1/BMC/dtc/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +prepend-path PATH /scratch1/BMC/dtc/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/contributed prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots/performance_diagram prepend-path PATH /contrib/METplotpy/METplotpy-3.1.0/metplotpy/plots diff --git a/internal/scripts/installation/modulefiles/3.1.0_jet b/internal/scripts/installation/modulefiles/3.1.0_jet index b35a32d2c..85bf61c75 100644 --- a/internal/scripts/installation/modulefiles/3.1.0_jet +++ b/internal/scripts/installation/modulefiles/3.1.0_jet @@ -12,7 +12,7 @@ prereq intel/2024.2.1 setenv METPLOTPY_SOURCE /contrib/met/METplotpy/METplotpy-3.1.0 setenv METPLOTPY_BASE /contrib/met/METplotpy/METplotpy-3.1.0 -prepend-path PATH /lfs5/HFIP/dtc-hurr/METplus/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +prepend-path PATH /lfs6/HFIP/dtc-hurr/METplus/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin prepend-path PATH /contrib/met/METplotpy/METplotpy-3.1.0/metplotpy/contributed prepend-path PATH /contrib/met/METplotpy/METplotpy-3.1.0/metplotpy/plots/performance_diagram prepend-path PATH /contrib/met/METplotpy/METplotpy-3.1.0/metplotpy/plots diff --git a/internal/scripts/installation/modulefiles/3.1.0_orion b/internal/scripts/installation/modulefiles/3.1.0_orion index 2a424ebe4..b233f0a93 100644 --- a/internal/scripts/installation/modulefiles/3.1.0_orion +++ b/internal/scripts/installation/modulefiles/3.1.0_orion @@ -8,13 +8,13 @@ proc ModulesHelp { } { } module load contrib -module load intel-oneapi-compilers/2022.2.1 +module load intel-oneapi-compilers/2024.1.0 setenv METPLOTPY_SOURCE /apps/contrib/MET/METplotpy/METplotpy-3.1.0 setenv METPLOTPY_BASE /apps/contrib/MET/METplotpy/METplotpy-3.1.0 #setenv METPLOTPY_PATH /apps/contrib/MET/METplotpy/METplotpy-3.1.0/ -prepend-path PATH /work/noaa/ovp/miniconda/miniconda3/envs/metplus_v5.1_py3.10/bin +prepend-path PATH /work/noaa/ovp/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin prepend-path PATH /apps/contrib/MET/METplotpy/METplotpy-3.1.0/metplotpy/contributed prepend-path PATH /apps/contrib/MET/METplotpy/METplotpy-3.1.0/metplotpy/plots/performance_diagram prepend-path PATH /apps/contrib/MET/METplotpy/METplotpy-3.1.0/metplotpy/plots diff --git a/internal/scripts/installation/modulefiles/3.2.0_ursa b/internal/scripts/installation/modulefiles/3.2.0_ursa new file mode 100644 index 000000000..1ef5d6e56 --- /dev/null +++ b/internal/scripts/installation/modulefiles/3.2.0_ursa @@ -0,0 +1,25 @@ +#%Module###################################################################### +## +## METplotpy +## +proc ModulesHelp { } { + puts stderr "Sets up the paths and environment variables to use the METplotpy-3.2.0. + *** For help see the official MET webpage at http://www.dtcenter.org/met/users ***" +} + +prereq intel-oneapi-compilers/2025.1.1 + +setenv METPLOTPY_SOURCE /contrib/METplotpy/METplotpy-3.2.0 +setenv METPLOTPY_BASE /contrib/METplotpy/METplotpy-3.2.0 + +prepend-path PATH /scratch3/BMC/dtc/METplus/miniconda/miniconda3/envs/metplus_v6.1_py3.12/bin +prepend-path PATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/contributed +prepend-path PATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/plots/performance_diagram +prepend-path PATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/plots +prepend-path PATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy +prepend-path PATH /contrib/METplotpy/METplotpy-3.2.0 +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/contributed +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/plots/performance_diagram +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy/plots +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.2.0/metplotpy +prepend-path PYTHONPATH /contrib/METplotpy/METplotpy-3.2.0 diff --git a/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py b/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py index d6da90892..bf29db1d3 100644 --- a/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py +++ b/metplotpy/contributed/stratosphere_diagnostics/stratosphere_plots.py @@ -109,7 +109,9 @@ def plot_qbo_phase_circuits(inits,periods,rean_qbo_pcs,rfcst_qbo_pcs,outfile): def plot_qbo_phase_space(rean_qbo_pcs,eofs,ptitle,outfile): - from mpl_toolkits.axes_grid1.inset_locator import (inset_axes, mark_inset) + + from mpl_toolkits.axes_grid1.inset_locator import mark_inset + fig = plt.figure(4) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index e1001edbc..ac16e2759 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -27,9 +27,11 @@ from .config import Config from metplotpy.plots.context_filter import ContextFilter -# set kaleido to use single process to prevent GPU errors in containers -# NOTE: this may result in GHA tests failing due to impending deprecations in kaleido -pio.kaleido.scope.chromium_args += ("--single-process",) +# kaleido 0.x will be deprecated after September 2025 and Chrome will no longer +# be included with kaleido from version 1.0.0. Explicitly get Chrome via call to kaleido. +import kaleido +kaleido.get_chrome_sync() + class BasePlot: """A class that provides methods for building Plotly plot's common features diff --git a/requirements.txt b/requirements.txt index 3aafb80e6..eeb792d5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ + imageio>=2.37.0 imutils>=0.5.4 -kaleido>=0.2.1 +kaleido>=1.0.0 matplotlib>=3.10.0 metpy>=1.6.3 netcdf4>=1.7.2 @@ -8,7 +9,7 @@ numpy>=2.2.2 opencv-python>=4.10.0 pandas>=2.2.3 pint>=0.24.4 -plotly>=6.0.0 +plotly>=6.1.1 pytest>=8.3.4 pyyaml>=6.0.2 scikit-image>=0.25.1 @@ -18,4 +19,3 @@ eofs>=2.0.0 cartopy>=0.24.0 scikit-learn>=1.6.1 cmocean>=4.0.3 - diff --git a/test/scatter/test_scatter.py b/test/scatter/test_scatter.py index e232dd3d9..aee0593f4 100644 --- a/test/scatter/test_scatter.py +++ b/test/scatter/test_scatter.py @@ -23,7 +23,6 @@ def read_config(config_filename) -> dict: return parms except yaml.YAMLError as exc: print(exc) -@pytest.mark.skip("Skipping until GHA issue with Python 3.12 and kaleido are resolved") def test_files_exist(): """ Generate a scatter plot from reformatted MPR Usecase data and diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 000000000..eeb792d5f --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,21 @@ + +imageio>=2.37.0 +imutils>=0.5.4 +kaleido>=1.0.0 +matplotlib>=3.10.0 +metpy>=1.6.3 +netcdf4>=1.7.2 +numpy>=2.2.2 +opencv-python>=4.10.0 +pandas>=2.2.3 +pint>=0.24.4 +plotly>=6.1.1 +pytest>=8.3.4 +pyyaml>=6.0.2 +scikit-image>=0.25.1 +scipy>=1.15.1 +xarray>=2025.1.2 +eofs>=2.0.0 +cartopy>=0.24.0 +scikit-learn>=1.6.1 +cmocean>=4.0.3 From 45e3e3f3cb73c24c08810955461b1a800fc898fe Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 8 Jul 2025 08:07:05 -0600 Subject: [PATCH 35/50] Added support for env variable to turn on/off invoking the get_chrome_sync() to install Chrome at run-time --- metplotpy/plots/base_plot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index ac16e2759..409df91aa 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -30,7 +30,14 @@ # kaleido 0.x will be deprecated after September 2025 and Chrome will no longer # be included with kaleido from version 1.0.0. Explicitly get Chrome via call to kaleido. import kaleido -kaleido.get_chrome_sync() + +# In some instances, we do NOT want Chrome to be installed at run-time. If the +# PRE_LOAD_CHROME environment variable exists but undefined, or set to TRUE, +# then Chrome will be pre-loaded and the get_chrome_sync() invocation +# is skipped. +chrome_env = os.getenv("PRE_LOAD_CHROME", False).lower() == 'true' +if chrome_env is False: + kaleido.get_chrome_sync() class BasePlot: From 83fe527a5e8183e9d85b472c026a5123b0d2c7ce Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 8 Jul 2025 10:57:45 -0600 Subject: [PATCH 36/50] test truthiness for booleans rather than string --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 409df91aa..7b93b1bcc 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -35,7 +35,7 @@ # PRE_LOAD_CHROME environment variable exists but undefined, or set to TRUE, # then Chrome will be pre-loaded and the get_chrome_sync() invocation # is skipped. -chrome_env = os.getenv("PRE_LOAD_CHROME", False).lower() == 'true' +chrome_env = os.getenv("PRE_LOAD_CHROME", False) == True if chrome_env is False: kaleido.get_chrome_sync() From cf9396711debabfba3bd0fbd3182827af0ae1d50 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 8 Jul 2025 13:11:25 -0600 Subject: [PATCH 37/50] Update logic for checking PRE_LOAD_CHROME environment variable that is defined in the Dockerfile --- metplotpy/plots/base_plot.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 7b93b1bcc..3e4eec835 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -32,13 +32,24 @@ import kaleido # In some instances, we do NOT want Chrome to be installed at run-time. If the -# PRE_LOAD_CHROME environment variable exists but undefined, or set to TRUE, -# then Chrome will be pre-loaded and the get_chrome_sync() invocation -# is skipped. -chrome_env = os.getenv("PRE_LOAD_CHROME", False) == True -if chrome_env is False: - kaleido.get_chrome_sync() - +# PRE_LOAD_CHROME environment variable exists, or set to TRUE, +# then Chrome will be assumed to have been pre-loaded. Otherwise, +# invoke get_chrome_sync() to install Chrome in the +# /path-to-python-libs/pythonx.yz/site-packages/... directory + +# Check if the PRE_LOAD_CHROME env variable exists +if 'PRE_LOAD_CHROME' not in os.environ: + print("Chrome ENV is non-existent, getting Chrome via kaleido call...") + kaleido.get_chrome_sync() +else: + # Check value of PRE_LOAD_CHROME (could be boolean or string) + chrome_env = os.environ.get('PRE_LOAD_CHROME') + if type(chrome_env) is bool and chrome_env is False: + kaleido.get_chrome_sync() + else: + # ENV var is a string and has been set to 'False' (case-insensitive) + if chrome_env.lower() == 'false': + kaleido.get_chrome_sync() class BasePlot: """A class that provides methods for building Plotly plot's common features From 127b488357be469610cfb62e8f0463b80bb0d8a7 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 8 Jul 2025 13:28:14 -0600 Subject: [PATCH 38/50] Remove print statement --- metplotpy/plots/base_plot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 3e4eec835..17c670eda 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -39,7 +39,6 @@ # Check if the PRE_LOAD_CHROME env variable exists if 'PRE_LOAD_CHROME' not in os.environ: - print("Chrome ENV is non-existent, getting Chrome via kaleido call...") kaleido.get_chrome_sync() else: # Check value of PRE_LOAD_CHROME (could be boolean or string) From 32eeb0f9e948c8d05b4c2facba7ac8d3c6679d4b Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 9 Jul 2025 10:48:59 -0600 Subject: [PATCH 39/50] Add check for PRE_LOAD_CHROME env variable set in Dockerfile to turn on/off invoking kaleido.get_chrome_sync() --- metplotpy/plots/base_plot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 17c670eda..b8e659f7b 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -20,8 +20,7 @@ import numpy as np import yaml from typing import Union - -import plotly.io as pio +import kaleido import metplotpy.plots.util from .config import Config @@ -29,7 +28,6 @@ # kaleido 0.x will be deprecated after September 2025 and Chrome will no longer # be included with kaleido from version 1.0.0. Explicitly get Chrome via call to kaleido. -import kaleido # In some instances, we do NOT want Chrome to be installed at run-time. If the # PRE_LOAD_CHROME environment variable exists, or set to TRUE, From 379a2ded23bc7b632c456e2c3a5a665015c98464 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 12:52:15 -0600 Subject: [PATCH 40/50] Updated versions for Plotly and kaleido --- nco_requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nco_requirements.txt b/nco_requirements.txt index 7330a6f7e..4156ef860 100644 --- a/nco_requirements.txt +++ b/nco_requirements.txt @@ -1,4 +1,4 @@ -kaleido>=0.2.1 +kaleido>=1.0.0 matplotlib>=3.10.0 metpy>=1.6.3 netcdf4>=1.7.2 @@ -6,7 +6,7 @@ numpy==2.2.2 scipy>=1.15.1 pandas>=2.2.3 pint>=0.24.4 -plotly>=6.0.0 +plotly>=6.1.1 pytest>=8.3.4 pyyaml>=6.0.2 xarray>=2025.1.2 From dd6d0574879269ecac7325d9ff727d58544ed6f2 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 13:53:33 -0600 Subject: [PATCH 41/50] Allow logging to stdout and/or file to indicate whether Chrome is getting downloaded at runtime. This facilitates testing for debugging. Setting the PRE_LOAD_CHROME env variable to False (either as bool or string-case is insensitive) will invoke downloading Chrome via Plotly/kaleido. If PRE_LOAD_CHROME is not defined, Chrome will also be downloaded from Plotly/kaleido at run time. Logging can be turned on/off by setting the LOG_BASE_PLOT to true/false (boolean or string) and a log file can be saved by setting the WRITE_LOG env var to true (boolean or string). --- metplotpy/plots/base_plot.py | 41 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index b8e659f7b..f9bc18f2a 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -21,6 +21,7 @@ import yaml from typing import Union import kaleido +from distutils.util import strtobool import metplotpy.plots.util from .config import Config @@ -36,17 +37,39 @@ # /path-to-python-libs/pythonx.yz/site-packages/... directory # Check if the PRE_LOAD_CHROME env variable exists +aquire_chrome = False + +turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT', 'False') ) +# Log when Chrome is downloaded at runtime +if turn_on_logging is True: + log = logging.getLogger("base_plot") + log.setLevel(logging.INFO) + + formatter = logging.Formatter("%(asctime)s [%(levelname)s] | %(name)s | %(message)s") + + # set the WRITE_LOG env var to True to save the log message to a + # separate log file + write_log = strtobool(os.getenv('WRITE_LOG', 'False')) + if write_log is True: + file_handler = logging.FileHandler("./base_plot.log") + file_handler.setFormatter(formatter) + log.addHandler(file_handler) + +# Only load Chrome at run-time if PRE_LOAD_CHROME is False or not defined. +# Some applications may not want to load Chrome at runtime and +# will set the PRE_LOAD_CHROME to True to indicate that it is already +# loaded/downloaded prior to runtime. +chrome_env =strtobool (os.getenv('PRE_LOAD_CHROME', 'False')) if 'PRE_LOAD_CHROME' not in os.environ: + aquire_chrome=True kaleido.get_chrome_sync() -else: - # Check value of PRE_LOAD_CHROME (could be boolean or string) - chrome_env = os.environ.get('PRE_LOAD_CHROME') - if type(chrome_env) is bool and chrome_env is False: - kaleido.get_chrome_sync() - else: - # ENV var is a string and has been set to 'False' (case-insensitive) - if chrome_env.lower() == 'false': - kaleido.get_chrome_sync() +elif chrome_env is False: + aquire_chrome = True + kaleido.get_chrome_sync() + +# Log when kaleido is downloading Chrome +if aquire_chrome is True and turn_on_logging is True: + log.info("Plotly kaleido is loading Chrome at run time") class BasePlot: """A class that provides methods for building Plotly plot's common features From 212789f1658859b4c40c2db8b4d8f06c15f7de1e Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 16:43:41 -0600 Subject: [PATCH 42/50] Update the runtime loading of Chrome by allowing logging to monitor if Chrome is being downloaded at runtime. Use METplotpy util.py strtobool to replace the distutils.util.strtobool to return a boolean value from the PRE_LOAD_CHROME and logging env vars. --- metplotpy/plots/base_plot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index f9bc18f2a..00228614a 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -21,7 +21,7 @@ import yaml from typing import Union import kaleido -from distutils.util import strtobool +from plots.util import strtobool import metplotpy.plots.util from .config import Config @@ -39,7 +39,7 @@ # Check if the PRE_LOAD_CHROME env variable exists aquire_chrome = False -turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT', 'False') ) +turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT') ) # Log when Chrome is downloaded at runtime if turn_on_logging is True: log = logging.getLogger("base_plot") @@ -49,7 +49,7 @@ # set the WRITE_LOG env var to True to save the log message to a # separate log file - write_log = strtobool(os.getenv('WRITE_LOG', 'False')) + write_log = strtobool(os.getenv('WRITE_LOG')) if write_log is True: file_handler = logging.FileHandler("./base_plot.log") file_handler.setFormatter(formatter) @@ -59,7 +59,7 @@ # Some applications may not want to load Chrome at runtime and # will set the PRE_LOAD_CHROME to True to indicate that it is already # loaded/downloaded prior to runtime. -chrome_env =strtobool (os.getenv('PRE_LOAD_CHROME', 'False')) +chrome_env =strtobool (os.getenv('PRE_LOAD_CHROME')) if 'PRE_LOAD_CHROME' not in os.environ: aquire_chrome=True kaleido.get_chrome_sync() From 917fde793da1dcc94be3fefa33d0960fdb3cf578 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:04:03 -0600 Subject: [PATCH 43/50] Implement our own version of the deprecated (in Python 3.12+) of distutils.utils.strtobool --- metplotpy/plots/util.py | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/metplotpy/plots/util.py b/metplotpy/plots/util.py index 7b2c32897..cd2d5b43c 100644 --- a/metplotpy/plots/util.py +++ b/metplotpy/plots/util.py @@ -623,3 +623,59 @@ def prepare_ctc_roc(subset_df, is_ascending): thresh = pd.concat([thresh, pd.Series([''])], ignore_index=True) return pody, pofd, thresh + + +def strtobool(env_var:str)->bool: + """ + Since distutils.util.strtobool was deprecated in Python 3.12, implement + our own version. + + In the distutils.util.strtobool, a simple one line command was used to determine + whether an environment variable was set to True or False. In this + example, the default value is set to False in the event that the environment + variable is not defined: + + turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT', 'False') ) + + Environment variables can be set as string or bool. Evaluate whether a string + value for true or false (support case-insensitive text) is True/False and + set the default value. + + Args: + @parm env_vars: string name of the environment variable to evaluate + + turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT') ) + """ + + true_list = ['true', 't', '1',] + false_list = ['false', 'f', '0' ] + # if the environment variable does not exist, then return False + try: + val = os.environ[env_var] + except KeyError: + return False + + # If the environment variable is None, return false + if val is None: + return False + else: + # Check for variations of truth values + lower = val.lower() + if lower in true_list: + return True + elif lower in false_list: + return False + else: + msg = "Value does not represent a truth value (i.e. true or false)" + raise ValueError(msg) + + + +if __name__ == "__main__": + + os.environ['LOG_ON'] = 't' + test_var = 'LOG_ON' + bool_val = strtobool(test_var) + print(bool_val) + + From 61d8e6c43211634bc43dcda240fae83b50036e8d Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:05:04 -0600 Subject: [PATCH 44/50] Add testing for the strtobool implementation in util.py --- test/util/test_util.py | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/test/util/test_util.py b/test/util/test_util.py index b22bcc04c..4d853708a 100644 --- a/test/util/test_util.py +++ b/test/util/test_util.py @@ -1,6 +1,6 @@ import os import pandas as pd - +import pytest import metplotpy.plots.util as util import gc @@ -170,3 +170,48 @@ def test_filter_by_fixed_vars(): for filtered in filtered_list: assert filtered in expected_list + + +def test_strtobool(): + """ + Test that strtobool is returning the corresponding bool value to an environment + + """ + + # Non-existent env var should return boolean False + assert (util.strtobool('NON_EXISTENT') is False) + + # Variations of false should return boolean False + os.environ['FALSE_1'] = 'f' + os.environ['FALSE_2'] = 'FaLSE' + os.environ['FALSE_3'] = '0' + os.environ['FALSE_4'] = 'F' + false_1 = 'FALSE_1' + false_2 = 'FALSE_2' + false_3 = 'FALSE_3' + false_4 = 'FALSE_4' + assert(util.strtobool(false_1) is False) + assert(util.strtobool(false_2) is False) + assert(util.strtobool(false_3) is False) + assert(util.strtobool(false_4) is False) + + + # Variations of true should return boolean True + os.environ['TRUE_1'] = 't' + os.environ['TRUE_2'] = 'T' + os.environ['TRUE_3'] = 'tRuE' + os.environ['TRUE_4'] = '1' + true_1 = 'TRUE_1' + true_2 = 'TRUE_2' + true_3 = 'TRUE_3' + true_4 = 'TRUE_4' + assert (util.strtobool(true_1) is True) + assert (util.strtobool(true_2) is True) + assert (util.strtobool(true_3) is True) + assert (util.strtobool(true_4) is True) + + # non-truth values should raise a ValueError + os.environ['BOGUS'] = 'Whatever' + var = 'BOGUS' + with pytest.raises(ValueError): + util.strtobool(var) From 61c72e332cf9ce569346fd54f2106b5f67cce6ef Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:07:38 -0600 Subject: [PATCH 45/50] Fix import for util strtobool --- metplotpy/plots/base_plot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 00228614a..18a478c34 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -21,9 +21,8 @@ import yaml from typing import Union import kaleido -from plots.util import strtobool - import metplotpy.plots.util +from metplotpy.plots.util import strtobool from .config import Config from metplotpy.plots.context_filter import ContextFilter From ed47597d76365e06700c0a67a0ceb40612cb8142 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:22:50 -0600 Subject: [PATCH 46/50] Forgot to change the args to strtobool to match our implementation --- metplotpy/plots/base_plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 18a478c34..23f0851c6 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -38,7 +38,7 @@ # Check if the PRE_LOAD_CHROME env variable exists aquire_chrome = False -turn_on_logging = strtobool(os.getenv('LOG_BASE_PLOT') ) +turn_on_logging = strtobool('LOG_BASE_PLOT') # Log when Chrome is downloaded at runtime if turn_on_logging is True: log = logging.getLogger("base_plot") @@ -58,7 +58,7 @@ # Some applications may not want to load Chrome at runtime and # will set the PRE_LOAD_CHROME to True to indicate that it is already # loaded/downloaded prior to runtime. -chrome_env =strtobool (os.getenv('PRE_LOAD_CHROME')) +chrome_env =strtobool ('PRE_LOAD_CHROME') if 'PRE_LOAD_CHROME' not in os.environ: aquire_chrome=True kaleido.get_chrome_sync() From ca8c3e1631ec676fa6668b3acbaff2f1d4fa37e8 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:34:17 -0600 Subject: [PATCH 47/50] Include the information about impacts of kaleido 1.0.0 changes under the METplotpy Upgrade Instructions --- docs/Users_Guide/release-notes.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/Users_Guide/release-notes.rst b/docs/Users_Guide/release-notes.rst index 21b271caf..27cc996ef 100644 --- a/docs/Users_Guide/release-notes.rst +++ b/docs/Users_Guide/release-notes.rst @@ -93,3 +93,20 @@ METplotpy Upgrade Instructions development with Python 3.12. View the requirements.txt/nco_requirements.txt file at the top level of the repository for version numbers for the corresponding third-party packages. + + In June 2025, Plotly made significant updates to the kaleido package with the 1.0.0 + release by removing Google Chrome code. Now, users will need to have Google Chrome + installed in directories specified in this Plotly documentation (based on operating + system): + +https://plotly.com/python/static-image-export/ + +The METplotpy code downloads Chrome at runtime by invoking the kaleido.get_chrome_sync() +method call. + +If users do not wish to have Chrome downloaded at run time and already have Chrome installed +in one of the expected locations (specified in the Plotly link above), then the PRE_LOAD_CHROME environment variable +will need to be set to 'True' (case insensitive string). + +Refer to the Kaleido README for more information on the changes: +https://github.com/plotly/Kaleido From 354ae4a7d242f686eb112e752cd1834a9b16a4f3 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 17:48:59 -0600 Subject: [PATCH 48/50] Still one more place to fix the input to strtobool to match our implementation --- metplotpy/plots/base_plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index 23f0851c6..fccfc1b02 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -48,7 +48,7 @@ # set the WRITE_LOG env var to True to save the log message to a # separate log file - write_log = strtobool(os.getenv('WRITE_LOG')) + write_log = strtobool('WRITE_LOG') if write_log is True: file_handler = logging.FileHandler("./base_plot.log") file_handler.setFormatter(formatter) From 292cf38a1dedcbbfffafd64821df10b1167060eb Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 18:53:25 -0600 Subject: [PATCH 49/50] Refactor to eliminate sonarqube code smell --- metplotpy/plots/base_plot.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/metplotpy/plots/base_plot.py b/metplotpy/plots/base_plot.py index fccfc1b02..23d28571a 100644 --- a/metplotpy/plots/base_plot.py +++ b/metplotpy/plots/base_plot.py @@ -59,12 +59,10 @@ # will set the PRE_LOAD_CHROME to True to indicate that it is already # loaded/downloaded prior to runtime. chrome_env =strtobool ('PRE_LOAD_CHROME') -if 'PRE_LOAD_CHROME' not in os.environ: +if ('PRE_LOAD_CHROME' not in os.environ)or (chrome_env is False): aquire_chrome=True kaleido.get_chrome_sync() -elif chrome_env is False: - aquire_chrome = True - kaleido.get_chrome_sync() + # Log when kaleido is downloading Chrome if aquire_chrome is True and turn_on_logging is True: From 9dd8c49857800301415aa0219c897aecf16c00b8 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Wed, 16 Jul 2025 18:53:48 -0600 Subject: [PATCH 50/50] Remove test code --- metplotpy/plots/util.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/metplotpy/plots/util.py b/metplotpy/plots/util.py index cd2d5b43c..2664f32df 100644 --- a/metplotpy/plots/util.py +++ b/metplotpy/plots/util.py @@ -670,12 +670,3 @@ def strtobool(env_var:str)->bool: raise ValueError(msg) - -if __name__ == "__main__": - - os.environ['LOG_ON'] = 't' - test_var = 'LOG_ON' - bool_val = strtobool(test_var) - print(bool_val) - -