[Thread Prev][Thread Next][Index]

Re: [ferret_users] read sequence of data files



Hello Ilana,

| A student is  writing a script to work with a big sequence of data
| files. [. . .] I was wondering if there's any function that allows
| ferret to read and select the specific files (batch mode?),

The following solution isn't quite automatic, but it's manageable
unless you have hundreds of files:

   !--- main script file ---
   go process  mydata001.nc
   go process  mydata002.nc
   go process  mydata003.nc
   ! . . . and so on . . . .

   !--- another script file named "process.jnl" ---
   define symbol datafile "($1)"      !! get the argument
   set data ($datafile)               !! open the file
   ! . . . do something on the data . . .
   cancel data/all                    !! close the file

The idea is that you create a "subroutine" to process your data
and you pass the filename to it as an argument.

If I needed process hundreds of data files systematically,
I would generate a ferret script corresponding to the
main script above, by using a scripting language like Ruby,
Perl, and shell.

Ryo

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement