[ncl-talk] standard deviation over ensemble dimension

Sri nandini bax8609 at uni-hamburg.de
Sun Mar 21 07:01:09 MDT 2021


Hello,

My question indeed was not clear.

My question is: how can i make a standard deviation plot from my data by 
averaging all the STDs over the ensemble members. So i want to get a 100 
standard deviations because i have a 100 members.

e.g. my data is in the format of x=time|240, ensemble|100, lat, lon]

x=(1632:1871,:,{40},{-20}) ===>x=[240,100]

ntim = 240 ==>months
nens=100  ===>ensemble members

   ;Compute monthly standard deviations on invidividual ensemble members

   do n=0, nens-1
   histanom1(:n)=dim_stddev_n_Wrap(x(:,n),1)
   end do

   printVarSummary(hist_anom1)   ==> should be in [240,100]

  How can i modify this loop to compute 100 standard deviation from the 
ensemble members?
  and than average this?

  std_ensavg=dim_avg_n(histanom1,1)
  printVarSummary(std_ensavg)   ==> should result in [240]



On 19.03.21 19:44, Dennis Shea wrote:
> Your question is not clear.
>
> printVarSummary(hist_anom)   ==> (ntim,nens)   ==>    (0,1)
>
> ntim = 240
>
> nmos = 12
> nyrs   = ntim/nmos
> ---
> ?????
> ---
>
>   xstdens = new(nmos,typeof(hist_anom),....)
>   do nmo=0,nmos-1
>        work               = hist_anom(nmo::nmos,0)     ; nmo=0 -> all 
> Januaries, nmo=1 ->all Feb; ...
>        xstdens(nmo) = dim_stddev_n(work)
>      ;;xstdens(nmo) = dim_stddev_n(hist_anom(nmo::nmos,0))
>     end do
>      xstdens at long_name = "Monthly Ensemble Std. Deviation: "+nyr+" years"
>      xstdens at units = hist_anom at units
> =====
>
>
>  ystdens  = dim_stddev_n_Wrap(hist_anom, 1)    ; at each time, average 
> all ensemble members
>  printVarSummary(ystdens)      ; (ntim)
>
> =======
>  zstdens  = dim_stddev_n_Wrap(hist_anom, 0)    ; for each ensemble 
> member , average all times
>  printVarSummary(zstdens)      ; (nens)
>
> ========
>  ??????
>
> On Fri, Mar 19, 2021 at 9:53 AM Sri nandini via ncl-talk 
> <ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu>> wrote:
>
>     Hello dear ncl users,
>
>     I am trying to compute standard deviation over individual ensemble
>     dimension of my data [time|240,ens|100,lat,lon] and than averaging
>     the
>     STDs over the ensemble members but have error on my code:
>     fatal:Dimension size mismatch on subscript #2, left-hand and
>     right-hand
>     side dimensions do not match
>
>     f     = addfile ("Hist_monthly_corrected_pi_trend.nc
>     <http://trend.nc>", "r")
>        hist_anom    = f->hist_trend(1632:1871,:,{40},{-60})
>        printVarSummary(hist_anom)
>        hist_anom =hist_anom*100
>          dimx = dimsizes(hist_anom)
>        ntim = dimx(0)          ; 240
>        nens = dimx(1)          ; 100
>        nlat = dimx(2)
>        nlon = dimx(3)
>        print("============")
>
>
>        ;Compute monthly standard deviations
>         xEnsMonStd = new((/nens,ntim/), typeof(hist_anom),
>     hist_anom at _FillValue)
>         do ne=0,nens-1                      ; loop over each ensemble
>     member
>           do n=0,ntim-1                      ; loop over each month for
>     current member
>              work = hist_anom(n,ne)     ; convenience and efficiency
>              xEnsMonStd(ne,n) = dim_stddev_n(work,0) ; ensemble std
>           end do
>         end do
>
>     The xEnsMonStd should be in the format of [time|240, ens|100]
>
>           rcp45_ensavg=dim_avg_n(xEnsMonStd,0)
>          printVarSummary(rcp45_ensavg)
>          copy_VarCoords(hist_anom45(:,0), rcp45_ensavg)
>          printVarSummary(rcp45_ensavg)
>
>     Can someone help me out with this?
>
>     Sri
>
>
>
>
>     -- 
>     Sri, Nandini-Weiss
>     Research Associate
>
>     Universität Hamburg
>     Center for Earth System Research and Sustainability (CEN)
>     Cluster of Excellence 'Climate, Climatic Change, and Society' (CLICCS)
>
>     Bundesstrasse 53, 20146 Hamburg
>
>     _______________________________________________
>     ncl-talk mailing list
>     ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu>
>     List instructions, subscriber options, unsubscribe:
>     https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>     <https://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
-- 
Sri, Nandini-Weiss
Research Associate

Universität Hamburg
Center for Earth System Research and Sustainability (CEN)
Cluster of Excellence 'Climate, Climatic Change, and Society' (CLICCS)

Bundesstrasse 53, 20146 Hamburg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210321/a9e2a91b/attachment.html>


More information about the ncl-talk mailing list