print type(grid) <type 'numpy.ndarray'>
[[ 5.4 7.5 2.2 8.5 8.6 7.5] [ 7.7 3.5 1.4 9.6 8.5 5.5] [ 5.2 6.1 8.6 6.7 4.3 6.8] [ 9.3 4.5 2.7 3.6 6.7 4.5] [ 1.2 2.3 7.2 6.3 2.2 2. ] [ 1.3 2. -99. 4. -99. 1.2]]
nrows=6 ncols=6 for row in range(0, nrows -1, 1): for col in range(0, ncols -1, 1): # current 2x2 subgrid curgrid = {grid[row,col]:(row,col), grid[row, col+1]:(row, col+1),\ grid[row+1,col]:(row+1,col), grid[row+1, col+1]:(row+1, col+1)} # set max of current subgrid in the totalgrid to 0 grid[curgrid[max(curgrid)]] = 0
[[ 5.4 0. 2.2 8.5 0. 7.5] [ 0. 3.5 1.4 0. 0. 5.5] [ 5.2 0. 0. 0. 0. 0. ] [ 0. 0. 2.7 0. 0. 0. ] [ 1.2 0. 0. 0. 0. 0. ] [ 1.3 0. -99. 0. -99. 0. ]]
itemindex=numpy.where(array==item)
>>> from numpy import * >>> a = array([10,20,30]) >>> a.max() 30 >>> a = array([[10,50,30],[60,20,40]]) >>> a.max() 60
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.