[ncl-talk] Power spectral analysis NCL

Dennis Shea shea at ucar.edu
Thu Nov 15 14:37:21 MST 2018


I believe your target example is merely maping 'f' into 1/f [period]
AFTER:
   plot = gsn_csm_xy(wks,f,splt,res)     ; create plot

ADD:

   res at tmXBMode = "Explicit"
   res at tmXBValues = (/ 0.02,  0.06, 0.10, 0.20, 0.30, 0.40, 0.5 /)       ;
frequency values
   res at tmXBLabels = (/ "50" , "16.7",  "10"  , "5", "3.3", "2.5",  "2" /)
; reasonable label spacing
   res at tiXAxisString = "Period (year)"  ; xaxis
   res at tiYAxisString = "mm^2"                  ; mm^2/freq-interval" ==>
Variance/freq-interval
   plot = gsn_csm_xy(wks,f,splt,res)     ; create plot

==============
You have 50 annual (yearly) values.

       *f *         *period=1/f *    * spc*
  0.02000    50.00000    123.106
  0.04000    25.00000    120.922
  0.06000    16.66667      75.9744
  0.08000    12.50000      42.8937
  0.10000    10.00000      47.6877
  0.12000     8.33333       34.668
  0.14000     7.14286       50.7516
  0.16000     6.25000       81.1661
  0.18000     5.55556       77.9622
  0.20000     5.00000       57.9987
  0.22000     4.54545       27.8283
  0.24000     4.16667       11.8259
  0.26000     3.84615       15.3099
  0.28000     3.57143       15.0785
  0.30000     3.33333       19.828
  0.32000     3.12500       47.7984
  0.34000     2.94118       65.8256
  0.36000     2.77778       46.4308
  0.38000     2.63158       69.4471
  0.40000     2.50000     104.169
  0.42000     2.38095       87.2154
  0.44000     2.27273       73.8239
  0.46000     2.17391       57.834
  0.48000     2.08333       33.2377
  0.50000     2.00000       25.5924


On Wed, Nov 14, 2018 at 7:35 PM Lyndz <olagueralyndonmark429 at gmail.com>
wrote:

> Dear NCL-experts,
>
> I am trying to perform a power spectral analysis using NCL.
>
> Attached are my script, output, and input data.
>
> *Problem:*
>
> I was able to do the example 1 from this page:
> https://www.ncl.ucar.edu/Applications/spec.shtml
> However, instead of variance, I would like the y axis to be the square of
> rainfall (power to 2) and the x-axis to be in years.
> Also attached is the sample expected output (expected_output.png).
>
> Any suggestions on how I can modify my script to do this?
> The output of the original script is "variance" vs "frequency".
>
> I'll appreciate any help.
>
> *Lyndz*
> _______________________________________________
> 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/20181115/8583fc2c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lyndz.000002.png
Type: image/png
Size: 55704 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181115/8583fc2c/attachment.png>


More information about the ncl-talk mailing list