Skip to content

Instantly share code, notes, and snippets.

@DPeterK
Created July 19, 2019 13:31
Show Gist options
  • Save DPeterK/11a2271b160c8debe4c77dda3334f24b to your computer and use it in GitHub Desktop.
Save DPeterK/11a2271b160c8debe4c77dda3334f24b to your computer and use it in GitHub Desktop.
CuPy and Iris
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/lib/iris/_data_manager.py b/lib/iris/_data_manager.py
index 8f6e9e4e..8cbeac18 100644
--- a/lib/iris/_data_manager.py
+++ b/lib/iris/_data_manager.py
@@ -270,13 +270,13 @@ class DataManager(object):
self._lazy_array = data
self._real_array = None
else:
- if not ma.isMaskedArray(data):
- # Coerce input data to ndarray (including ndarray subclasses).
- data = np.asarray(data)
- if isinstance(data, ma.core.MaskedConstant):
- # Promote to a masked array so that the fill-value is
- # writeable to the data owner.
- data = ma.array(data.data, mask=data.mask, dtype=data.dtype)
+# if not ma.isMaskedArray(data):
+# # Coerce input data to ndarray (including ndarray subclasses).
+# data = np.asarray(data)
+# if isinstance(data, ma.core.MaskedConstant):
+# # Promote to a masked array so that the fill-value is
+# # writeable to the data owner.
+# data = ma.array(data.data, mask=data.mask, dtype=data.dtype)
self._lazy_array = None
self._real_array = data
diff --git a/lib/iris/analysis/__init__.py b/lib/iris/analysis/__init__.py
index 0a5265e9..85c95a79 100644
--- a/lib/iris/analysis/__init__.py
+++ b/lib/iris/analysis/__init__.py
@@ -1485,7 +1485,7 @@ This aggregator handles masked data.
"""
-MEAN = WeightedAggregator('mean', ma.average,
+MEAN = WeightedAggregator('mean', np.mean,
lazy_func=_build_dask_mdtol_function(da.mean))
"""
An :class:`~iris.analysis.Aggregator` instance that calculates
@@ -1736,7 +1736,7 @@ This aggregator handles masked data.
"""
-SUM = WeightedAggregator('sum', iris._lazy_data.non_lazy(_lazy_sum),
+SUM = WeightedAggregator('sum', np.sum,
lazy_func=_build_dask_mdtol_function(_lazy_sum))
"""
An :class:`~iris.analysis.Aggregator` instance that calculates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment