登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 黄小仙儿2 于 2014-7-2 17:40 编辑
分享分享: Find the latitude and longitude location of the maximum value in a two dimensional array. ;---X is a two dimensional array dimensioned lat x londims = dimsizes(X)
x1d = ndtooned(X) ; convert 2D array to 1D for use in maxind
inds = ind_resolve(maxind (x1d), dims) ; convert 1D array back to 2D
ilat = inds(0,0) ; select the latitude index where the X array is at its' maximum
ilon = inds(0,1) ; select the longitude index where the X array is at its' maximum
lat_max = X&lat(ilat) ; insert the latitude index into the lat coordinate variable
lon_max = X&lon(ilon) ; insert the longitude index into the lon coordinate variable
print("Maximum value located at "+lat_max+", "+lon_max)
|