Re: gsn_csm_xy() timeseries plot....can not coerce?

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 09 2013 - 11:11:39 MST

Hi A.J.,
gsn_csm_xy does not accept a string array as the input x-array. You will
want to set explicit x-axis labels in this case:

res = True
res@tmXBMode = "Explicit" ; explicit labels
res@tmXBValues = ispan(0,dimsizes(date)-1,1)
res@tmXBLabels = date
plot = gsn_csm_xy(wks,ispan(0,dimsizes(date)-1,1),iwv,res)

Note: The above will label every timestep.. If you want to label every
say third label change these two tmXB resources like this:
res@tmXBValues = ispan(0,dimsizes(date)-1,3)
res@tmXBLabels = date(0::3)

Hope that helps.. If not, please respond to ncl-talk..
Adam

On 12/09/2013 10:54 AM, A.J. Eiserloh wrote:
> Hi, I am trying to make a timeseries plot with gsn_csm_xy() but I keep
> getting the error:
>
> fatal:Argument type mismatch on argument (1) of gsn_csm_xy can not coerce
>
> I am not sure why? I thought you could do it if your time variable was
> a string.
>
> Here is my code,
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> site =
> (/"cco","ccy","crn","drn","ffm","klm","lcd","lgt","log","mck","mhl", \
> "mta","ovl","pan","pld","ser","smt","std","svc"/)
> ns = dimsizes(site)
>
> ;do s=0,ns-1
> do s=0,0
>
> filename= "./"+site(s)+"/"+site(s)+".txt"
> lines = asciiread(filename,-1,"string")
> delim = ","
> yyjjj = tointeger(str_get_field(lines,1,delim))
> time = str_get_field(lines,2,delim)
> iwv = tofloat(str_get_field(lines,3,delim))
>
> jjj=mod(yyjjj,1000)
> jjj@calendar="julian"
> jjj@units="days since 2011-12-31"
> YYYYNNDD=tostring(cd_calendar(jjj,-2))
>
> NN=str_get_cols(YYYYNNDD,4,5)
> DD=str_get_cols(YYYYNNDD,6,7)
> HH=str_get_cols(time,0,1)
> MM=str_get_cols(time,3,4)
>
> date=NN+"/"+DD+" "+HH+":"+MM
>
> iwv@_FillValue = -9.99
>
> wks = gsn_open_wks("x11","cco_iwv")
> res = True
>
> printVarSummary(date)
> printVarSummary(iwv)
>
>
> plot = gsn_csm_xy(wks,date,iwv,res)
>
> delete([/lines,yyjjj,time,iwv,jjj/])
>
> end do
> end
>
>
>
> --
> Arthur J. Eiserloh, Jr.
> San Jose State University
> Graduate Student
> Dept. of Meteorology and Climate Science
>
>
> _______________________________________________
> 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/staff/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 9 11:11:44 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST