[ncl-talk] loop memory issue
David Craig
dcdavemail at gmail.com
Sun Feb 8 06:25:08 MST 2015
Hi,
I have a loop in NCL that randomises an array and preforms some
operations on the result. However, it seems to be using too much memory
and I don't understand why as all variables are preallocated. Does
anyone know what the problem is, code is below.
thanks,
David
n = 1000
rand_HS = HS_reorder(:,:,1:) ; size 317x720x240
dms = dimsizes(rand_HS)
m = dms(2)
; preallocate array for maximum coefficient values
max_rand_ccr = new(n,float)
i = 0
do while(i.lt.n)
j = 0
do while(j.lt.m) ; loop through time
; randomise in space
ix = generate_sample_indices( dms(0), 0 )
iy = generate_sample_indices( dms(1), 0 )
rand_HS(:,:,j) = rand_HS(ix, iy, j)
j=j+1
end do
;calculate max correlation coefficient
max_rand_ccr(i) = max(abs(escorc(data2,rand_HS)))
i=i+1
end do
More information about the ncl-talk
mailing list