[ncl-talk] power spectrum analysis

Edwin Marco eigenge at gmail.com
Fri Oct 25 10:41:11 MDT 2019


Thanks, I'll check it out.

On Fri, Oct 25, 2019 at 5:31 PM Dennis Shea <shea at ucar.edu> wrote:

> Not sure of your objective but ...
>
>    spec at frq = spec at frq/30.50                                       ; 30.5
> day/month
>    res at tiXAxisString = "Frequency (cycles/day)"           ; xaxis
>    plot=gsn_csm_xy(wks,spec at frq,spec at spcx,res)     ; create plot
>
> On Fri, Oct 25, 2019 at 9:32 AM Edwin Marco via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi,
>> I am new to ncl and I have been trying to plot the spectrum of daily
>> rainfall data using this kind of script ( attached below) unfortunately I
>> am not getting there, please can you help me on how I can modify the
>> attached script which was intended for frequency (cycles/month) as to get
>> frequency (cycles/day).
>> Thanks in advance.
>>
>> Edwin
>>
>> spec_1.ncl
>> ;
>> ; Concepts illustrated:
>> ;   - Calculating and plotting spectra
>> ;************************************************
>> ;
>> ; These files are loaded by default in NCL V6.2.0 and newer
>> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> ;************************************************
>> begin
>> ;************************************************
>> ; variable and file handling
>> ;************************************************
>>    fn  = "SOI_Darwin.nc" ; define filename
>>    in  = addfile(fn,"r")                                 ; open netcdf file
>>    soi  = in->DSOI                                       ; get data
>> ;************************************************
>> ; set function arguments
>> ;************************************************
>> ; detrending opt: 0=>remove mean 1=>remove mean and detrend
>>   d = 0
>> ; smoothing periodogram: (0 <= sm <= ??.) should be at least 3 and odd
>>   sm = 7
>> ; percent tapered: (0.0 <= pct <= 1.0) 0.10 common.
>>   pct = 0.10
>> ;************************************************
>> ; calculate spectrum
>> ;************************************************
>>   spec = specx_anal(soi,d,sm,pct)
>> ;************************************************
>> ; plotting
>> ;************************************************
>>    wks  = gsn_open_wks("png","spec")               ; send graphics to PNG file
>>
>>    res = True					   ; plot mods desired
>>    res at tiMainString = "SOI"		           ; title
>>    res at tiXAxisString = "Frequency (cycles/month)"  ; xaxis
>>    res at tiYAxisString = "Variance"                  ; yaxis
>>
>>    plot=gsn_csm_xy(wks,spec at frq,spec at spcx,res)     ; create plot
>> ;***********************************************
>> end
>>
>> _______________________________________________
>> 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/20191025/6f289902/attachment.html>


More information about the ncl-talk mailing list