8000 Caught case where the pcolormesh has masked pcolor values. by pelson · Pull Request #317 · SciTools/cartopy · GitHub
[go: up one dir, main page]

Skip to content

Caught case where the pcolormesh has masked pcolor values. #317

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

Merged
merged 1 commit into from
Aug 29, 2013

Conversation

pelson
Copy link
Member
@pelson pelson commented Aug 23, 2013

There is a bug in matplotlib which restricts pcolor plots to data arrays which have at least one non-masked value (matplotlib/matplotlib#2336). This is a problem for cartopy when it tries to handle a warped pcolormesh, as inbetween the wrapping, it draws a pcolor. This change adds a check to ensure that a pcolor being drawn actually contains non-masked data, otherwise it just skips the step.

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np

import numpy.random

data = np.ma.masked_all((30, 40))

plt.axes(projection=ccrs.PlateCarree())
plt.pcolormesh(np.linspace(-90, 90, 40), np.linspace(0, 360, 30), data)
plt.show()

#
# You should have received a copy of the GNU Lesser General Public License
# along with cartopy. If not, see <http://www.gnu.org/licenses/>.
import warnings
Copy link
Member

Choose a reason for hiding this comment

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

Unused import.

@ghost ghost assigned esc24 Aug 27, 2013
data = np.ma.masked_all((30, 40))

# Check that a fully masked data array doesn't trigger a pcolor call,
# but a non-fully masked one does.
Copy link
Member

Choose a reason for hiding this comment

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

No longer applies.

@pelson
Copy link
Member Author
pelson commented Aug 28, 2013

Thanks @esc24. Done.

@esc24
Copy link
Member
esc24 commented Aug 28, 2013

I'm still seeing a failure. I may have sent a PR your way as a gentle reminder 😉.

@pelson
Copy link
Member Author
pelson commented Aug 29, 2013

Thanks for the nudge @esc24 - merged and squashed...

esc24 added a commit that referenced this pull request Aug 29, 2013
Caught case where the pcolormesh has masked pcolor values.
@esc24 esc24 merged commit 22bf65b into SciTools:master Aug 29, 2013
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.

2 participants
0