[ncl-talk] Bug with kolsm2_n and multiple dimension arrays

Mary Haley haley at ucar.edu
Thu Jun 25 14:44:08 MDT 2015


I want to alert folks about a bug that a user found in kolsm2_n.

This bug has been fixed and will be in the V6.3.1 release. There's no
scheduled release date yet; let us know if you need a fix now.

The bug occurs if you are using multiply dimensioned arrays.

For example, assume TS_2 is nyears1 x nlat x nlon  and TS_3 is nyears2 x
nlat x nlon. This single line would illustrate the bug:

ks = *kolsm2_n*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/kolsm2_n.shtml>
(TS_2,TS_3,0)

The TS_2 and TS_3 arrays will incorrectly have the same values across all
elements.

You can work around this by using loops, which will be slower, but correct:

dims = dimsizes(TS_2)
nlat = dims(1)
nlon = dims(2)
ks   = new((/nlat,nlon/),typeof(TS_2))
ds   = new((/nlat,nlon/),typeof(TS_2))
zs   = new((/nlat,nlon/),typeof(TS_2))

do ilat = 0, nlat-1
  do ilon = 0, nlon-1
    ks_single     = *kolsm2_n*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/kolsm2_n.shtml>
(TS_2(:,ilat,ilon),TS_3(:,ilat,ilon),0)

    ks(ilat,ilon) = ks_single
    ds(ilat,ilon) = ks_single at dstat
    zs(ilat,ilon) = ks_single at zstat
    end do
end do

We regret the error. Many thanks to Andrew Conley for reporting it to us
and providing a sample script to illustrate the problem.

--Mary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150625/a161bd16/attachment.html 


More information about the ncl-talk mailing list