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.
-
-
Constructor Summary
Constructors Constructor and Description Plain()Constructs a default, netCDF data form.Plain(boolean charToText)Constructs a netCDF data form that convertsPlain(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(java.lang.String id, Data data, boolean replace)Add data to an existing data object.FormNodegetForms(Data data)Return the data forms that are compatible with a data object.static voidmain(java.lang.String[] args)Test this class.DataImplopen(java.lang.String spec)Returns a VisAD data object corresponding to a netCDF dataset.DataImplopen(java.lang.String spec, Strategy strategy)Returns a VisAD data object corresponding to a netCDF dataset and imported according to a given strategy.DataImplopen(java.net.URL url)Returns a VisAD data object corresponding to a URL.DataImplopenProxy(java.lang.String path)Open an existing netCDF file and return a proxy for a VisAD data object.voidsave(java.lang.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
-
-
-
-
Constructor Detail
-
Plain
public Plain() throws VisADExceptionConstructs 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- Parameters:
charToText- The char to Text flag
-
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(java.lang.String path, Data data, boolean replace) throws BadFormException, java.io.IOException, java.rmi.RemoteException, VisADException, UnimplementedExceptionSave a VisAD data object in this form.- Specified by:
savein classFormNode- 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 objectVisADException- Couldn't create necessary VisAD objectjava.io.IOException- I/O error. File might already exist.java.rmi.RemoteException- Remote execution errorUnimplementedException- Not yet!
-
add
public void add(java.lang.String id, Data data, boolean replace) throws BadFormExceptionAdd data to an existing data object.- Specified by:
addin classFormNode- 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(java.lang.String spec) throws BadFormException, java.io.IOException, VisADException
Returns a VisAD data object corresponding to a netCDF dataset.- Specified by:
openin classNetCDF- 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.java.io.IOException- if an I/O failure occurs.- See Also:
NetcdfAdapter.getData()
-
open
public DataImpl open(java.lang.String spec, Strategy strategy) throws BadFormException, java.io.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 areStrategy.DEFAULT,Strategy.MERGED_FILE_FLAT_FIELDS,Strategy.UNMERGED_FILE_FLAT_FIELDS, andStrategy.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.java.io.IOException- if an I/O failure occurs.- See Also:
NetcdfAdapter.getData(Strategy)
-
openProxy
public DataImpl openProxy(java.lang.String path) throws BadFormException, java.io.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.java.io.IOException- Data access I/O failure.
-
open
public DataImpl open(java.net.URL url) throws java.io.FileNotFoundException, java.io.IOException, VisADException
Returns a VisAD data object corresponding to a URL. If the query component of the URL isnull, 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, thennullis 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 variablesvar_oneandvar_twoassuming they are in the file.- Specified by:
openin classFormNode- Parameters:
url- The URL of the netCDF dataset.- Returns:
- A VisAD object corresponding to the netCDF datset
or
null. - Throws:
java.io.FileNotFoundException- if the URL specifies a file that doesn't exist.java.io.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, java.rmi.RemoteException, java.io.IOException
Return the data forms that are compatible with a data object.- Specified by:
getFormsin classFormNode- Parameters:
data- The VisAD data object to be examined.- Returns:
thisifdatais compatible; otherwise,null.- Throws:
VisADException- Problem with core VisAD.java.io.IOException- Problem with local data access.java.rmi.RemoteException- Problem with remote data access.
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionTest this class.- Parameters:
args- Runtime arguments. Ignored.- Throws:
java.lang.Exception- Something went wrong.
-
-
DMelt 3.0 © DataMelt by jWork.ORG