Skip to content

Cycloneplotter METplotlibDeprecationWarning observed in Matplotlib versions above 3.2 #1614

@bikegeek

Description

@bikegeek

Describe the Problem

During verification while migrating to Python 3.8.6, the MatplotlibDeprecationWarning has been noticed. This warning is from within cartopy/mpl/geoaxes.py and corresponds to changes made in Matplotlib version 3.2 and above.

A simple fix to the code in the cycloneplotter wrapper can be accomplished by replacing this:
#Dummy point to add the additional label explaining the labelling of the first
# point in the storm track
plt.scatter(0, 0, zorder=2, marker=None, c='',
label="Date (dd/hhz) is the first " +
"time storm was able to be tracked in model")

with this
#Dummy point to add the additional label explaining the labelling of the first
# point in the storm track
colors = []
plt.scatter(0, 0, zorder=2, marker=None, c=colors,
label="Date (dd/hhz) is the first " +
"time storm was able to be tracked in model")

A plot is still successfully created, but the log file contains this deprecation warning and eventually, when migrating to higher versions of Matplotlib, this will be an issue.

Expected Behavior

Environment

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

To Reproduce

Describe the steps to reproduce the behavior:
*1. Run the cyclone plotter use case
*2. Run is successful
*3. Open the log file
*4. Scroll down and find the MatplotlibDeprecationWarning

/d1/personal/mwin/miniconda3/envs/metplus_py386/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:1546: MatplotlibDeprecationWarning: Using a string of single character colors as a color sequence is deprecated since 3.2 and will be removed two minor releases later. Use an explicit list instead.
result = matplotlib.axes.Axes.scatter(self, *args, **kwargs)

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

2792541

Define the Metadata

Assignee

  • Select engineer Minna Win
  • Select 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 PROJECT 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 Linked 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 Linked issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Close this issue.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions