There's one more idea here, the TAX_MONTH function:
yes? use monthly_navy_winds
yes? list tax_month(t[gt=uwnd], t[gt=uwnd])
VARIABLE : TAX_MONTH(T[GT=UWND], T[GT=UWND])
FILENAME : monthly_navy_winds.cdf
FILEPATH :
/home/users/tmap/ferret/linux/fer_dsets/data/
SUBSET : 132 points (TIME)
16-JAN-1982 / 1: 1.00
16-FEB-1982 / 2: 2.00
18-MAR-1982 / 3: 3.00
18-APR-1982 / 4: 4.00
18-MAY-1982 / 5: 5.00
18-JUN-1982 / 6: 6.00
18-JUL-1982 / 7: 7.00
17-AUG-1982 / 8: 8.00
17-SEP-1982 / 9: 9.00
17-OCT-1982 / 10: 10.00
17-NOV-1982 / 11: 11.00
17-DEC-1982 / 12: 12.00
17-JAN-1983 / 13: 1.00
16-FEB-1983 / 14: 2.00
18-MAR-1983 / 15: 3.00
...
The family of TAX* functions let you pull out time information in a
variety of ways:
yes? show function tax*
On 1/30/2017 9:03 AM, Paulo B. Oliveira
wrote:
Hi,
I've been using the DAYS1900TOYMDHMS function for this type of
subsetting.
Below is the code that mimics what you achieved with
TAX_DATESTRING and STRINDEX, but using TAX_JDAY1900 and
DAYS1900TOYMDHMS.
Please share your comment on the relative pros and cons of the two
approaches.
Cheers,
Paulo
!--------------------------------------------
use monthly_navy_winds
let tv = t[g=uwnd]
let kymd = DAYS1900TOYMDHMS( TAX_JDAY1900(tv,uwnd) )
list/l=1:10 tv, TAX_JDAY1900(tv,uwnd), kymd[k=1], kymd[k=2],
kymd[k=3]
let var=UWND[i=@ave,j=@ave]
let var_MAR = if kymd[k=2] eq 3 then var
let var_SEP = if kymd[k=2] eq 9 then var
ppl color 6, 70,70,70
plot/grat=(dash,color=6) var
plot/over/symbol=22/color=blue/title="March" var_MAR
plot/over/symbol=22/color=red/title="September" var_SEP
quit
---------------------------
On Mon, 2017-01-30 at 15:45 +0100, Patrick Brockmann wrote:
Hi ferreters,
I have found very convenient to use the function TAX_DATESTRING
to get the date
as a string and then test with STRINDEX the presence of a
specific month
to select specific month in a time serie.
I am sure you can perform this selection by playing with indices
but I didn't want
any assumption on the starting month (l=1 in not always
january).
In addition, this is very short to write without any additionnal
variable declaration.
So just to keep a trace. Let me know if this can be achieve with
another simpler way.
Happy ferreting.
Regards
Patrick
!=====================================
use monthly_navy_winds
let var=UWND[i=@ave,j=@ave]
let var_MAR = if STRINDEX(TAX_DATESTRING(t[gt=var],
var[i=1,j=1], "month"), "MAR") then var
let var_SEP = if STRINDEX(TAX_DATESTRING(t[gt=var],
var[i=1,j=1], "month"), "SEP") then var
! I have specified var[i=1,j=1] to limit memory usage
ppl color 6, 70,70,70
plot/grat=(dash,color=6) var
plot/over/symbol=22/color=blue/title="March" var_MAR
plot/over/symbol=22/color=red/title="September" var_SEP
--
Data Analysis and Visualization Engineer
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--
|