[ncl-talk] Composite Standard Deviation

Dennis Shea shea at ucar.edu
Wed Mar 30 15:20:37 MDT 2016


You can look at the code for the  {clm,std}MonTLL functions. They are
located in the contributed.ncl

%> less $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl

These were (I think)  the 1st application functions introduced to NCL
(~1998 or so).

Perhaps, I misunderstand
===
[1] Maybe square the results from stdMonTLL ===> variances <== add meta data
[2] Compute average of variances: *dim_avg_n_Wrap(monVar,(/1,2/))*; then
take the square root


*==*
Maybe the following*, ...* extract the code for function

function calculate_monthly_values (x:numeric, arith:string,
nDim[1]:integer, opt[1]:logical)


[SNIP]
    if (.not.(arith.eq."ave" .or. arith.eq."avg" .or. arith.eq."sum"  \
                             .or. arith.eq."min" .or. arith.eq."max") ) then
        print("calculate_monthly_values: unrecognizezed 'arith'
argument="+arith)
        exit
    end if
[SNIP]

add, (s) "var" and/or "stddev"

    if (.not.(arith.eq."ave" .or. arith.eq."avg" .or. arith.eq."sum"  \
                                      .or. arith.eq."min" .or.
arith.eq."max"  \
                                       or. arith.eq."var" .or.
arith.eq."stddev")  ) then


then, later, add

                if (arith.eq."var") then
                     if (nit.gt.1) then ; work around for NCL's dimension
reduction
                         xStat(nt)  = dim_variance_n( x(it), nDim)
                     else               ; one 'it'
                         xStat(nt)  = 0.0                ; variance for one
observation
                     end if
                 end if

and/or

                if (arith.eq."stddev") then
                     if (nit.gt.1) then ; work around for NCL's dimension
reduction
                         xStat(nt)  = dim_stddev_n( x(it), nDim)
                     else               ; one 'it'
                         xStat(nt)  = 0.0              ; std dev for one
observation
                     end if
                 end if

===

HTH











On Wed, Mar 30, 2016 at 10:36 AM, Samar Min Allah <minallah at umich.edu>
wrote:

>
> Hi,
>
> I have daily data (time, lat, lon) that I am first converting to monthly
> using *calculate_monthly_values *and then finding monthly climatology
> from *clmMonTLL *and std from
>
> *stdMonTLL.*
> ​The daily data is over a sub-basin for which I take an average later​
> using *dim_avg_n_Wrap(monclim,(/1,2/)) *over all lats and lons.
>
> ​This works for the mean climatology but I cannot take a mean for the
> standard deviation this way so is there a function or example that can
> compute composite standard deviation.​
>
> ​Alternatively, is there a function clmMon and stdMon that can work on 1
> dimension data (does not require lat lon)​.
>
>
>
> --
> Samar
>
>
> _______________________________________________
> 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/20160330/304f0da7/attachment.html 


More information about the ncl-talk mailing list