[ncl-talk] Can't add arrays to do average.
Sebastian Otarola-Bustos
Sebastian.F.Otarola-Bustos.1 at nd.edu
Wed Sep 30 17:34:41 MDT 2015
Hi everybody, I'm working with NOA high resolution daily sea surface
temperature anomalies. I have 3D variable sst(days,lat,lon) and want to
compute average for the week, so I created sst_avg(lat,lon) float 2D array
full with zeros, to save the sum of all days in this variable( very
simple). But the problem is that this sum is not working so sst_avg is full
of zeros after the operation.
The main features of the code arre below:
*sst = a->anom*
*dims = dimsizes(sst)*
*times = dims(0)*
*row = dims(1)*
*col = dims(2)*
*sst at _FillValue = 0.*
*sst_avg = new((/row,col/),"float",0.)*
*sst_avg at _FillValue = 0.*
*copy_VarCoords(sst(0,:,:),sst_avg)*
* printVarSummary(sst) do it =0,times-1*
* sst_avg = sst_avg + sst(it,:,:)*
* print(sst_avg)*
* end do*
*printVarSummary(sst_avg)*
sst.PNG, and sst_avg.PNG show the information of sst and sst_avg after the
iteration.
I thought that has something to do with @FillValue, but I changed this and
the only thing I got was very huge and nonsense numbers instead of sst_avg
full with zeros.
P.S: I know there are nicer ways of computing average, but my doubt is
mainly about the sum that is not working. Thank you very much in advance
and any help would be really appreciated.
All the best,
Sebastián.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150930/3ca4c71f/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sst.PNG
Type: image/png
Size: 16754 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150930/3ca4c71f/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sst_avg.PNG
Type: image/png
Size: 6882 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150930/3ca4c71f/attachment-0001.png
More information about the ncl-talk
mailing list