Re: delete(var)

From: <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 15 Oct 2008 08:33:32 -0600 (MDT)

Hi Oli

Currently nothing like that exists in NCL.

I do like your suggestion of a new operator.

One thing I often do is to create a function or procedure
to perform tasks. NCL automatically deletes all temporary
variables in functions.

Regards
D

> Hi all,
>
> Usually NCL is quite tolerant about cleaning up after your script. No
> need to delete(var) everything that was used. This is less the case for
> scripts which assign a variable in a loop. Often, the dimension of the
> RHS of the assignement changes and since the variable on the LHS already
> exists, NCL issues the following error...
>
> fatal:Dimension sizes of left hand side and right hand side of
> assignment do not match
>
> A bogus example of this behaviour is the following...
>
> do i=1,10
> j=rand()
> a=fspan(0.,1.,j)
> end do
>
> ...where the correct result would be achieved by the following...
>
> do i=1,10
> j=rand()
> a=fspan(0.,1.,j)
> delete(a)
> end do
>
> In the case of a loop over several files and several variables and
> making several plots inside these loops, the manual deletion of all
> possible variables where such an error could occurr is rather
> cumbersome. A much more elegant solution would be the introduction of a
> new assignement operator (for example := ) which would assure the
> deletion of the LHS if it already exists upon assignement.
>
> Does anything like that already exist in NCL?
> Is there a more elegant solutin than manual deletion of all variables?
>
> Thanks,
> Oli
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 15 2008 - 08:33:32 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 24 2008 - 14:07:49 MDT