[Thread Prev][Thread Next][Index]

Re: [ferret_users] data count

Hi Gopal,
It looks like Akshay has given you some ideas, but I have a couple more comments.

The `a,return=iend` syntax is not going to give you the result you want for the result of a SPAWN command. RETURN=iend tells you the length of the X axis of the grid of the variable, not the number of values.  SPAWN always returns data on a longer, abstract axis, so it's not what you need.  This:

   let nfiles = `a[i=@ngd]`

will work fine for a string variable.  Your SPAWN command includes the string "dummy", so you'd want to subtract 1.

And, I have a tip when debugging an error that's happening inside a repeat loop.  Make a version of your script which just executes the commands once, one at a time.  For your script, the outer loop would look like this: (I see that you have defined variable nfiles, but then used nfile  the second loop, so that's one thing to fix)
let ll = 1
LET a = {"dummy", SPAWN:"ls 2013.0`ll`/*.nc"}
let nfiles = `a[i=@ngd]-1`

Now do the same thing with the second repeat loop, execute the commands for the first element of the repeat, and find any errors:
let dd = 1
let dummy=a[i=`dd`]
use `dummy`
sh da
can da/all
Once that's all working then you can put the commands back into the loops and they should run.


On 7/11/2014 3:20 AM, Gopal Mondal wrote:
Using FERRET command how can I have the number of data in a folder with *.nc extension? There are 12 sub-folders in the folder. I want to use the files belongs to in each of them.
  I use the following command:

repeat/range=1:12/name=ll ( ;\
LET a = {"dummy", SPAWN:"/2013.0`ll`/ls *.nc"} ;\
LET nfiles = `a,RETURN=IEND` ;\
repeat/range=1:`nfile`/name=dd ( let dummy=a[i=`dd`]; use `dummy`; sh da; can da/all) ;\)

but not giving any result,
output is:
**ERROR: command syntax: unpaired quotation marks, grave accent or brackets

Please help any one..
thanks is adv..

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement