Skip to content

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

Merged
merged 3 commits into from
Oct 24, 2017
Merged

Dask masked fix #87

merged 3 commits into from
Oct 24, 2017

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Oct 24, 2017

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).

@@ -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
Copy link
Member

Choose a reason for hiding this comment

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

API change

Copy link
Member Author

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.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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)
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

As above...

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c8d3636 on pp-mo:dask_masked_fix into ** on SciTools:master**.

@pelson pelson merged commit df881c9 into SciTools:master Oct 24, 2017
@pp-mo pp-mo deleted the dask_masked_fix branch June 8, 2018 17:10
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.

3 participants