Skip to content
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

Bugfix for ROC plot image saving to file #394

Closed
23 tasks
TatianaBurek opened this issue Oct 24, 2023 · 2 comments
Closed
23 tasks

Bugfix for ROC plot image saving to file #394

TatianaBurek opened this issue Oct 24, 2023 · 2 comments
Labels
alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED MORE DEFINITION Not yet actionable, additional definition required METplotpy: Plots priority: blocker Blocker type: bug Fix something that is not working

Comments

@TatianaBurek
Copy link
Collaborator

Describe the Problem

ROC plot can't be created. The error message is pointing to some issues in Kaleido package that happen during saving the plot to a PNG file:

Traceback (most recent call last):
  File "/Users/tatiana/PycharmProjects/METplotpy/metplotpy/plots/roc_diagram/roc_diagram.py", line 487, in main
    r.save_to_file()
  File "/Users/tatiana/PycharmProjects/METplotpy/metplotpy/plots/roc_diagram/roc_diagram.py", line 378, in save_to_file
    self.figure.write_image(image_name)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/plotly/basedatatypes.py", line 3829, in write_image
    return pio.write_image(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/plotly/io/_kaleido.py", line 267, in write_image
    img_data = to_image(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/plotly/io/_kaleido.py", line 144, in to_image
    img_bytes = scope.transform(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kaleido/scopes/plotly.py", line 153, in transform
    response = self._perform_transform(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kaleido/scopes/base.py", line 293, in _perform_transform
    self._ensure_kaleido()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kaleido/scopes/base.py", line 188, in _ensure_kaleido
    self._std_error_thread.setDaemon(True)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1217, in setDaemon
    warnings.warn('setDaemon() is deprecated, set the daemon attribute instead',
DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
python-BaseException
Exception ignored in: <_io.FileIO name=6 mode='rb' closefd=True>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kaleido/scopes/base.py", line 252, in _shutdown_kaleido
ResourceWarning: unclosed file <_io.BufferedReader name=6>
Exception ignored in: <_io.FileIO name=8 mode='rb' closefd=True>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kaleido/scopes/base.py", line 252, in _shutdown_kaleido
ResourceWarning: unclosed file <_io.BufferedReader name=8>


plot_20231024_192006.yaml.txt
plot_20231024_192006.data.txt

Expected Behavior

Provide a clear and concise description of what you expected to happen here.

Environment

Describe your runtime environment:
1. Machine: (e.g. HPC name, Linux Workstation, Mac Laptop)
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s)

To Reproduce

Describe the steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Post relevant sample data following these instructions:
https://dtcenter.org/community-code/model-evaluation-tools-met/met-help-desk#ftp

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Select Organization level Project for support of the current coordinated release
  • Select Repository level Project for development toward the next official release or add alert: NEED CYCLE ASSIGNMENT label
  • Select Milestone as the next bugfix version

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of main_<Version>.
    Branch name: bugfix_<Issue Number>_main_<Version>_<Description>
  • Fix the bug and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Add any new Python packages to the METplus Components Python Requirements table.
  • Push local changes to GitHub.
  • Submit a pull request to merge into main_<Version>.
    Pull request: bugfix <Issue Number> main_<Version> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Development issues
    Select: Organization level software support Project for the current coordinated release
    Select: Milestone as the next bugfix version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Complete the steps above to fix the bug on the develop branch.
    Branch name: bugfix_<Issue Number>_develop_<Description>
    Pull request: bugfix <Issue Number> develop <Description>
    Select: Reviewer(s) and Development issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Close this issue.
@TatianaBurek TatianaBurek added type: bug Fix something that is not working priority: blocker Blocker alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle METplotpy: Plots labels Oct 24, 2023
@TatianaBurek TatianaBurek added this to the METplotpy-3.0.0 milestone Oct 24, 2023
@TatianaBurek TatianaBurek removed the alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle label Oct 24, 2023
@bikegeek
Copy link
Collaborator

This only occurs with PCT linetype data. This warning is not generated for CTC linetype.

@bikegeek
Copy link
Collaborator

bikegeek commented Oct 26, 2023

This issue does not occur for the PCT linetype when using Python 3.8. Something changed when we migrated from Python 3.8 to Python 3.10:
PCT_ROC

@bikegeek bikegeek changed the title Bugfix for ROC plot imaage saving to file Bugfix for ROC plot image saving to file Oct 31, 2023
bikegeek added a commit that referenced this issue Nov 2, 2023
* Fix title to reflect the actual data used

* Change title to reflect the data used

* Issue #394 Suppress deprecation warning emanating from python-kaleido/plotly

* Remove save_to_file(), use version in base_plot

---------

Co-authored-by: Minna Win-Gildenmeister <minnawin@ral-mantaray.rap.ucar.edu>
@bikegeek bikegeek closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED MORE DEFINITION Not yet actionable, additional definition required METplotpy: Plots priority: blocker Blocker type: bug Fix something that is not working
Projects
Status: Done
Development

No branches or pull requests

2 participants