cf.hash_array¶
-
cf.
hash_array
(array)[source]¶ Return the hash value of a numpy array.
The hash value is dependent on the data type, 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 is not guaranteed to be portable across versions of Python, numpy and cf.
- Parameters
- array:
numpy.ndarray
The numpy array to be hashed. May be a masked array.
- array:
- Returns
int
The hash value.
Examples:
>>> print(array) [[0 1 2 3]] >>> cf.hash_array(array) -8125230271916303273 >>> array[1, 0] = numpy.ma.masked >>> print(array) [[0 -- 2 3]] >>> cf.hash_array(array) 791917586613573563 >>> array.hardmask = False >>> array[0, 1] = 999 >>> array[0, 1] = numpy.ma.masked >>> cf.hash_array(array) 791917586613573563 >>> array.squeeze() >>> print(array) [0 -- 2 3] >>> cf.hash_array(array) -7007538450787927902 >>> array.dtype = float >>> print(array) [0.0 -- 2.0 3.0] >>> cf.hash_array(array) -4816859207969696442