Re: delete old memary

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 30 2010 - 14:54:37 MST

Hi Mark,

You could use "isatt":

  if(isatt(res,"tmXBLabels")) then
    delete(res@tmXBLabels)
  end if

Or, can you simply remove the delete statements to after the gsn_csm_xy call?

--Mary

On Nov 30, 2010, at 1:13 PM, Mark Chan wrote:

> Hi
>
> This is a piece of NCL script, which produced the warning messages (below). I
> know the warning messages are from, e.g. "delete(res@tmXBLabels)". However,
> without this "delete()" here there will be error message (following warning
> message below). Actually I have a loop in the script so this piece of NCL
> script will be used several times, so the error message could be from the memary
> of last run. My question is how to delete the old memary without producing
> warning message?
>
> if (max(time).ge.365) then
> res@tiMainString = "daily: " + fili(nf)
> yyyyddd = year*1000 + time
> yyyymmdd = yyyyddd_to_yyyymmdd( yyyyddd )
> yyyyFrac = yyyymmdd_to_yyyyfrac(yyyymmdd, 0.0)
> delete(res@tmXBLabels)
> delete(res@tmXBValues)
> res@tmXBLabels = tostring(year)
> ;----------------------------------------------line 96
> res@tmXBValues = year
> plot = gsn_csm_xy(wks, yyyyFrac, vals, res)
> end if
>
>
> warning:Attempt to reference attribute (tmXBLabels) which is undefined
> warning:Attempt to reference attribute (tmXBValues) which is undefined
>
> --------error message without delete()---------------------
> fatal:Dimension size of attribute and right-hand side of assignment do not match
> fatal:Execute: Error occurred at or near line 96 in file my_Line.ncl
>
>
> Mark
>
>
>
> _______________________________________________
> 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 Tue Nov 30 14:54:45 2010

This archive was generated by hypermail 2.1.8 : Wed Dec 01 2010 - 08:48:58 MST