[ncl-talk] standard deviation over ensemble dimension
Dennis Shea
shea at ucar.edu
Fri Mar 19 12:44:58 MDT 2021
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> 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", "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@
> _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
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210319/fe12ba24/attachment.html>
More information about the ncl-talk
mailing list