[Thread Prev][Thread Next][Index]

[ferret_users] Embedded expressions and @LOC



Hello,
I want to find the maximum value for each time step in an array of data, and then find the coordinate position that the maximum value occurs at. I have used a loop in a script like this:

repeat/range=1:18:1/name=g (let max_val = lf[l=`g`,j=@MAX];let max_rad = lf[l=`g`,j=@LOC:`max_val`];say `max_val`;say `max_rad`;list/l=`g` lf)

However, "max_val" is not finding the precise locations of my maximum value. I thought this had to do with precision, so I used `max_val,p=-3` in the @LOC statement to specify 3 decimal places, but there is still a problem. See the output below. For output 1, the @LOC value should be 150, but it comes up as 149.97. For output 2, the @LOC value should be 50, but it comes up "bad" even though it has the exact same number. Any ideas??

Thanks,
Steve

OUTPUT.....

result of `max_val,p=-3` = 5.309
result of @LOC = 149.97
VARIABLE : LF
FILENAME : quad_rain_trop.dat
SUBSET : 20 points (Y)
TIME : 01-AUG-2004 18:00
50 / 1: 3.298
100 / 2: 4.598
150 / 3: 5.309
200 / 4: 3.017
250 / 5: 1.740
300 / 6: 1.111
350 / 7: 0.669
400 / 8: 1.114
450 / 9: 0.663
500 / 10: 0.781
550 / 11: 0.900
600 / 12: 1.161
650 / 13: 1.535
700 / 14: 1.620
750 / 15: 1.194
800 / 16: 1.335
850 / 17: 0.660
900 / 18: 0.266
950 / 19: 0.682
1000 / 20: 0.547

result of `max_val,p=-3` = 5.331
result of @LOC = bad
VARIABLE : LF
FILENAME : quad_rain_trop.dat
SUBSET : 20 points (Y)
TIME : 02-AUG-2004 18:00
50 / 1: 5.331
100 / 2: 2.335
150 / 3: 2.186
200 / 4: 0.892
250 / 5: 0.329
300 / 6: 0.778
350 / 7: 1.785
400 / 8: 1.896
450 / 9: 1.289
500 / 10: 0.792
550 / 11: 1.213
600 / 12: 1.934
650 / 13: 1.697
700 / 14: 0.743
750 / 15: 0.828
800 / 16: 0.818
850 / 17: 0.999
900 / 18: 1.374
950 / 19: 1.599
1000 / 20: 2.458


=======================================================
Stephen R. Guimond
Graduate Research Assistant
Center for Ocean-Atmospheric Prediction Studies (COAPS)
Tallahassee, FL 32304
=======================================================

----------------------------------------------------------------



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement