[ncl-talk] specx_ci error if applied for a vector

Ioana Colfescu ioana.colfescu at ncas.ac.uk
Tue Oct 31 14:53:27 MDT 2017


Thanks very much.
I did not realize the loop overwrites the iteration  because was in a
vector so I thought it just keeps every value separately. It works now.
Thanks for pointing out the huge tapering value - I was wondering why the
spectra looked really weird.
Cheers,
Ioana

On 31 October 2017 at 14:42, Dennis Shea <shea at ucar.edu> wrote:

> The 'specx_anal' returns a *scalar* [degrees of freedom] and multiple
> attributes including the spectrum ( spc[*] ).
>
>    https://www.ncl.ucar.edu/Document/Functions/Built-in/specx_anal.shtml
>
> Each iteration of your loop *overwrites* the previous iteration's
> attributes. Please do a 'printVarSummary' after the loop
>
> spec=new((/nn,64/),"double")             ; wrong
> do ii=0,nn(0)-1
>       spec(ii,:) = specx_anal(indextotal(ii,:),d,sm,pct)
> end do
>
> ----
> A taper of 0.7 means 70% of the values will be tapered. That is extremely
> large. Usually, taper ~ 0.1
> Maybe
>
> maxconf=0.95
> minconf=0.05
> d = 0
> sm = 3
> pct = 0.10
> do ii=0,nn-1
>       sdof= specx_anal(indextotal(ii,:),d,sm,pct)
>
>        xx=specx_ci(sdof,minconf,maxconf)
>
>        ;plot or whatever
> end do
>
> ===
> https://www.ncl.ucar.edu/Document/Functions/Shea_util/specx_ci.shtml
>
> is prototyped as:
>
> function specx_ci (
> 		sdof     : numeric,
> 		lowval   : numeric,
> 		highval  : numeric
> 	)
>
>
> That should be
>
> function specx_ci (
> 		sdof[1]  : numeric,           <=== scalar
> 		lowval   : numeric,
> 		highval  : numeric
> 	)
>
>
>  Good luck
>
> On Tue, Oct 31, 2017 at 8:00 AM, Ioana Colfescu <ioana.colfescu at ncas.ac.uk
> > wrote:
>
>> Hi,
>> I'm trying to use specx_ci for a vector of values that are the output of
>> specx_anal.
>> If I do it individually ( for every vector component) it works but when I
>> do try to apply it for the entire vector I get the following error.
>>
>> fatal:chiinv: The two input arrays must have the same dimension sizes
>>
>> Can anyone tell me how to fix this and what's going on ?
>> My code is below and the part where I get the error from is in red.
>> Thanks.
>>
>> begin
>> amo = addfile("int_ext_AMO_anom.1871-1998.nc","r")
>> index0=amo->AMO_Cext
>> index1=amo->AMO_C1int
>> index2=amo->AMO_C2int
>> index3=amo->AMO_C3int
>> index4=amo->AMO_C4int
>> indextotal=(/index0,index1,index2,index3,index4/)
>> nn=dimsizes(indextotal)
>> ;*************
>> d = 0
>> sm = 3
>> pct = 0.70
>>
>> spec=new((/nn(0),64/),"double")
>> do ii=0,nn(0)-1
>> spec(ii,:) = specx_anal(indextotal(ii,:),d,sm,pct)
>> end do
>>
>> maxconf=0.95
>> minconf=0.05
>> printVarSummary(spec)
>> xx=specx_ci(spec(0,:),minconf,maxconf)
>>
>>
>>
>> *Ioana Colfescu  *
>> Research Scientist
>> National Centre for Atmospheric Science
>> School of Earth and Environment
>> University of Leeds
>>
>>
>> _______________________________________________
>> 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/20171031/4f599873/attachment.html>


More information about the ncl-talk mailing list