[ncl-talk] about the error message 'can not combine character or string types with numeric types'

Adam Phillips asphilli at ucar.edu
Mon Dec 16 12:16:20 MST 2024


Hi Zhuxiao,
Does the error message happen when the plot is created at this line:
plot = gsn_csm_xy(wks, day(0:100), kp(0:100) ,res) ; create plot

I have seen this type of error message before where NCL is trying to
automatically set one of the gsn*String, or ti*AxisString resources. To
test this, you can set:
res at gsnLeftString = ""
res at gsnCenterString = ""
res at gsnRightString = ""
res at tiXAxisString = ""
res at tiYAxisString = ""
and see if the error message continues.
Best,
Adam




On Sat, Dec 14, 2024 at 7:19 PM Zhuxiao Li - NOAA Affiliate <
zhuxiao.li at noaa.gov> wrote:

> Hi there,
> When I run a simple NCL code, I get the error message 'can not combine
> character or string types with numeric types, can't continue'
> Actually, day are integers and kp includes float values, and I printed out
> each value.
> there are no strings in the two arrays, I don't know where the error
> message comes from. Could you please help me with this?
> Thanks!
> Zhuxiao
>
> NCL code are as follows,
>
> >begin
>  >  Dir= "/scratch1/NCEPDEV/swpc/WAM-IPE_DATA/INPUT_PARAMETERS/KP_AP/"
> >   fil1 = "kp_ap_19320101-2024.nc"
>  >  f1 = addfile(Dir+fil1,"r")
>    kp = f1->Kp(222072:222072+5844*8-1)
>    printVarSummary(kp)
>   printMinMax(kp,False)
>     nt0 = 5844*8
>     day = ispan(0, nt0-1 , 1)
>    printVarSummary(day)
>   printMinMax(day,False)
>          kp!0 = "day"
>          kp at day = day
>    printVarSummary(kp)
>   printMinMax(kp,False)
>    print(day(0:100))
>   print(kp(0:100))
>       wks = gsn_open_wks ("png","kp_for_2008-2023")
>       res     = True                      ; plot mods desired
>       plot = gsn_csm_xy(wks, day(0:100), kp(0:100) ,res) ; create plot
>       exit
> end
>
> --
> Dr. Zhuxiao Li
> NOAA/NWS/NCEP/SWPC
> 325 Broadway,
> Boulder, Colorado 80305
> 303-497-4649
>
>

-- 
Adam Phillips
Associate Scientist IV, Climate Analysis Section
Climate and Global Dynamics Laboratory
National Center for Atmospheric Research
www.cgd.ucar.edu/staff/asphilli/

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20241216/fd652b86/attachment.htm>


More information about the ncl-talk mailing list