Re: [netcdf-java] A directory as a NetcdfFile location

Hi Michael:

This cant be used in the case where you open the file and the library looks for which IOSP claims it. What is your method of opening it? Do you pass your IOSP into NetcdfFIle.open() ?

On 12/8/2010 12:37 PM, Michael Godin wrote:
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

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/



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