# Re: fourier_info with small numbers

From: Mohamed Hajalie <mhajalie_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 31 2013 - 16:04:37 MDT

Hello,
I am working with the NCL and my program is in fortran. Anytime I run the
program to my output file it adds 1 new line at the end of the output. Is
there something I can do. I attached my program and output.

Thank You

Mike

On Wed, Jul 31, 2013 at 5:15 PM, Brian Medeiros <brianpm@atmos.ucla.edu>wrote:

> Hi NCL,
>
> I just discovered that fourier_info has some sensitivity to the magnitude
> of the input data. The issue is that the "variance explained" becomes
> exactly zero if the input data is sufficiently small. The amplitude and
> phase don't seem affected, so I think this might just be a bug (maybe going
> from correlation coefficient to percent variance explained?). The switch to
> zero happens for the same value of the input to fourier_info regardless of
> it being single or double precision. Here is a minimal script that shows
> the drop off to zero when the amplitude of the input reaches 10^-4 (this
> works on at least two systems of different architecture, using NCL 6.2.0 or
> 6.1.2):
>
> ; test fourier_info precision sensitivity
> pi = 4.*atan(1.)
> F = 1. ; FREQUENCY
> P = pi/4. ; PHASE
> x = fspan( 0., 2.*pi, 50)
> E0 = 4 ; exponent parameter starting value
> do i = 0,10
> A = 10. * 10.^(E0-i) ; AMPLITUDE ... increment down by iteration
> s = A*sin( F*x + P) ; pure sine wave
> fi = fourier_info( s, 0, 1.)
> print("[INPUT AMPLITUDE: "+sprintf("%4.2e",A)+"] A: " + sprintf(
> "%4.2e",fi(0,0))+", P: "+ fi(1,0) + " VARIANCE EXPLAINED: " + fi(2,0) )
> end do
>
> Here's my output:
> (0) [INPUT AMPLITUDE: 1.00e+05] A: 9.99e+04, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e+04] A: 9.99e+03, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e+03] A: 9.99e+02, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e+02] A: 9.99e+01, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e+01] A: 9.99e+00, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e+00] A: 9.99e-01, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e-01] A: 9.99e-02, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e-02] A: 9.99e-03, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e-03] A: 9.99e-04, P: 5.6694 VARIANCE
> EXPLAINED: 99.9134
> (0) [INPUT AMPLITUDE: 1.00e-04] A: 9.99e-05, P: 5.6694 VARIANCE
> EXPLAINED: 0
> (0) [INPUT AMPLITUDE: 1.00e-05] A: 9.99e-06, P: 5.6694 VARIANCE
> EXPLAINED: 0
>
> If this isn't a bug, I'd be interested to hear an explanation for this
> behavior.
>
>
> thanks,
>
> .brian
>
> _______________
> Brian Medeiros
> Project Scientist
> NCAR/NESL/CGD/AMP
> brianpm@ucar.edu
> http://www.cgd.ucar.edu/~brianpm
>
>
>
>
>
>
> _______________________________________________
> 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 Wed Jul 31 16:04:49 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 07 2013 - 13:59:00 MDT