org.apache.sis.storage.netcdf

## Class NetcdfStore

- Object
- - DataStore
  - - NetcdfStore

- All Implemented Interfaces:
    AutoCloseable, Aggregate, Resource, Localized

      public class NetcdfStore
      extends DataStore
      implements Aggregate

  A data store backed by netCDF files. Instances of this data store are created by `NetcdfStoreProvider​.open(StorageConnector)`.
  Since:
    0.3
  See Also:
    `NetcdfStoreProvider`

  Defined in the `sis-netcdf` module

- - ### Field Summary

    - ### Fields inherited from class DataStore

      `listeners, provider`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NetcdfStore(NetcdfStoreProvider provider, StorageConnector connector)` Creates a new netCDF store from the given file, URL, stream or `NetcdfFile` object.
    `NetcdfStore(StorageConnector connector)` Deprecated. Replaced by `NetcdfStore(NetcdfStoreProvider, StorageConnector)`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Resource` | `add(Resource resource)` Unsupported operation in current version.
    `void` | `close()` Closes this netCDF store and releases any underlying resources.
    `Collection<Resource>` | `components()` Returns the resources (features or coverages) in this netCDF file.
    `Version` | `getConventionVersion()` Returns the version number of the Climate and Forecast (CF) conventions used in the netCDF file.
    `Metadata` | `getMetadata()` Returns information about the dataset as a whole.
    `ParameterValueGroup` | `getOpenParameters()` Returns the parameters used to open this netCDF data store.
    `void` | `remove(Resource resource)` Unsupported operation in current version.
    `String` | `toString()` Returns a string representation of this netCDF store for debugging purpose.

    - ### Methods inherited from class DataStore

      `addWarningListener, findResource, getDisplayName, getLocale, getProvider, removeWarningListener, setLocale`

    - ### Methods inherited from class Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NetcdfStore

          @Deprecated
          public NetcdfStore(StorageConnector connector)
                                  throws DataStoreException

      Deprecated. Replaced by `NetcdfStore(NetcdfStoreProvider, StorageConnector)`.
      Creates a new netCDF store from the given file, URL, stream or `NetcdfFile` object. This constructor invokes `StorageConnector​.closeAllExcept(Object)`, keeping open only the needed resource.
      Parameters:
        `connector` - information about the storage (URL, stream, `NetcdfFile` instance, etc).
      Throws:
        `DataStoreException` - if an error occurred while opening the netCDF file.

    - #### NetcdfStore

          public NetcdfStore(NetcdfStoreProvider provider,
                             StorageConnector connector)
                      throws DataStoreException

      Creates a new netCDF store from the given file, URL, stream or `NetcdfFile` object. This constructor invokes `StorageConnector​.closeAllExcept(Object)`, keeping open only the needed resource.
      Parameters:
        `provider` - the factory that created this `DataStore` instance, or `null` if unspecified.
        `connector` - information about the storage (URL, stream, `NetcdfFile` instance, etc).
      Throws:
        `DataStoreException` - if an error occurred while opening the netCDF file.
      Since:
        0.8

  - ### Method Detail

    - #### getMetadata

          public Metadata getMetadata()
                               throws DataStoreException

      Returns information about the dataset as a whole. The returned metadata object can contain information such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, data quality, usage constraints and more.
      Specified by:
        `getMetadata` in interface `Resource`
      Specified by:
        `getMetadata` in class `DataStore`
      Returns:
        information about the dataset.
      Throws:
        `DataStoreException` - if an error occurred while reading the data.
      See Also:
        `Resource​.getMetadata()`

    - #### getOpenParameters

          public ParameterValueGroup getOpenParameters()

      Returns the parameters used to open this netCDF data store. If non-null, the parameters are described by `NetcdfStoreProvider​.getOpenParameters()` and contains at least a parameter named "location" with a `URI` value. This method may return `null` if the storage input can not be described by a URI (for example a netCDF file reading directly from a `ReadableByteChannel`).
      Specified by:
        `getOpenParameters` in class `DataStore`
      Returns:
        parameters used for opening this data store, or `null` if not available.
      Since:
        0.8
      See Also:
        `DataStoreProvider​.getOpenParameters()`

    - #### getConventionVersion

          public Version getConventionVersion()
                                       throws DataStoreException

      Returns the version number of the Climate and Forecast (CF) conventions used in the netCDF file. The use of CF convention is mandated by the OGC 11-165r2 standard (CF-netCDF3 Data Model Extension standard).
      Returns:
        CF-convention version, or `null` if no information about CF convention has been found.
      Throws:
        `DataStoreException` - if an error occurred while reading the data.
      Since:
        0.8

    - #### components

          public Collection<Resource> components()
                                          throws DataStoreException

      Returns the resources (features or coverages) in this netCDF file.
      Specified by:
        `components` in interface `Aggregate`
      Returns:
        children resources that are components of this netCDF.
      Throws:
        `DataStoreException` - if an error occurred while fetching the components.
      Since:
        0.8

    - #### add

          public Resource add(Resource resource)
                       throws ReadOnlyStorageException

      Unsupported operation in current version.
      Specified by:
        `add` in interface `Aggregate`
      Parameters:
        `resource` - the resource to copy in this `Aggregate`.
      Returns:
        the effectively added resource. May be `resource` itself if it has been added verbatim.
      Throws:
        `ReadOnlyStorageException` - if this instance does not support write operations.

    - #### remove

          public void remove(Resource resource)
                      throws ReadOnlyStorageException

      Unsupported operation in current version.
      Specified by:
        `remove` in interface `Aggregate`
      Parameters:
        `resource` - child resource to remove, should not be null.
      Throws:
        `ReadOnlyStorageException` - if this instance does not support write operations.

    - #### close

          public void close()
                     throws DataStoreException

      Closes this netCDF store and releases any underlying resources.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `DataStore`
      Throws:
        `DataStoreException` - if an error occurred while closing the netCDF file.

    - #### toString

          @Debug
          public String toString()

      Returns a string representation of this netCDF store for debugging purpose. The content of the string returned by this method may change in any future SIS version.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of this data store for debugging purpose.

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.