[ncl-talk] power spectrum analysis
Edwin Marco
eigenge at gmail.com
Fri Oct 25 09:31:55 MDT 2019
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191025/54383fa5/attachment.html>
More information about the ncl-talk
mailing list