[Thread Prev][Thread Next][Index]

Re: [ferret_users] skip one index in repeat loop



Hi
There are some options on the EXIT command that let you skip a step in the repeat loop EXIT/CYCLE to skip to the end of the loop, and EXIT/LOOP to get out of the loop entirely.  Try this command:
yes? repeat/range=1:5/name=yy (if `yy eq 2` then exit/cycle; say `yy`)
so you could use that, either just giving a loop number as I've done, or by making some other test, say on the grid of the file.

Your error about the file type is because in some commands you still have the file extension .txt and in others you used .nc.  You could make your output filenames symbols instead of putting the name in multiple commands, so before the loop,
define symbol file1 = sp1mday10_ma.txt       ! or .nc
define symbol file2 = sp1mday10_ma_32.txt    ! or .nc
! and if using netcdf,
set list/format=cdf
and then just write to those files, in the repeat loop,
list/append/file=($file1)/...
list/append/file=($file2)/
As Akshay said, you also need to sort out the /CLOBBER and/APPEND qualifiers. I'd have commands in the script before the loop to delete the files, and then just use /append throughout. If list/append is used and the file doesn't exist, that's fine. Ferret will create it.

Ansley


On 9/27/2013 8:00 AM, Gopal Mondal wrote:
Hi ferret user
 thanks in advance
I am extracting some var from the data files(attached) with the attached .jnl file.
but error is coming(attached) due to the problem in a data files.I want to skip particularly that data file and the repeat loop will run as usual just omitting at the index of problematic data file.

* another problem is that the .jnl script running well if the data is saved in .txt file.But when I am taking in .nc file with format=cdf the error(attached  as error 2nd) is  netcdf error, the file type mismatch giving


please help

Gopal Mondal


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

Privacy Policy | Disclaimer | Accessibility Statement