-
Notifications
You must be signed in to change notification settings - Fork 286
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
Replace dask 'compute()' usage with a common realisation call. (#2) #2447
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,11 @@ | |
import warnings | ||
import zlib | ||
|
||
from iris._lazy_data import is_lazy_data | ||
import dask.array as da | ||
import netcdftime | ||
import numpy as np | ||
|
||
from iris._lazy_data import as_concrete_data, is_lazy_data | ||
import iris.aux_factory | ||
import iris.exceptions | ||
import iris.time | ||
|
@@ -1611,7 +1611,11 @@ def _sanitise_array(self, src, ndmin): | |
def points(self): | ||
"""Property containing the points values as a numpy array""" | ||
if is_lazy_data(self._points): | ||
self._points = self._points.compute() | ||
self._points = as_concrete_data(self._points, | ||
nans_replacement=np.ma.masked) | ||
# NOTE: we probably don't have full support for masked aux-coords. | ||
# We certainly *don't* handle a _FillValue attribute (and possibly | ||
# the loader will throw one away ?) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lbdreyer We should raise a ticket to consider how we deal with masked integral data on coordinates and cell measures. At the moment we don't keep the result dtype ... this is lost in translation, which is bad. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lbdreyer Did you create an issue to cover this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, but I'll do that now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return self._points.view() | ||
|
||
@points.setter | ||
|
@@ -1649,7 +1653,11 @@ def bounds(self): | |
if self._bounds is not None: | ||
bounds = self._bounds | ||
if is_lazy_data(bounds): | ||
bounds = bounds.compute() | ||
bounds = as_concrete_data(bounds, | ||
nans_replacement=np.ma.masked) | ||
# NOTE: we probably don't fully support for masked aux-coords. | ||
# We certainly *don't* handle a _FillValue attribute (and | ||
# possibly the loader will throw one away ?) | ||
self._bounds = bounds | ||
bounds = bounds.view() | ||
else: | ||
|
@@ -1740,9 +1748,11 @@ def measure(self): | |
@property | ||
def data(self): | ||
"""Property containing the data values as a numpy array""" | ||
data = self._data | ||
if is_lazy_data(self._data): | ||
self._data = self._data.compute() | ||
self._data = as_concrete_data(self._data, | ||
nans_replacement=np.ma.masked) | ||
# NOTE: like AuxCoords, we probably don't fully support masks, and | ||
# we certainly don't handle any _FillValue attribute. | ||
return self._data.view() | ||
|
||
@data.setter | ||
|
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.
Nice spot 😉