[Thread Prev][Thread Next][Index]
Re: Looping over multiple files
Hi Zhen,
There's a newer syntax, REPEAT/RANGE/NAME= which allows you to set an
arbitrary name for the loop index.
repeat/range=64:69:1/name=m (use "uflx.sfc.gauss.19`m`.nc"; ...
This is in the documentation, but I've added a sentence or two to the
first part of the documentation on the REPEAT command so it'll be more
obvious.
Ansley
zhen.li@gsfc.nasa.gov wrote:
Hi Ferret Users:
I am a new user of ferret. I'd like to process multiple files (read in
the file names, regrid to
new grid, write out new files) by using a command similar to
"do" loops in Fortran. I searched for the mail archive but couldn't
find a solution for my problem.
I did find a similar question asked by someone under title 'repeat
with "anonymous" index' in
1999, but there wasn't any answers.
Here is what I am trying to do
"use climatological_axes
repeat/j=64:69:1 (use "uflx.sfc.gauss.19`j`.nc"; let
uflx_avg=uflx[GT=month_reg@MOD];
save/file="MONTHLY/uflx.sfc.gauss.mon.19`j`.nc" uflx_avg) "
The names of the files were created properly, but index "j" is
hard-coded as the dimension j.
So, ferret assumes it's an index of j. If I change "j" to "m", ferret
has an error
"unknown command qualifier: m=64:69:1"
Perhaps it's a bad idea to loop the files using "repeat". I wonder if
someone knows
a better way to process multiple files.
Thanks for your help,
Zhen
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement