Re: Opening and Closing Plain

Kevin-

Kevin Manross wrote:

Is there a way to "unload" or close one netCDF file and then "load" or open a new netCDF file while the program is still running?

I have an application where a user can chose a radar site. When a site is chosen, it should read a terrain map (netCDF) into VisAD. If the user then wants to chose a different site, the application should unload the existing netCDF file, clear all the associated maps from VisAD implementations, and load the new netCDF file.

If the files are of the same format, you should just be able to
call:

    <set up your display, ScalarMaps, and DataReference etc>
    Plain plain = new Plain();
    Data plainData = plain.open(<first file location>);
    dataRef.setData(plainData);
    <user chooses new file>
    plainData = plain.open(<second file location>);
    dataRef.setData(plainData)

If it's in a new location, you might have to call
    display.reAutoScale();

or if you are manually setting the ranges on the scalar maps,
figure them out from the new data and call their setRange
method.

Currently I am using Plain, but there does not appear to be any close() method for Plain.

There is no close() on Plain, but you can use a single instance
to load in multiple files.  The original files should get garbage
collected.

Any help is greatly appreciated!

If any of the above does not make sense, let me know.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************



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