[netcdf-java] A directory as a NetcdfFile location

I am currently attempting an IOSP that needs to access data that is stored
as a set of files (one file per time step and variable) within a directory
for each model run, rather than as a single file.  However, when
ucar.unidata.io.RandomAccessFile attempts to create a
java.io.RandomAccessFile, a FileNotFound exception is thrown before the IOSP
has a chance to dig into the directory and open it as a NetcdfFile.

I have a work-around, which is to replace line 260 in
ucar.unidata.io.RandomAccessFile:

    this.file = new java.io.RandomAccessFile(location, mode);

With the following lines:

    boolean isDir = (new java.io.File(location)).isDirectory();
    this.file = isDir ? null : new java.io.RandomAccessFile(location, mode);

This allows the IOSP to take a directory path as an argument and load the
files within into a single NetcdfFile when the IOSP's "open" method is
called.

Is there any chance this work-around could be integrated into the mainline
code?

Thanks, Mike
_____________________________________________
Michael A. Godin
Software Engineer
Monterey Bay Aquarium Research Institute
Phone: 831-775-2063  http://www.mbari.org



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: