Re: mean power spectrum

From: <yjin7_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 18 2014 - 16:23:20 MDT

Hi Dennis,

Thank you very much for your help. But When I used the code in Example 5, there is still a problem.

In my code, I defined pw=pc2dT, which has the following information:
;---------------------------------------
Variable: pc2dT
Type: double
Total Size: 29520 bytes
            3690 values
Number of Dimensions: 2
Dimensions and sizes: [year | 30] x [day | 123]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999000000
;-----------------------------------------

Then, I copied the code in Example 5, and pasted it line by line in NCL, but there is an error in the last line of the loop:

;===============================
; power spectra
;===============================
;x(nseg,ntim), nseg is nyrs here, ntim is nday here;
  ntim = nday
  nseg = nyrs
  pw = pc2dT

  d = 0 ; detrending opt: 0=>remove mean 1=>remove mean + detrend
  sm = 21 ; smooth: should be at least 3 and odd
  pct = 0.10 ; percent taper: (0.0 <= pct <= 1.0) 0.10 common.

;************************************************
  ; calculate mean spectrum spectrum and lag1 auto cor
  ;************************************************

  ; loop over each segment of length ntim

   spcavg = new ( ntim/2, typeof(pw))
   spcavg = 0.0

ncl 122> spcavg = 0.0
ncl 123>
ncl 124> r1zsum = 0.0
ncl 125>
ncl 126> do n=0,nseg-1
ncl 127> dof = specx_anal(pw(n,:),d,sm,pct) ; current segment spc
ncl 128> spcavg = spcavg + dof@spcx ; sum spc of each segment
ncl 129> r1 = dof@xlag1 ; extract segment lag-1
ncl 130> r1zsum = r1zsum + 0.5*(log((1.0+r1)/(1.0-r1))) ; sum the Fischer Z
ncl 131> end do

fatal:["NclVar.c":1382]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
fatal:["Execute.c":8126]:Execute: Error occurred at or near line 130

;---------------------------------------

Here is the error message:
fatal:["NclVar.c":1382]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
fatal:["Execute.c":8126]:Execute: Error occurred at or near line 130

Thank you very much.
Best regards
Yan

_____________________________________
From: Dennis Shea <shea@ucar.edu>
Sent: Thursday, April 17, 2014 9:43 AM
To: yjin7@masonlive.gmu.edu; ncl-talk@ucar.edu
Subject: Re: mean power spectrum

Hello,

http://www.ncl.ucar.edu/Document/Functions/Built-in/specx_anal.shtml

Did you look at Example 5?

==================
If you are doing this and you receive an error message, then you
must provide more information then stating that what
you are doing does not work.

Cheers

On 4/17/14, 7:30 AM, yjin7@masonlive.gmu.edu wrote:
> Hello everyone,
>
> I am using specx_anal() to calculate the power spectrum of daily OLR for one month for each year, and make the average for 30 years. I tried to save the data as frqcy(:,:)= specx_anal()@frq, but it seems incorrect.
>
> Any advice is appreciated!
> Best regards
> Yan
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 18 16:23:33 2014

This archive was generated by hypermail 2.1.8 : Tue Apr 29 2014 - 09:04:20 MDT