dask: `Data.datum` by davidhassell · Pull Request #332 · NCAS-CMS/cf-python

Expand Up @@ -10443,6 +10443,7 @@ def in_memory(self):
return True
@daskified(_DASKIFIED_VERBOSE) def datum(self, *index): """Return an element of the data array as a standard Python scalar. Expand Down Expand Up @@ -10558,15 +10559,13 @@ def datum(self, *index): index = tuple(index) else: raise ValueError( "Incorrect number of indices for {} array".format( self.__class__.__name__ ) f"Incorrect number of indices ({n_index}) for " f"{self.ndim}-d {self.__class__.__name__} data" ) elif n_index != self.ndim: raise ValueError( "Incorrect number of indices for {} array".format( self.__class__.__name__ ) f"Incorrect number of indices ({n_index}) for " f"{self.ndim}-d {self.__class__.__name__} data" )
array = self[index].array Expand All @@ -10576,8 +10575,8 @@ def datum(self, *index):
else: raise ValueError( "Can only convert a {} array of size 1 to a " "Python scalar".format(self.__class__.__name__) f"For size {self.size} data, must provide an index of " "the element to be converted to a Python scalar" )
if not np.ma.isMA(array): Expand Down