how delete the array variables in do loop expediently?

From: Jie TANG <totangjie_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 29 2010 - 01:30:47 MDT

 hello,ncl users.

I write a ncl script to read some data from some dataset,shown as below .
I have to add the delete command to delete the array variables defined in
the "do iiyear " loop.The delete commands is shown as the red characters.
Now I want to know is there some method to reinitialize or delete those
 array variables so that I can go on the loop calculation expediently with
type the delete so many "delete" commands?

    data_dir = ("../../../cygdrive/g/data/")

    do iiyear=1999,2009
    ccyear = flt2string(iiyear)
    data = asciiread(data_dir+ccyear+"rain.txt",-1,"string")
    cyearmon= str_get_cols(data, 0,5)
    ctime = str_get_cols(data, 0,9)
    iyear = stringtointeger(str_get_cols(data, 0,3)) ; cut the
data
    imon = stringtointeger(str_get_cols(data, 4,5))
    iday = stringtointeger(str_get_cols(data, 6,7))
    ihour = stringtointeger(str_get_cols(data, 8,9))
    irain = stringtointeger(str_get_cols(data, 11,11))
    ilat = stringtofloat(str_get_cols(data, 13,15))
    ilon = stringtofloat(str_get_cols(data, 17,20))
    iprs = stringtointeger(str_get_cols(data, 22,25))
    iu = stringtointeger(str_get_cols(data, 32,33))
    cyearmon= str_get_cols(data, 0,5)
    ctime = str_get_cols(data, 0,9)
    numrec = dimsizes(iyear)
    newdata = new( numrec, "string")
     do nn = 0,numrec-1
     asciiwrite ("sample.txt", newbtdata)
     end do
    asciiwrite (ccyear+"rain2.txt",newbtdata(1:inn))
* delete(data)
    delete(cyearmon)
    delete(ctime)
    delete(iyear)
    delete(imon)
    delete(ilat)
    delete(ilon)
    delete(iprs)
    delete(igrade)
    delete(newbtdata)*
    end do

-- 
TANG Jie
Email: totangjie@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 29 01:30:54 2010

This archive was generated by hypermail 2.1.8 : Fri Jul 02 2010 - 07:45:13 MDT