[Thread Prev][Thread Next][Index]

[ferret_users] Error to save spectrum and phase of FFT in period unit



Hallo,
I wonder why I got this error when i wanted to save the results of FFT analysis (period unit not frequency) in different nc files:

!Save fft in period unit
let A = SET_UP per[l=1:`FFT_nf`], fft_uwnd
 !-> DEFINE VARIABLE A = SET_UP per[l=1:378], fft_uwnd
 **ERROR: command syntax: SET_UP per[l=1:378], fft_uwnd
          SET_UP before per[l=1:378] is illegal
DEFINE VARIABLE A = SET_UP per[l=1:378], fft_uwnd
Command file, command group, or REPEAT execution aborted

Here is my command:

[SNIP]
!converting to Period
! Get the frequency increment used in the FFT.
      LET FFT_nf = `fft_uwnd,return=lend`
      LET FFT_nyquist = 0.5
      LET FFT_freq1 = FFT_nyquist/ FFT_nf

! Define a frequency axis.
      DEFINE AXIS/T=`FFT_freq1`:`FFT_nyquist`:`FFT_freq1` FAXIS
      DEFINE GRID/T=FAXIS gfftfreq
      LET a = T[g=gfftfreq]

! Define the period from the frequency axis.
      LET per = 1./a

! Plot period vs FFT Amplitudes showing the first 24 months where most of the energy is.
! The PPL commands clean up the appearance of the plot.

 SET VIEW ur
      PLOT/VS/LINE/HLIMITS=0:32:2/TITLE="Amplitude Spectrum"/SET_UP per[l=1:`FFT_nf`], fft_uwnd
      PPL XFOR (I2)
      PPL XLAB Period, months/cycle
      PPL YLAB 
      PPL PLOT
!****************************************************************************************************
! Compute and plot the phase using fftp.

      LET FFT_uwndfftp = fftp(fft_u[l=1:757])
      SET VARIABLE/TITLE="FFT Phase"/UNITS="deg" FFT_uwndfftp

      SET VIEW ll
      PLOT FFT_uwndfftp

      SET VIEW lr
      PLOT/VS/LINE/HLIMITS=0:32:2/TITLE="FFT Phase"/SET_UP per[l=1:`FFT_nf`],FFT_uwndfftp
      PPL XFOR (I2)
      PPL XLAB Period, months/cycle
      PPL YLAB Deg
      PPL PLOT

!Save fft period unit
let A = SET_UP per[l=1:`FFT_nf`], fft_uwnd
save/file=fft_period.nc A

!Save phase in period unit
let B = SET_UP per[l=1:`FFT_nf`], FFT_uwndfftp
save/file=phase_period.nc

!**********************************************************************************
Thanks for your help.

Antonio.

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement