Re: wind and charater

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 01 2012 - 10:52:11 MST

Hello,
What I would do would be to use the various string manipulating
functions, such as
str_split_by_length or str_split to split up your time array and specify
the results in tmXBLabels.

For instance:
time = (/"1/01/8:00:00","1/01/9:00:00"/)
splt = (/2,12/)
a_splt = str_split_by_length(a,splt)
print(a_splt)

Variable: a_splt
Type: string
Total Size: 32 bytes
             4 values
Number of Dimensions: 2
Dimensions and sizes: [2] x [2]
Coordinates:
(0,0) 1/
(0,1) 01/8:00:00
(1,0) 1/
(1,1) 01/9:00:00

That's not exactly what you want but it shows you what you can do with
str_split_by_length. str_split does something similar by splitting
things up by a given delimiter, although note it can only operate on one
input string at a time so you would have to use a do loop:

print(str_split(a,"/"))
(0) 1
(1) 01
(2) 8:00:00

I think you can use those functions to split up your time variable into
the pieces you want.. (Note that there are numerous other str_*
functions, see the function listing page here:
http://www.ncl.ucar.edu/Document/Functions/list_alpha.shtml#S

http://www.ncl.ucar.edu/Document/Functions/Built-in/str_split.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/str_split_by_length.shtml

(Note that you cannot input a string/character array as your x-input
into gsn_csm_xy.)

Hope that helps!
Adam

On 02/01/2012 01:46 AM, nlcheng wrote:
> in the script i use the xx = fspan(1,N,N) as the time .
> if my data is like below(the time series includes two months and i
> only show a section)
> time N WSPD10(m/s) WDIR10(DEGREES)
> 1/01/8:00:00 1 7.216151 32.108917
> 1/01/9:00:00 2 8.962828 32.298248
> 1/01/10:00:00 3 9.295473 33.978973
> 1/01/11:00:00 4 9.472955 36.183746
> 1/01/12:00:00 5 9.411055 37.665436
> 1/01/13:00:00 6 9.293616 38.766541
> 1/01/14:00:00 7 9.138997 39.791779
> 1/01/15:00:00 8 8.930552 38.782135
> 1/01/16:00:00 9 8.597112 35.209473
> 1/01/17:00:00 10 8.098866 30.044861
> 1/01/18:00:00 11 6.489672 23.394623
> 1/01/19:00:00 12 6.111356 15.26236
> 1/01/20:00:00 13 5.767246 7.050354
> 1/01/21:00:00 14 5.382022 0.918671
> 1/01/22:00:00 15 4.988408 357.63855
> 1/01/23:00:00 16 4.361295 355.52597
> 3/02/0:00:00 17 3.632497 350.940887
> 3/02/1:00:00 18 2.982801 345.519257
> 3/02/2:00:00 19 2.258866 339.639832
>
>
> and how can i make the xaxis like this :
> if i use the
> res@tmXBMode <mailto:res@tmXBMode> = "Explicit"
> res@tmXBValues <mailto:res@tmXBValues> = ispan(3,N,3)
> res@tmXBLabels <mailto:res@tmXBLabels> =
> (/"01/04/00:00,............................................/)
> i have to define <app:ds:define> so much
> how could i use the plot = gsn_csm_xy (wks,xx,s,res) ; create
> base plot
>
> that the xx represent a lot of characters?
> how can i change the script,thank you very much!
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 1 22:53:08 2012

This archive was generated by hypermail 2.1.8 : Thu Feb 02 2012 - 03:10:31 MST