# Re: ncl question

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 19 2011 - 09:17:29 MDT

[1] As I mentioned before, you should have better 'Subject' topics
All posting to ncl-talk are 'ncl question'(s)
Something like: 'string parsing' or 'information from strings'

[2] A string like "3-31-11 23:00" has 3 delimeters - {space} :

ts = (/ "3-31-11 23:00" \
, "3-31-11 23:05" \
, "3-31-11 23:10" \
, "3-31-11 23:15" \
, "3-31-11 23:20" \
, "3-31-11 23:25" \
, "3-31-11 23:30" \
, "3-31-11 23:35" \
, "3-31-11 23:40" \
, "3-31-11 23:45" \
, "3-31-11 23:50" /)

delim = "- :"
tsfc = str_fields_count(ts, delim)
print(" number of fields: tsfc="+tsfc(0))

mm = str_get_field(ts, 1, delim) ; array of strings
dd = str_get_field(ts, 2, delim)
yy = str_get_field(ts, 3, delim)
hh = str_get_field(ts, 4, delim)
mn = str_get_field(ts, 5, delim)

print(mm+" "+dd+" "+yy+" "+hh+" "+mn)

[3]

*You* are going to have to manually alter the mm/dd/yy/jj/mn to get
what you want. One approach is to use 'if' statements/

On 10/19/11 1:33 AM, cnl88 wrote:
> 3-31-11 23:00
> 3-31-11 23:05
> 3-31-11 23:10
> 3-31-11 23:15
> 3-31-11 23:20
> 3-31-11 23:25
> 3-31-11 23:30
> 3-31-11 23:35
> 3-31-11 23:40
> 3-31-11 23:45
> 3-31-11 23:50
>
> 3-31-11 23:55
>
> this time is the form of mm-dd-yy hh:mm of beijing
>
> I want to make
> 3-18-11 0:25 as
>
> 3-18-11 0:00;
>
> I want to make
>
> 3-18-11 0:35 as
>
> 3-18-11 1:00;
>
> I want to make
> 3-31-11 23:55 as
>
> 4-1-11 0:00;
>
> when this done ,i want to make the results global time such as
>
> 4-1-11 0:00 to
>
> 3-31-11 22:00;
>
> how can i find the example script and the function ;hope for your help
> !thank you
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 19 09:17:38 2011

This archive was generated by hypermail 2.1.8 : Wed Oct 19 2011 - 13:36:10 MDT