-
Notifications
You must be signed in to change notification settings - Fork 43
Dask masked fix #87
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
Dask masked fix #87
Conversation
5cb7c48
to
c8d3636
Compare
@@ -145,7 +145,6 @@ class GribWrapper(object): | |||
def __init__(self, grib_message, grib_fh=None): | |||
"""Store the grib message and compute our extra keys.""" | |||
self.grib_message = grib_message | |||
self.realised_dtype = np.array([0.]).dtype |
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.
API change
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.
Well, not if we never released the previous version, no ? ;-)
@@ -698,6 +694,10 @@ def _message_values(grib_message, shape): | |||
data = gribapi.grib_get_double_array(grib_message, 'values') | |||
data = data.reshape(shape) | |||
|
|||
# Handle missing values in a sensible way. |
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.
Is this a hangover from not having masks?
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.
Not totally sure.
This is simply reflecting what is currently in Iris master.
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'd love to find out more...
# We can't use the cube's fill value if it's NaN, | ||
# the GRIB API doesn't like it. | ||
# Calculate an MDI outside the data range. | ||
min, max = cube.data.min(), cube.data.max() | ||
fill_value = min - (max - min) * 0.1 | ||
# Prepare the unmasked data array, using fill_value as the MDI. | ||
data = cube.data.filled(fill_value) |
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.
Again, is this a hangover?
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.
As above...
Changes Unknown when pulling c8d3636 on pp-mo:dask_masked_fix into ** on SciTools:master**. |
Bring iris_grib up-to-date with recent changes to Iris,
to use masked-arrays instead of nan masking in Dask (Dask v 0.13).