-
Notifications
You must be signed in to change notification settings - Fork 282
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
Consistent check for masked array types #2434
Conversation
Ping @pp-mo |
Tests pass! Anyone want to take a look? |
@@ -2221,7 +2221,7 @@ def new_cell_measure_dims(cm_): | |||
data = copy.deepcopy(data) | |||
|
|||
# We can turn a masked array into a normal array if it's full. | |||
if isinstance(data, ma.core.MaskedArray): |
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.
ma.core.MaskedArray
!! there are quite a few different ways this has been accessed.
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.
Oh our dear old friend lack of consistency...
Dammit PyCharm! Your search has let me down... |
But then again, perhaps we should blame my ability to regex. |
@dkillick Awesome, but I think that you're still missing a couple of |
@dkillick Let's get this merged ... |
./fileformats/grib/_load_convert.py
1384: if isinstance(data, ma.core.MaskedArray):
./fileformats/pp.py
100: if isinstance(data, np.ma.core.MaskedArray):
./experimental/raster.py
934: if not isinstance(a, (np.ndarray, ma.core.MaskedArray)):
./util.py and
These are the obvious candidates ... fix those and I'll merge. |
8addb90
to
3b2c05d
Compare
@bjlittle I've removed a few more examples... |
3b2c05d
to
517f4bc
Compare
517f4bc
to
e982db9
Compare
* Consistent checking for ma * License headers * Fix missed instances
Consistency! And using part of an API for what it was meant for (in this case checking that an object is of a certain type).
To wit, anything that looks like the former will now look like the latter:
if isinstance(thing, ma.core.MaskedArray)
-->if ma.isMaskedArray(thing)
if thing is ma.masked
-->if ma.is_masked(thing)