def setArray(self, incomingArray, copy=False):
"""
You can use the self.array directly but if you want to copy from one array
into a raster we suggest you do it this way
:param incomingArray:
:return:
"""
masked = isinstance(self.array, np.ma.MaskedArray)
if copy:
if masked:
self.array = np.ma.copy(incomingArray)
else:
self.array = np.ma.masked_invalid(incomingArray, copy=True)
else:
if masked:
self.array = incomingArray
else:
self.array = np.ma.masked_invalid(incomingArray)
self.rows = self.array.shape[0]
self.cols = self.array.shape[1]
self.min = np.nanmin(self.array)
self.max = np.nanmax(self.array)
评论列表
文章目录