[Thread Prev][Thread Next][Index]

Re: [ferret_users] inconsistent behaviour trying to use min to find location.



Thanks Russ,

Neat solution. I was stuck in the trees. Strange behaviour though; I have used the other approach numerous times without issue, furthermore I do large O(3k) ensemble analysis of runs use the min function as part of my routine to assess each run. I would have thought I would have hit this issue before. Developers, I can supply the files and my set-up if you have an interest.

regards,

Rob



On 12-03-18 09:11 PM, Russ Fiedler wrote:
Hi Rob,

I wonder if there is some floating point rounding going in the immediate
mode evaluation that you can't see (i.e. down at the level of precision)
and the minimum gets missed.

try instead

let newvar = var - var[t=@min] ! minima at 0
let xloc = var[t=@loc:0]

Russ


On Mon, 2012-03-19 at 07:49 +1100, rdbriggs wrote:
Hello,

In the past I've used the

let vmax = v[x=@max,y=@max]

and

let xloc = v[x=@loc:`vmax`]

commands to successfully find the location of the minimum. But this time I have a problem, can anyone tell me what I am doing wrong?

My functions are FUNDHS, FUNDHS50

! get min
LET outDHS = funDHS[T=@MIN]
LET outDHs50 = funDHs50[T=@MIN]

! and time it occurs
LET TDHS= funDHS[T=@LOC:`outDHS`]
LET TDHs50 = funDHs50[T=@LOC:`outDHs50`]

LIST outDHS, outDHS50, TDHs, TDHs50
               DATA SET: ./rreconHs.dat
               T: -120.5 to 0.5
   Column  1: OUTDHS is FUNDHS[T=@MIN]
   Column  2: OUTDHS50 is FUNDHS50[T=@MIN]
   Column  3: TDHS is FUNDHS[T=@LOC:0.7081349]
   Column  4: TDHS50 is FUNDHS50[T=@LOC:27.53873]
            OUTDHS  OUTDHS5  TDHS  TDHS50
I / *:     0.7081   27.54 -10.00   ....


------>   SoTDHS  worksTDHS50  does not ?

The output from my two functions are

yes? list FUNDHS, FUNDHS50

15    / 106:     50.    163.
-14    / 107:     33.    130.
-13    / 108:     20.    109.
-12    / 109:     10.    104.
-11    / 110:      3.     32.
-10    / 111:      1.     28.<   ------ I want to automatically identify this time
-9     / 112:      2.     28.
-8     / 113:      7.     32.
-7     / 114:     16.     41.
-6     / 115:     28.     52.
-5     / 116:     44.     68.
-4     / 117:     64.     87.
-3     / 118:     88.    110.
-2     / 119:    115.    137.
-1     / 120:    145.    167.
0      / 121:    180.    201.
yes? list FUNDHS, FUNDHS50


improving the precision
yes? list/form=(2(F9.4)) FUNDHS, FUNDHS50

   33.1926 130.2298
    19.8315 108.5893
    10.4672 104.3460
     2.9604  32.1601
     0.7081  27.5387<------ these are the mins
     2.1548  28.4311
     7.2379  32.3409
    15.9903  40.5858
    28.3927  52.3871
    44.4533  68.0784
    64.1537  86.9202
    87.5170 109.8389
   114.5442 136.8729
   145.2063 166.8670
   179.5263 200.7330


yes? list FUNDHS50[T=@LOC:27.53873]
               VARIABLE : T of 27.54 in ((HS_ADJDHS50 - HSOBS)/SIGHS50)^2 + ((TAX-TOBS) / TOBS_SIG)^2
               FILENAME : rreconHs.dat
               T        : -120.5 to 0.5 (location of 27.54)
          ....
yes? list FUNDHS50[T=@LOC:28]
               VARIABLE : T of 28 in ((HS_ADJDHS50 - HSOBS)/SIGHS50)^2 + ((TAX-TOBS) / TOBS_SIG)^2
               FILENAME : rreconHs.dat
               T        : -120.5 to 0.5 (location of 28)
           -10.10

yes? list outDHS50
               VARIABLE : FUNDHS50[T=@MIN]
               FILENAME : rreconHs.dat
               T        : -120.5 to 0.5
            27.54
yes? list FUNDHS50[T=@LOC:27.53]
               VARIABLE : T of 27.53 in ((HS_ADJDHS50 - HSOBS)/SIGHS50)^2 + ((TAX-TOBS) / TOBS_SIG)^2
               FILENAME : rreconHs.dat
               T        : -120.5 to 0.5 (location of 27.53)
          ....

Any ideas what is going on here ?

Regards,

Rob





--
Ph.D candidate Glacial Systems Dynamics

C4059
Department of Physics and Physical Oceanography
Memorial University of Newfoundland, St. John's
NL, A1B 3X7, Canada

Phone   : 001 (709) 864-2407
Email   : rdbriggs@xxxxxx
Website : http://www.physics.mun.ca/~rdbriggs/


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2011.php


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

Privacy Policy | Disclaimer | Accessibility Statement