[ncl-talk] Array operation to compute average week anomalies of sst mistake
Sebastian Otarola-Bustos
Sebastian.F.Otarola-Bustos.1 at nd.edu
Wed Aug 5 12:02:30 MDT 2015
Hi everybody, I'm doing very simple array operations, but it seems that NCL
doesn't agree with me, and I'm getting very wrong numbers.
Here is the code I'm refering too:
I'm trying to make a weekly average of daily sst temperatures, so sst is(
times, lat,lon), then I define a 2D array(lat,lon) , sst_avg, and
initializes with 0 , up to now everythings goes ok. But in this case, after
the orange do sst_average is still full with zeros. Finally, I'm just
trying to divide each element of sst_avg by number of times(days), so I'll
get the average. But this not work. And it's seems to be very basic error.
Any help would be really appreciated.
sst = a->anom(:,:,:)
printVarSummary(sst)
times=dimsizes(sst(:,0,0))
row = dimsizes(sst(0,:,0))
col = dimsizes(sst(0,0,:))
sst_avg = new((/row,col/),"float",0)
do it =0,times-1
sst_avg(:,:)=sst_avg(:,:)+sst(it,:,:)
end do
print(sst_avg)
sst_avg(:,:)=sst_avg(:,:)/times ; Calculo anomalia semanal promedio
All the best,
Sebastián.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150805/3a300f95/attachment.html
More information about the ncl-talk
mailing list