NOW! lets try something completely different which may simplify a few steps, like the float to in stuff...
I had this one buried
>>> # and now for something completely different....
>>> r = 100
>>> c = 120
>>> z = np.abs(100 * np.random.random_sample((r,c)) -100) # make an array with rand 0-100
>>> np.save("f:/test/Rebecca/z_7_14k.npy",z)
>>> # ----- compare ---- select
>>> condlist = [z<20, z<40, z<60, z<80, z>=80]
>>> choicelist = [20,40,60,80,100]
>>> z_rc = np.select(condlist, choicelist)
>>>
>>> np.set_printoptions(edgeitems=5,linewidth=100,precision=1,suppress=True,threshold=200)
>>>
>>> z
array([[ 71.8, 39.9, 58.4, 8.1, 95.6, ..., 49. , 56.7, 16. , 64.8, 16.4],
[ 92. , 44.8, 5.2, 22.8, 83.2, ..., 57.4, 81. , 39.5, 99.7, 45.9],
[ 68.2, 43.3, 72. , 57.7, 30.6, ..., 80.7, 82.6, 30.5, 89.6, 7. ],
[ 44.6, 86.8, 59.7, 1.4, 83.1, ..., 41.8, 54.8, 64.7, 82.4, 7. ],
[ 91. , 84.6, 33.5, 23.6, 53.1, ..., 63.9, 70.9, 28.4, 99.4, 19.6],
...,
[ 58.6, 92.7, 2. , 28.6, 78.8, ..., 8.9, 59.4, 71.5, 42.2, 47.8],
[ 6.7, 80.6, 6.2, 81.5, 18.1, ..., 10.9, 71.7, 43.3, 38.6, 7.5],
[ 90.7, 26.8, 89. , 46.9, 64.4, ..., 6.6, 16.6, 54.3, 70.6, 46.9],
[ 74.7, 85.1, 54.5, 24. , 75.9, ..., 16.2, 89.5, 99.7, 83.3, 0.3],
[ 60.6, 0.7, 52.6, 23.4, 42.7, ..., 66.9, 15.5, 88.1, 57.5, 55.5]])
>>> z_rc
array([[ 80, 40, 60, 20, 100, ..., 60, 60, 20, 80, 20],
[100, 60, 20, 40, 100, ..., 60, 100, 40, 100, 60],
[ 80, 60, 80, 60, 40, ..., 100, 100, 40, 100, 20],
[ 60, 100, 60, 20, 100, ..., 60, 60, 80, 100, 20],
[100, 100, 40, 40, 60, ..., 80, 80, 40, 100, 20],
...,
[ 60, 100, 20, 40, 80, ..., 20, 60, 80, 60, 60],
[ 20, 100, 20, 100, 20, ..., 20, 80, 60, 40, 20],
[100, 40, 100, 60, 80, ..., 20, 20, 60, 80, 60],
[ 80, 100, 60, 40, 80, ..., 20, 100, 100, 100, 20],
[ 80, 20, 60, 40, 60, ..., 80, 20, 100, 60, 60]])
>>>
You can try it yourself... obviously, I kept the reclass classes as the upper value of the reclass range to make it easy to see...
ie
71.8 is < 80 (but > 60)
39.9 is < 40 (but > 20)
58.4 is < 60 (but > 40)
ad nauseum
NOTE your choicelist is what you want them reclassed to 'could be any thing'
>>> choicelist = ['I','am','so','confused','Dan']
>>> z_rc2 = np.select(condlist, choicelist)
>>> z_rc2
array([['confused', 'am', 'so', 'I', 'Dan', ..., 'so', 'so', 'I', 'confused', 'I'],
['Dan', 'so', 'I', 'am', 'Dan', ..., 'so', 'Dan', 'am', 'Dan', 'so'],
['confused', 'so', 'confused', 'so', 'am', ..., 'Dan', 'Dan', 'am', 'Dan', 'I'],
['so', 'Dan', 'so', 'I', 'Dan', ..., 'so', 'so', 'confused', 'Dan', 'I'],
['Dan', 'Dan', 'am', 'am', 'so', ..., 'confused', 'confused', 'am', 'Dan', 'I'],
...,
['so', 'Dan', 'I', 'am', 'confused', ..., 'I', 'so', 'confused', 'so', 'so'],
['I', 'Dan', 'I', 'Dan', 'I', ..., 'I', 'confused', 'so', 'am', 'I'],
['Dan', 'am', 'Dan', 'so', 'confused', ..., 'I', 'I', 'so', 'confused', 'so'],
['confused', 'Dan', 'so', 'am', 'confused', ..., 'I', 'Dan', 'Dan', 'Dan', 'I'],
['confused', 'I', 'so', 'am', 'so', ..., 'confused', 'I', 'Dan', 'so', 'so']],
dtype='<U11')