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

silence some matplotlib warnings #3330

Merged
merged 6 commits into from
Jul 25, 2023
Merged

silence some matplotlib warnings #3330

merged 6 commits into from
Jul 25, 2023

Conversation

megies
Copy link
Member

@megies megies commented Jul 24, 2023

What does this PR do?

Fix some failing tests, mostly due to warnings

  • avoid scipy 1.11 for now in CI to clean up test reports (cartopy has a plotting issue with it right now that will certainly get fixed)
  • matplotlib seems to warn now when using tight_layout() in some cases
  • automatic conversion from numpy single-item arrays to scalars is deprecated and will be removed in a future numpy release
  • fix some numpy misuse of setting an array element with a slice of a single-item array

Why was it initiated? Any relevant Issues?

Warnings in current test runs

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • While the PR is still work-in-progress, the no_ci label can be added to skip CI builds
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just add the build_docs tag to this PR.
    Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
    Please post a link to the relevant piece of documentation.
  • If all tests including network modules (e.g. clients.fdsn) should be tested for the PR,
    just add the test_network tag to this PR.
  • All tests still pass.
  • Any new features or fixed regressions are covered via new tests.
  • Any new or changed features are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .
  • If the changes affect any plotting functions you have checked that the plots
    from all the CI builds look correct. Add the "upload_plots" tag so that plotting
    outputs are attached as artifacts.
  • New modules, add the module to CODEOWNERS with your github handle
  • Add the yellow ready for review label when you are ready for the PR to be reviewed.

@megies megies added the cleanup code refactoring etc. label Jul 24, 2023
@megies megies added this to the 1.4.1 milestone Jul 24, 2023
@megies megies removed the request for review from crotwell July 24, 2023 13:18
@megies
Copy link
Member Author

megies commented Jul 24, 2023

megies requested review from johnrudge and crotwell as code owners

just some code refactoring going on here, so no need to look at anything really

@megies megies removed the request for review from johnrudge July 24, 2023 13:19
@megies megies mentioned this pull request Jul 24, 2023
when using tight_layout()
because it causes some problems when plotting with cartopy currently.
should get unpinned again later
casting single item arrays to a scalar is deprecated in newer numpy and
will result in errors at some point

see numpy issue number 10404
setting an array element with a slice of a single-item array
@@ -434,7 +434,11 @@ def plot(self, outfile=None, show=True, fig=None, plot_x=True,
width = min(width, height * 4)
fig.set_figwidth(width)
plt.subplots_adjust(top=1, bottom=0, left=0, right=1)
plt.tight_layout()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we call tight_layout on line 425 too? It seems enough to do it once after setting both width and height?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks!

@megies megies merged commit b2a2dce into maintenance_1.4.x Jul 25, 2023
25 checks passed
@megies megies deleted the fix_warnings branch July 25, 2023 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup code refactoring etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants