這裏的錯誤:在範圍對於j(LEN(rotlati)):類型錯誤:類型 '浮動' 對象沒有LEN()
類型錯誤:類型 '浮動' 的對象沒有LEN()
我見過很多其他帖子,但我還沒有找到解決方案。 我有點困惑。如果你知道這裏發生了什麼,請發表評論。
的代碼是:
m = 22
rlati = numpy.zeros(m)
n = 22
rlongi = numpy.zeros(n)
v = numpy.ndarray((2,),float)
for j in range (len(lati)):
LA = lati[j]
rlati[j] = LA - latiref
for i in range (len(longi)):
LO = longi[i]
rlongi[i] = LO - longiref
v[0] = rlati[j]
v[1] = rlongi[i]
vv = numpy.matrix(v)
#transpose of vv as vv.T
vv = vv.T
#proper rotation
vn = R*vv
#define how many decimals
vn = numpy.around(vn, decimals =2)
# rotation of the second column (lati) and third line (longi)
rotlati = float(vn[0])
rotlongi = float(vn[1])
s = 22
latidef = numpy.zeros(s)
p = 22
longidef = numpy.zeros(p)
for j in range (len(rotlati)):
RLA = rotlati[j]
latidef[j] = RLA + latiref
for i in range (len(rotlongi)):
RLO = rotlongi[i]
longidef[i]= RLO + longiref
RLADEF = latidef[j]
RLODEF = longidef[i]
return RLADEF, RLODEF
嘛,'rotlati'是'float',不支持'LEN()'。你不明白什麼? –