Re: delete(var)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 22 Oct 2008 14:56:49 -0600 (MDT)

Oli,

This is a good suggestion, and I have added it to our "to be
considered" enhancement list.

--Mary

On Wed, 15 Oct 2008 shea_at_ucar.edu wrote:

> 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
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 22 2008 - 14:56:49 MDT

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