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

Suppress some warnings in examples #3958

Merged
merged 6 commits into from Jan 1, 2015

Conversation

jenshnielsen
Copy link
Member

This filters a number of warnings from the examples.

  • Numpy invalid values which are already handled correctly.
  • Warnings about tight layout which is handled manually in the example
  • Explicitly handle mean of empty slices to avoid warnings.

I have done this for 2 reasons

  1. I don't think that end users should be seeing warnings when running examples. That will lead to confusion for end users.
  2. The warnings are raised when building the documentation. Any real issues might be concealed by these warnings.

It it expected that the array may contain nan and this is handled correctly using nanmin
Avoids numpy warnings with the same result. Similar to what is done above
if self.lat_cycle is not None:
lat0 = np.nanmin(lat)
lat -= 360. * ((lat - lat0) > 180.)
with np.errstate(invalid='ignore'):
Copy link
Member

Choose a reason for hiding this comment

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

note to self, should probably use np.unroll() here, I think.

Copy link
Member

Choose a reason for hiding this comment

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

also, what exactly are we ignoring here? The other changes came with very nice explanations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right you are. I guess I was being lazy 😃
I assume that np.unroll() should we np.unwrap?

Copy link
Member

Choose a reason for hiding this comment

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

ah, right, np.unwrap(). Squishy brain matter makes for a terrible memory medium...

@tacaswell tacaswell added this to the v1.5.x milestone Dec 30, 2014
WeatherGod added a commit that referenced this pull request Jan 1, 2015
@WeatherGod WeatherGod merged commit 9b661e7 into matplotlib:master Jan 1, 2015
@WeatherGod
Copy link
Member

very nice explanations!

@jenshnielsen jenshnielsen deleted the examples_filter_warnings branch January 2, 2015 10:40
@jenshnielsen jenshnielsen changed the title Supress some warnings in examples Suppress some warnings in examples Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants