# [ncl-talk] dim_stat_n calculation over time,lev dimension

Sri nandini bax8609 at uni-hamburg.de
Tue Sep 8 04:47:50 MDT 2020

I solved this issue.

On 08.09.20 11:18, Sri nandini via ncl-talk wrote:
> Hello ncl-users,
>
> I am computing for skewness and kurtosis over the time and lev
> dimensions in my data. I want to use this output to plot a scatter
> plot of skewness versus kurtosis and i am using the ncl dim_stat_n
> function to compute this.
>
> I am stuck in my code at this function, see the entire code below:
>
> f     = addfile ("Hist_monthly_corrected_pi_trend.nc", "r")
>   hist_anom    = f->hist_trend({1192152:1366728},:,:,:)
>
>   hist_anom=hist_anom*100
>   printVarSummary(hist_anom)
>   dimx = dimsizes(hist_anom)
>   ntim = dimx(0)          ; 240
>   nens = dimx(1)          ;100
>   nlat = dimx(2)           ; 45
>   mlon = dimx(3)         ; 90
>   nmos = 12
>   nyrs = ntim/nmos        ; 20
>
>   hist_ensavg=dim_avg_n(hist_anom,1)
>   printVarSummary(hist_ensavg)
>   hist_anom1 = hist_anom
>   do n=0,nens-1
>   hist_anom1(:,n,:,:) = hist_anom(:,n,:,:) - hist_ensavg
>   end do
>   printVarSummary (hist_anom1)
>
>  do nmo=0,nmos-1
>       work := reshape(hist_anom1(nmo::nmos,:,:,:)
> ,(/nyrs*nens,nlat,mlon/))
>           printVarSummary(work)                            ; (2000,45,90)
>    end do
>      copy_VarCoords(hist_anom1(0,0,:,:), work(0,:,:))
>         printVarSummary(work)
>
>   TTstat11 = dim_stat4_n(work, (/1,2/))
>    printVarSummary(TTstat11)
>
> This results in :
>
> Variable: TTstat11
> Type: float
> Total Size: 0 bytes
>             0 values
> Number of Dimensions: 3
> Dimensions and sizes:    [4] x [2000] x [0]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :    -9.96921e+36
>
> How can i compute this to result in skewness (2000) to plot as a
> scatter plot?
>
> Best
>
> Sri
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk