Re: error after plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 25 2009 - 09:21:44 MST

Hi Tony,

The error message is giving you a hint about what the problem is.
It's telling
you that a variable was set up to be one type, and then later you are
trying to
change the type to something else.

You are setting plot to an NCL "string" with:

     plot = "x11"

And then later you change its type with:

    plot=gsn_y(wks,tempplotdata,False)

The value returned by any of the "gsn_xxx" routines is a special
"graphic" type, which
is incompatible with the "string" type.

Change the first "plot" variable to something else, like "wks_type":

   wks_type = "x11"
   wks = gsn_open_wks(wks_type,"plotqc")

Also, just a heads up: be careful about using "False" as the input to
a gsn_xxx routine.

If you later decide to create a resource list with plot options, it's
easy to forget that
this value is hard-coded, and you'll wonder why your plot options are
not having
an effect.

I recommend this:

   res = False
   plot=gsn_y(wks,tempplotdata,res)

Even better, if you are not setting any plot options, go ahead and
set "res" to
True, as it doesn't hurt anything:

   res = True
   plot=gsn_y(wks,tempplotdata,res)

--Mary

On Nov 24, 2009, at 2:17 PM, Reinhart, Anthony wrote:

>
> On Nov 24, 2009, at 3:12 PM, Correia, James wrote:
>
>> Hi-
>> Looks like the "delete(templotdata)" is missing the extra p.
>> jimmyc
>>
>>
>> On 11/24/09 1:08 PM, "Reinhart, Anthony"
>> <anthony.reinhart@ttu.edu> wrote:
>>
>>> Hi-
>>>
>>> I get this error
>>> fatal:Assignment type mismatch, right hand side can't be coerced
>>> to type of
>>> left hand side
>>> fatal:Execute: Error occurred at or near line 77 in file
>>> netqcnclhelp.ncl
>>> line 77 is: plot=gsn_y(wks,tempplotdata,False)
>>>
>>> it occurs after the line it says it errors on produces a plot. I
>>> have tried
>>> difference plotting functions (gsn_y,gsn_csm_xy, and gsn_xy) and
>>> they all seem
>>> to be doing the same error. Any suggestions are appreciated.
>>> Below is the
>>> code.
>>>
>>> Thanks,
>>> Tony
>>>
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> begin
>>>
>>> tempflag=0
>>>
>>>
>>> plot = "x11"
>>> wks = gsn_open_wks(plot,"plotqc")
>>>
>>>
>>> ;setup plotting output
>>>
>>>
>>> ;read in sticknets into 2d array
>>> data=readAsciiTable(data,ncols,"float",skip)
>>>
>>> ;;;;Create runave filter to calculate errors
>>> tempave=runave(data(:,1),10,0)
>>>
>>>
>>> ;;;;;;;;;;;;
>>> ;Compare the average to actual values
>>> ;;;;;;;;;;;;
>>> do k=9,dimsizes(data(:,1))-9
>>> if((data(k,1) .ge. 1.1*tempave(k)) .or. (data(k,1) .le.
>>> 0.9*tempave(k))) then
>>> tempflag = tempflag+1
>>> end if
>>> end do
>>> print(tempflag)
>>>
>>>
>>> ;;;;;;;;;;;;;;;;;;;
>>> ;;PLOT TIMESERIERS
>>> ;;;;;;;;;;;;;;;;;;;
>>> time=ispan(0,dimsizes(tempave)-1,1)
>>> ;res=True
>>> ;res@xyLineThicknesses=(/1.0,1.0/)
>>> ;res@xyLineColors=(/"blue","red"/)
>>> tempplotdata= new((/2,dimsizes(tempave)/),"float")
>>> tempplotdata(0,:)=data(:,1)
>>> tempplotdata(1,:)=tempave(:)
>>>
>>> printVarSummary(tempplotdata)
>>> printVarSummary(data(:,1))
>>> plot=gsn_y(wks,tempplotdata,False)
>>>
>>> delete(templotdata)
>>> delete(tempave)
>>> delete(data)
>>> end do
>>> end
>>>
>>> ########################################################
>>> Anthony Reinhart
>>> Graduate Research Assistant
>>> Texas Tech
>>> Office:
>>> BA 1206
>>> Email:
>>> anthony.reinhart@ttu.edu<mailto:anthony.reinhart@ttu.edu>
>>> ########################################################
>>>
>>>
>>>
>>> ########################################################
>>> Anthony Reinhart
>>> Graduate Research Assistant
>>> Texas Tech
>>> Office:
>>> BA 1206
>>> Email:
>>> anthony.reinhart@ttu.edu<mailto:anthony.reinhart@ttu.edu>
>>> ########################################################
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
> ########################################################
> Anthony Reinhart
> Graduate Research Assistant
> Texas Tech
> Office:
> BA 1206
> Email:
> anthony.reinhart@ttu.edu
> ########################################################
>
> _______________________________________________
> 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 Nov 25 09:22:00 2009

This archive was generated by hypermail 2.1.8 : Sun Nov 29 2009 - 20:52:58 MST