cf.Data.__hash__¶
-
Data.
__hash__
()[source]¶ The built-in function
hash
.Deprecated at version 3.14.0. Consider using the
cf.hash_array
function instead.Generating the hash temporarily realises the entire array in memory, which may not be possible for large arrays.
The hash value is dependent on the data-type and shape of the data array. If the array is a masked array then the hash value is independent of the fill value and of data array values underlying any masked elements.
The hash value may be different if regenerated after the data array has been changed in place.
The hash value is not guaranteed to be portable across versions of Python, numpy and cf.
- Returns
int
The hash value.
Examples
>>> print(d.array) [[0 1 2 3]] >>> d.hash() -8125230271916303273 >>> d[1, 0] = numpy.ma.masked >>> print(d.array) [[0 -- 2 3]] >>> hash(d) 791917586613573563 >>> d.hardmask = False >>> d[0, 1] = 999 >>> d[0, 1] = numpy.ma.masked >>> d.hash() 791917586613573563 >>> d.squeeze() >>> print(d.array) [0 -- 2 3] >>> hash(d) -7007538450787927902 >>> d.dtype = float >>> print(d.array) [0.0 -- 2.0 3.0] >>> hash(d) -4816859207969696442