[ncl-talk] Select dates range in time calendar
Dennis Shea
shea at ucar.edu
Mon Jan 20 10:40:18 MST 2020
The following is a brute force approach.
;========================================================
; I would like to select special dates:
; 11 Feb 1985 to 11 July 2015. but only dates in feb-mar-apr-may-jun-jul
;========================================================
;--- Big 'ymdh' subset selection
it =* ind*(ymdh(:,0).ge.1985.and.ymdh(:,0).le.2015 .and. \
ymdh(:,1).ge.2 .and.ymdh(:,1).le.7 )
it at _FillValue = -999
;--- Identify 'it' indices [subscripts] to eliminate
it = *where*(ymdh(it,0).eq.1985.and.ymdh(it,1).eq.2.and.ymdh(it,2).lt.15
.or. \
ymdh(it,0).eq.2015.and.ymdh(it,1).eq.7.and.ymdh(it,2).gt.11 \
,it at _FillValue, it)
;--- identify non_FillValue indices
jt =* ind*(*.not.ismissing*(it))
;---Extract the desired indices [Use reassignment syntax* :=* ]
it *:=* it(jt)
printVarSummary(it)
print("===")
print(ymdh(it,0)+" "+ymdh(it,1)" "+ymdh(it,2))
On Mon, Jan 20, 2020 at 6:53 AM Sancta Fun via ncl-talk <ncl-talk at ucar.edu>
wrote:
> No It doesn't work if iI select first the range 11Feb1985 to 11July2015 (I
> have only date 11 for Feb and july in each year not dates between them).
>
> And I test also the "or" suggested by BARRY LYNN but not working.
>
>
> Le lun. 20 janv. 2020 à 14:03, 时光足迹 via ncl-talk <ncl-talk at ucar.edu> a
> écrit :
>
>>
>> Hi, I suggest you first select the time range 11Feb1985 to 11July2015. Then you can select again from the data which had been selected in the first step.
>>
>>
>> ------------------ 原始邮件 ------------------
>> *发件人:* "Sancta Fun via ncl-talk" <ncl-talk at ucar.edu>;
>> *发送时间:* 2020年1月20日(星期一) 20:47
>> *收件人:* "ncl-talk" <ncl-talk at ucar.edu>;
>> *主题:* [ncl-talk] Select dates range in time calendar
>>
>>
>> Hi,
>> I would like to select special dates: 11Feb1985 to 11 July 2015. but only
>> dates in feb-mar-apr-may-jun-jul.
>>
>> My code is below:
>>
>> ymdh = ut_calendar(time, 0)
>> y =ind(ymdh(:,1).ge.2.and.ymdh(:,2).ge.11 .and.
>> ymdh(:,1).le.7.and.ymdh(:,2).le.11 .and. ymdh(:,0).ge.1985 .and.
>> ymdh(:,0).le.2015 )
>>
>> What's wrong?
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200120/f9d6842c/attachment.html>
More information about the ncl-talk
mailing list