[ncl-talk] computing using dim_stat4_n (/0.1/)

Dennis Shea shea at ucar.edu
Tue Nov 12 08:27:35 MST 2019


   dimx = *dimsizes*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>
(xAnom1)
   ntim = dimx(0)          ; 240
   nens = dimx(1)         ; 100
   nlat   = dimx(2)         ; 45
   mlon = dimx(3)         ; 90

   nmos = 12
   nyrs   = ntim/nmos        ; 20

   xClmMonEns = new((/nmos,nlat,mlon/), typeof(xAnom1), xAnom1 at _FillValue)
   xStdMonEns  = new((/nmos,nlat,mlon/), typeof(xAnom1), xAnom1 at _FillValue)
   xSkwMonEns = new((/nmos,nlat,mlon/), typeof(xAnom1), xAnom1 at _FillValue)
   xKurMonEns  = new((/nmos,nlat,mlon/), typeof(xAnom1), xAnom1 at _FillValue)

   do nmo=0,nmos-1
      work := *reshape*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/reshape.shtml>(xAnom1(
*nmo::nmos*,:,:,:) ,(/nyrs*nens,nlat,mlon/))
      if (nmo.eq.0) then
          printVarSummary(work)            ; (2400,45,90)
      end if
      xStat =* dim_stat4_n
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_stat4_n.shtml>*(work,0
)       *; (4,nlat,mlon)*
      xClmMonEns(nmo,:,:) = xStat(0,:,:)
      xStdMonEns(nmo,:,:)  = xStat(1,:,:)
      xSkwMonEns(nmo,:,:) = xStat(2,:,:)
      xKurMonEns(nmo,:,:)  = xStat(3,:,:)
   end do

On Tue, Nov 12, 2019 at 4:57 AM Sri.durgesh Nandini-Weiss via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hello all,
>
> I am trying to ; Compute first four moments (average, variance,
> skewness, and kurtosis) based on SSH anomalies
>
> which are in this format: [time | 240] x [ens | 100] x [lat | 45] x [lon
> | 90].
>
> I am successful in computing and plotting it using this code:
>
>     xStat = dim_stat4_n(xAnom1,1)                    ; computing on  ens
> dimension, without looping (4,ntim,nlat,mlon)
>     printVarSummary(xStat)
>     printMinMax(xStat,0)
>
>     xClmMonEns = xStat(0,:,:,:)
>     xStdMonEns = xStat(1,:,:,:)
>     xSkwMonEns = xStat(2,:,:,:)
>     xKurMonEns = xStat(3,:,:,:)
>
>     copy_VarCoords(x(:,0,:,:), xClmMonEns)
>     copy_VarCoords(x(:,0,:,:), xStdMonEns)
>     copy_VarCoords(x(:,0,:,:), xSkwMonEns)
>     copy_VarCoords(x(:,0,:,:), xKurMonEns)
>
> The output is (4,ntim,nlat,mlon) because i used xStat =
> dim_stat4_n(xAnom1,1) ,
>
> if i used xStat = dim_stat4_n(xAnom1,0) than it (4,ens,nlat,mlon).
>
> What i want is xStat = dim_stat4_n(xAnom1,(/0,1/)) to only get
> (4,nlat,mlon), but this does not seem possible and i get the following
> error:
>
> warning:dim_stat4_n: 975 rightmost sections of the input array contained
> all missing values.
> Output values set to missing in these sections
>
> and the xStat is  [4] x [45] x [90] x [49]
>
> Can someone please help me with this?
>
> Thanx
>
> Sri
>
>
>
>
>
> --
> Sri Nandini-Weiß
> Research Scientist
>
> Universität Hamburg
> Center for Earth System Research and Sustainability (CEN)
> Cluster of Excellence 'Climate, Climatic Change, and Society' (CLICCS)
>
> Bundesstrasse 53, 20146 Hamburg
> Tel: +49 (0) 40 42838 7472
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191112/d19d08cb/attachment.html>


More information about the ncl-talk mailing list