I have a problem with my for-loops in IDL.
for sl=0,2 do begin ; number of hours
for t=90,90 do begin ; timesteps each hour
for rad_num = 0, 3 do begin ; number of radars
for ibin = 0, 333 do begin ; distance to radar
for iray = 0, 359 do begin ; angle
if finite(input(ibin,iray,rad_num)) eq 1 then begin
bin = bin_index(ibin,iray,rad_num)
ray = ray_index(ibin,iray,rad_num) ; necessary because of different grids
array(sl,t,ray,bin)=array(sl,t,ray,bin)+ input(ibin,iray,rad_num)
array_N(sl,t,ray,bin) = array_N(sl,t,ray,bin) + 1.
endif
endfor
endfor
endfor
endfor
endfor
array = array / array_N
When I stopped the program after the first sl-loop-step, I get the following:
print, array[0,90,315,49]
44.0.673
But when I don't stop the program, I get this:
print, array[0,90,315,49]
-NaN
It seems, that my program overwrites the data of the previous loop-step. When I make a scatter-plot, I also have the points of the last loop-step only...
Do you see my mistake? Thanks a lot! kiki