## visad.data.netcdf
Class Plain

    java.lang.Object
      visad.data.FormNode
          visad.data.Form
              visad.data.netcdf.NetCDF
                  visad.data.netcdf.Plain

All Implemented Interfaces:
  FormFileInformer

public class Plain
extends NetCDF

A moderately stupid implementation of a netCDF data form for the storage of persistent data objects on local disk.

Field Summary

Fields inherited from class visad.data.Form
`mathType`

Constructor Summary
`Plain()` Constructs a default, netCDF data form.
`Plain(boolean charToText)` Constructs a netCDF data form that converts
`Plain(QuantityDB db)` Constructs a netCDF data form that uses the given quantity database.
`Plain(QuantityDB db, boolean charToText)` Constructs a netCDF data form that uses the given quantity database, and the flag for converting char to Text.

Method Summary
`void` `add(String id, Data data, boolean replace)` Add data to an existing data object.
`FormNode` `getForms(Data data)` Return the data forms that are compatible with a data object.
`static void` `main(String[] args)` Test this class.
`DataImpl` `open(String spec)` Returns a VisAD data object corresponding to a netCDF dataset.
`DataImpl` `open(String spec, Strategy strategy)` Returns a VisAD data object corresponding to a netCDF dataset and imported according to a given strategy.
`DataImpl` `open(URL url)` Returns a VisAD data object corresponding to a URL.
`DataImpl` `openProxy(String path)` Open an existing netCDF file and return a proxy for a VisAD data object.
`void` `save(String path, Data data, boolean replace)` Save a VisAD data object in this form.

Methods inherited from class visad.data.netcdf.NetCDF
`getDefaultSuffixes, isThisType, isThisType`

Methods inherited from class visad.data.Form
`getMathType`

Methods inherited from class visad.data.FormNode
`getName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Plain

    public Plain()
          throws VisADException

  Constructs a default, netCDF data form.

Throws:
  `VisADException` - Couldn't create necessary VisAD object

### Plain

    public Plain(boolean charToText)

  Constructs a netCDF data form that converts

### Plain

    public Plain(QuantityDB db)

  Constructs a netCDF data form that uses the given quantity database.

Parameters:
  `db` - The quantity database.

### Plain

    public Plain(QuantityDB db,
                 boolean charToText)

  Constructs a netCDF data form that uses the given quantity database, and the flag for converting char to Text.

Parameters:
  `db` - The quantity database.
  `charToText` - The char to Text flag

Method Detail

### save

    public void save(String path,
                     Data data,
                     boolean replace)
              throws BadFormException,
                     IOException,
                     RemoteException,
                     VisADException,
                     UnimplementedException

  Save a VisAD data object in this form.

  Specified by:
    `save` in class `FormNode`
  Parameters:
    `path` - The pathname of the netCDF file to be created.
    `data` - The data to be saved.
    `replace` - Whether to replace an existing file.
  Throws:
    `BadFormException` - netCDF can't handle data object
    `VisADException` - Couldn't create necessary VisAD object
    `IOException` - I/O error. File might already exist.
    `RemoteException` - Remote execution error
    `UnimplementedException` - Not yet!

### add

    public void add(String id,
                    Data data,
                    boolean replace)
             throws BadFormException

  Add data to an existing data object.

  Specified by:
    `add` in class `FormNode`
  Parameters:
    `id` - Pathname of the existing netCDF file.
    `data` - Data to be saved.
    `replace` - Whether or not to replace duplicate, existing data.
  Throws:
    `BadFormException` - netCDF can't handle data object.

### open

    public DataImpl open(String spec)
                  throws BadFormException,
                         IOException,
                         VisADException

  Returns a VisAD data object corresponding to a netCDF dataset.

  Specified by:
    `open` in class `NetCDF`
  Parameters:
    `spec` - Specification of the existing netCDF dataset.
  Returns:
    A VisAD data object corresponding to the netCDF dataset.
  Throws:
    `BadFormException` - if the netCDF dataset cannot be adapted to a VisAD data object.
    `VisADException` - if a problem occurs in core VisAD. Probably a VisAD object couldn't be created.
    `IOException` - if an I/O failure occurs.
  See Also:
    `NetcdfAdapter.getData()`

### open

    public DataImpl open(String spec,
                         Strategy strategy)
                  throws BadFormException,
                         IOException,
                         VisADException

  Returns a VisAD data object corresponding to a netCDF dataset and imported according to a given strategy. Among the pre-defined import strategies are `Strategy.DEFAULT`, `Strategy.MERGED_FILE_FLAT_FIELDS`, `Strategy.UNMERGED_FILE_FLAT_FIELDS`, and `Strategy.IN_MEMORY`.

  Parameters:
    `spec` - Specification of the existing netCDF dataset.
    `strategy` - The data-import strategy.
  Returns:
    A VisAD data object corresponding to the netCDF dataset.
  Throws:
    `BadFormException` - if the netCDF dataset cannot be adapted to a VisAD data object.
    `VisADException` - if a problem occurs in core VisAD. Probably a VisAD object couldn't be created.
    `IOException` - if an I/O failure occurs.
  See Also:
    `NetcdfAdapter.getData(Strategy)`

### openProxy

    public DataImpl openProxy(String path)
                       throws BadFormException,
                              IOException,
                              VisADException

  Open an existing netCDF file and return a proxy for a VisAD data object.

  Parameters:
    `path` - Pathname of the existing netCDF file.
  Returns:
    A VisAD object corresponding to the netCDF dataset.
  Throws:
    `BadFormException` - The netCDF variable cannot be adapted to a VisAD API.
    `VisADException` - Problem in core VisAD. Probably some VisAD object couldn't be created.
    `IOException` - Data access I/O failure.

### open

    public DataImpl open(URL url)
                  throws FileNotFoundException,
                         IOException,
                         VisADException

  Returns a VisAD data object corresponding to a URL. If the query component of the URL is `null`, then the returned object will contain all the variables in the netCDF dataset. If the query component is non-`null`, then it must comprise a comma-separated list of netCDF variable names; the returned VisAD data object will contain only those variables in the netCDF dataset that are also named in the list (i.e. the intersection is returned). Consequently, if the list is empty, then `null` is returned. For example, this form: `open(new URL("file://myfile.nc?var_one,var_two"));` will return a VisAD data object consisting only of the netCDF variables `var_one` and `var_two` assuming they are in the file.

  Specified by:
    `open` in class `FormNode`
  Parameters:
    `url` - The URL of the netCDF dataset.
  Returns:
    A VisAD object corresponding to the netCDF datset or `null`.
  Throws:
    `FileNotFoundException` - if the URL specifies a file that doesn't exist.
    `IOException` - if an I/O failure occurs.
    `VisADException` - if a necessary VisAD object couldn't be created.

### getForms

    public FormNode getForms(Data data)
                      throws VisADException,
                             RemoteException,
                             IOException

  Return the data forms that are compatible with a data object.

  Specified by:
    `getForms` in class `FormNode`
  Parameters:
    `data` - The VisAD data object to be examined.
  Returns:
    `this` if `data` is compatible; otherwise, `null`.
  Throws:
    `VisADException` - Problem with core VisAD.
    `IOException` - Problem with local data access.
    `RemoteException` - Problem with remote data access.

### main

    public static void main(String[] args)
                     throws Exception

  Test this class.

  Parameters:
    `args` - Runtime arguments. Ignored.
  Throws:
    `Exception` - Something went wrong.