Re: still have problem about open files in different subdirectories

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 28 2011 - 22:10:43 MST

The problem is that you did not use the find
command correctly. It must be in the 'systemfunc' command.

http://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml

Please read the documentation.

==
You can help with the debugging. Use print statements.

You can try it interactively for testing:

ncl <return>
dir = systemfunc("find /home/lovecheese/DATA/20*")
print(dir)

===
So use

dir = systemfunc("find /home/lovecheese/DATA/20*")

On 11/28/11 9:36 PM, yikun liu wrote:
> hi!
>
> I have a directory "DATA" which contains 11 sub directories
> "2000","2001"...."2010".
> Each of the 11 sub directories has 12 .hdf files.
> I want to open files which name contains "200x06""200x09""200x012" in
> each sub directories "2000"-"2010", and then open
> "200x15","200x18","200x21" in each sub directories, and so on
> my code is like
> imonth=(/"0","00","03","06","09","12","15","18","21","24","27","30","33"/)
> iyear=(/"00","01","02","03","04"/)
> do i =1,4
> if( i.lt.4)
> do year =0, 4
> dir = "find /home/lovecheese/DATA/20*"
> add_1 =
> systemfunc(dir+iyear(year)+“/20”+iyear(year)+imonth(i*3)+"*.hdf")
> add_2 =
> systemfunc(dir+iyear(year)+“/20”+iyear(year)+imonth(i*3)+imonth(i*3+1)+"*.hdf")
> add_3 =
> systemfunc(dir+iyear(year)+“/20”+iyear(year)+imonth(i*3)+imonth(i*3+2)+"*.hdf")
>
> f1 =addfile(add_1,"r")
> f2 =addfile(add_2,"r")
> f3 =addfile(add_3,"r")
> end do
> else
> end if
> end do
>
> but it returns
> fatal:syntax error: line 17 in file check before or near â
> add_1 = systemfunc(dir+iyear(year)+â
>
> what's the problem?
>
>
> _______________________________________________
> 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 Mon Nov 28 22:10:49 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST