directory

Since ROMS usually produces a whole directory of NetCDF files, rslice can treat more than one file in a directory as if it were a single file, somewhat like the way the OPeNDAP aggregation server can make several data files appear as if they were one. There are a few limits, though. In addition to a directory pathname, one must also give a regular expression to narrow down the set of files to be examined. For example, suppose a directory listing of a ROMS run looks as follows.

[jevans@evans-blake tmp]$ pwd
/p/wilkin/roms/cblast/out/2002-017
[jevans@evans-blake tmp]$ ls
avg_cblast2002_017_0001.nc  avg_cblast2002_017_0050.nc  his_cblast2002_017_0003.nc  his_cblast2002_017_0052.nc
avg_cblast2002_017_0002.nc  avg_cblast2002_017_0051.nc  his_cblast2002_017_0004.nc  his_cblast2002_017_0053.nc
avg_cblast2002_017_0003.nc  avg_cblast2002_017_0052.nc  his_cblast2002_017_0005.nc  his_cblast2002_017_0054.nc
avg_cblast2002_017_0004.nc  avg_cblast2002_017_0053.nc  his_cblast2002_017_0006.nc  his_cblast2002_017_0055.nc
avg_cblast2002_017_0005.nc  avg_cblast2002_017_0054.nc  his_cblast2002_017_0007.nc  his_cblast2002_017_0056.nc
avg_cblast2002_017_0006.nc  avg_cblast2002_017_0055.nc  his_cblast2002_017_0008.nc  his_cblast2002_017_0057.nc
avg_cblast2002_017_0007.nc  avg_cblast2002_017_0056.nc  his_cblast2002_017_0009.nc  his_cblast2002_017_0058.nc
avg_cblast2002_017_0008.nc  avg_cblast2002_017_0057.nc  his_cblast2002_017_0010.nc  his_cblast2002_017_0059.nc
avg_cblast2002_017_0009.nc  avg_cblast2002_017_0058.nc  his_cblast2002_017_0011.nc  his_cblast2002_017_0060.nc
avg_cblast2002_017_0010.nc  avg_cblast2002_017_0059.nc  his_cblast2002_017_0012.nc  his_cblast2002_017_0061.nc
avg_cblast2002_017_0011.nc  avg_cblast2002_017_0060.nc  his_cblast2002_017_0013.nc  his_cblast2002_017_0062.nc
avg_cblast2002_017_0012.nc  avg_cblast2002_017_0061.nc  his_cblast2002_017_0014.nc  his_cblast2002_017_0063.nc
.
.
.
avg_cblast2002_017_0044.nc  avg_cblast2002_017_0093.nc  his_cblast2002_017_0046.nc  his_cblast2002_017_0095.nc
avg_cblast2002_017_0045.nc  avg_cblast2002_017_0094.nc  his_cblast2002_017_0047.nc  MooringFheatterms.tif
avg_cblast2002_017_0046.nc  avg_cblast2002_017_0095.nc  his_cblast2002_017_0048.nc  nszeta.tif
avg_cblast2002_017_0047.nc  cblast_017.out              his_cblast2002_017_0049.nc  sta_cblast2002_017.nc
avg_cblast2002_017_0048.nc  his_cblast2002_017_0001.nc  his_cblast2002_017_0050.nc
avg_cblast2002_017_0049.nc  his_cblast2002_017_0002.nc  his_cblast2002_017_0051.nc
            

Rslice can only look at one kind of ROMS file at any given time, so we have to pare down the two available types from avg, and his. to just one. The way to do that is with a regular expression.

Example 4.5. Using Directories for a Startup Argument: Simple Regular Expression

To operate on just the avg files, one could invoke rslice as

>> rslice ( 'directory', '/p/wilkin/roms/cblast/out/2002-017/', 'regexp', 'avg' );
                    


Example 4.6. Using Directories for a Startup Argument: Complex Regular Expression

To get just the avg files numbered 0040 to 0049, one could use

>> rslice ( 'directory', '/p/wilkin/roms/cblast/out/2002-017/', 'regex', 'avg.*004[0-9]\.nc' );
                    


To get additional information on how MATLAB handles regular expressions, please type

>> help regexp
            

from your MATLAB prompt. Please, please do this, as there are a few differences in the way that MATLAB does regular expressions from the way that the bash shell does them.