[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #VSP-832015]: ncdf4: filling empty object with data?



> Hi,
> 
> Sorry for pinging you so much about this ... allow me to try to explain
> my goal more clearly:
> 
> I am writing a utility class that will
> 1. Read a specified source data file (e.g. a NetCDF file)
> 2. Extract a subset of this data according to caller-defined parameters
> (e.g. an arbitrary path or corridor through the source data)
> 3. Return to the caller an Object - perhaps a GeoGrid, or a
> NetcdfDataset - which contains the extracted subset.
> 
> So:
> (GeoGrid or NetcdfDataset) subset =
> utilityClass_instance.extractSubset( [Source data file], [subset
> parameters] );
> 
> Thus far I am able to extract the subset data from the source file, and
> write out the subset data as a new NetCDF file, using a
> NetcdfFileWriteable.  But I do not want the subset to be written to
> disk.  I want the subset to be returned in memory, as an Object.
> 
> An IOSP is designed to take data from a RandomAccessFile and dump it
> into a submitted NetcdfFile.  

An IOSP just has to satisfy the contract of IOServiceProvider. It doesnt matter 
how it gets satisfied. You can create an IOSP any way you want - its an 
interface. If you don't need the RandomAccessFile, you can ignore it. Use 
memory-resident data, a random-number generator, etc to fill the data.

You can create a NetcdfFile with the protected constructor, and pass in your 
IOSP:

  protected NetcdfFile(IOServiceProvider spi, RandomAccessFile raf, String 
location, CancelTask cancelTask);

 // need access to protected constructor
 class MyNetcdfFile extends NetcdfFile {
   MyNetcdfFile (IOServiceProvider spi, String name) {
     super(spi, null, name, null);
   }
 }

Once you have a NetcdfFile, you can build a NetcdfFile, NetcdfDataset, 
GridDataset, etc, and use all the mechanism of subsetting already there. 
Ultimately those call your IOSP, and you must return the data correctly.

Ticket Details
===================
Ticket ID: VSP-832015
Department: Support netCDF Java
Priority: Critical
Status: Closed