-
Notifications
You must be signed in to change notification settings - Fork 398
Fix tab in drawlsmask #312
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
Conversation
Hmmm, this logic is still wrong, though. If I am reading this right, if someone passes in a new lsmask after already calling this function, then it doesn't get used, and it doesn't get adjusted for cyclic projections. Makes me wonder if no one passes in their own lsmask? I would imagine that the correct way to deal with this is to set |
Maybe adding this in?: # Clear saved lsmask is new lsmask is passed
if lsmask is not None or lsmask_lons is not None or lsmask_lats is not None:
self.lsmask = None |
yeah, that should do the trick along with your current set of changes |
@@ -3901,6 +3901,9 @@ def drawlsmask(self,land_color="0.8",ocean_color="w",lsmask=None, | |||
# look for axes instance (as keyword, an instance variable | |||
# or from plt.gca(). | |||
ax = kwargs.pop('ax', None) or self._check_ax() | |||
# Clear saved lsmask is new lsmask is passed | |||
if lsmask is not None or lsmask_lons is not None or lsmask_lats is not None: | |||
self.lsmask = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might do one final little check. I could see adding a check to see if the passed in lsmask
is the same as the cached lsmask
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
if lsmask is not None or lsmask_lons is not None \ | ||
or lsmask_lats is not None: | ||
# Make sure passed lsmask is not the same as cached mask | ||
if lsmask != self.lsmask: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use equality. Use is not
instead when comparing objects.
Also, slight typo in the comments above "lsmask is new" --> "lsmask if new"
Thanks for your fix! |
When calling drawlsmask for a second time
_readlsmask
will not reload the data. However,cylproj
was still be calculated and becauselsmask_lons
could beNone
this will cause an error. This code does not need to be run ifself.lsmask
is notNone
so it's most likely a tab error and it should belong to theif self.lsmask is None:
block.