[ncl-talk] standard deviation over ensemble dimension

Sri nandini bax8609 at uni-hamburg.de
Fri Mar 19 09:53:20 MDT 2021


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", "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



More information about the ncl-talk mailing list