[Thread Prev][Thread Next][Index]
how to select the highest values in a 3d file?
Dear Ferret users,
I have a 3D temperature file (lon,lat,time), the time axis representing
200 annual averages. I would like to average the 10 warmest years together for
each grid point (the selected years will be different from one grid point
to another).
Up to now, I did the following:
use "annual_T_200years.nc" ---> x=1;97,y=1:24,k=1:200
let Tp=T[d=1]
LET sorted_indices = sortk(Tp)
LET ki = k[k=1:200]
LET sorted_indices_2 = if ki GT 190 then sorted_indices
LET sorted_Tp = samplek(Tp, sorted_indices_2)
LIST sorted_indices_2[x=90W,y=40n,k=189:200], sorted_Tp[x=90W,y=40n,k=189:200]
LIST sorted_Tp[x=90W,y=40n,k=189:200@ave]
LIST sorted_indices_2[x=90W,y=40n,k=189:200], sorted_Tp[x=90W,y=40n,k=189:200]
Z: 188.5 to 200.5
LONGITUDE: 90W
LATITUDE: 39N
Column 1: SORTED_INDICES_2 is IF KI GT 190 THEN SORTED_INDICES
Column 2: SORTED_TP is SAMPLEK(TP, SORTED_INDICES_2)
SORTED_ISORTED_T
189 / 189: .... ....
190 / 190: .... ....
191 / 191: 147.0 10.00
192 / 192: 5.0 10.07
193 / 193: 141.0 10.12
194 / 194: 124.0 10.12
195 / 195: 63.0 10.22
196 / 196: 1.0 10.26
197 / 197: 9.0 10.33
198 / 198: 68.0 10.37
199 / 199: 69.0 10.40
200 / 200: 146.0 10.54
LIST sorted_Tp[x=90W,y=40n,k=189:200@ave]
VARIABLE : SAMPLEK(TP, SORTED_INDICES_2)
LONGITUDE: 90W
LATITUDE : 39N
Z : 188.5 to 200.5 (averaged)
10.24
But I cannot do it for ALL gridpoints, since samplek works only with 1D list.
I tried to do a mask:
let test= if k EQ 146 OR k EQ 69 then Tp
"test" provides the 2 temperatures corresponding to the 2 warmest years for
the point x=90w, y=40n. Unfortunately, I did not find out the general
command which allows to identify when k is equal to one of the values of
"sorted_indices_2".
let test= if k EQ sorted_indices_2 then Tp does not work.
Thank you in advance for any help,
Celine
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement