Re: Please help me to find what's wrong in the script?

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 30 2012 - 16:38:24 MDT

I am not sure which line is the one in the error message. But try
this. Change this line:

    i = ind(sta.eq.sta_number)

to this:

    i = ind(STA.eq.sta_number)

--Dave

On Thu, Aug 30, 2012 at 4:22 PM, Wen.J.Qu <wen.j.qu@gmail.com> wrote:
> Hello, all
>
> I want to rearrange my ascii files but get such errors below. Would you
> please give me some clue about what's wrong with the code? Thanks a lot.
> -Shawn
>
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading fili
> fatal:Execute: Error occurred at or near line 31 in file rearrange_files.ncl
>
>
> Attached and below is the NCL script.
>
>
> ;===================================
>
> ;To rearrange the files from in the directory nameed with year (e.g. 1973/)
> to in the directory named with staion number (e.g. 543860/)
>
> ;Untar/gz all files
>
> ;===================================
>
> diri = "/work/jwang7/quwj/parallel/data/gsod/" ; data
> directory
>
> station_list = "/work/jwang7/quwj/parallel/data/station_list.txt" ;
> station_list contains the station numbers of the station of interest
> STA = asciiread(station_list,-1,"integer")
>
> ;Find the appropriate files for each station and move them into one
> directory named with the station number
>
> do n = 450000,600000,1 ; the station numbers of the station of
> interest are within this range
>
> if(any(STA.eq.n)) then
>
> sta_number = n
>
> system ("mkdir "+diri+sta_number)
>
> do year = 1973,2012,1
>
> fili = systemfunc ("cd "+diri+year+"/" + " ; ls *.op")
> sta = toint( str_get_cols(fili, 0, 5) )
>
> i = ind(sta.eq.sta_number)
>
> system ("mv "+diri+year+"/"+fili(i)+" " +diri+sta_number+"/")
>
> end do
>
> end if
>
> end do
>
> ________________________________
> Wen.J.Qu
> 2012-08-30
>
> _______________________________________________
> 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 Thu Aug 30 16:38:35 2012

This archive was generated by hypermail 2.1.8 : Tue Sep 11 2012 - 15:30:42 MDT