public class NcMLReader
extends java.lang.Object
Constructor and Description |
---|
NcMLReader() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] arg) |
static NetcdfDataset |
mergeNcML(NetcdfFile ref,
org.jdom2.Element parentElem)
Use NCML to modify the referenced dataset, create a new dataset with the merged info
Used to wrap each dataset of an aggregation before its aggregated
|
static NetcdfDataset |
mergeNcMLdirect(NetcdfDataset targetDS,
org.jdom2.Element parentElem)
Use NCML to directly modify the dataset
|
static Array |
readAttributeValues(org.jdom2.Element s)
Parse the values element
|
static NetcdfDataset |
readNcML(java.io.InputStream ins,
CancelTask cancelTask)
Read NcML doc from an InputStream, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(java.io.Reader r,
CancelTask cancelTask)
Read NcML doc from a Reader, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(java.io.Reader r,
java.lang.String ncmlLocation,
CancelTask cancelTask)
Read NcML doc from a Reader, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(java.lang.String ncmlLocation,
CancelTask cancelTask)
Read an NcML file from a URL location, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(java.lang.String ncmlLocation,
org.jdom2.Element netcdfElem,
CancelTask cancelTask)
Read NcML from a JDOM Document, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(java.lang.String ncmlLocation,
org.jdom2.Element netcdfElem,
java.lang.String referencedDatasetUri,
CancelTask cancelTask)
Read NcML from a JDOM Document, and pass in the name of the dataset.
|
static NetcdfDataset |
readNcML(java.lang.String ncmlLocation,
java.lang.String referencedDatasetUri,
CancelTask cancelTask)
Read an NcML file from a URL location, and construct a NetcdfDataset.
|
static void |
setDebugFlags(DebugFlags debugFlag) |
static void |
wrapNcML(NetcdfDataset ncDataset,
java.lang.String ncmlLocation,
CancelTask cancelTask)
Use NCML to modify the dataset, getting NcML from a URL
|
static void |
wrapNcMLresource(NetcdfDataset ncDataset,
java.lang.String ncmlResourceLocation,
CancelTask cancelTask)
Use NCML to modify a dataset, getting the NcML document as a resource stream.
|
static void |
writeNcMLToFile(java.io.InputStream ncml,
java.lang.String fileOutName)
Read an NcML and write an equivalent NetcdfFile to a physical file, using Netcdf-3 file format.
|
static void |
writeNcMLToFile(java.io.InputStream ncml,
java.lang.String fileOutName,
NetcdfFileWriter.Version version,
Nc4Chunking chunker)
Read an NcML and write an equivilent NetcdfFile to a physical file, using Netcdf-3 file format.
|
static void |
writeNcMLToFile(java.lang.String ncmlLocation,
java.lang.String fileOutName)
Read an NcML file and write an equivalent NetcdfFile to a physical file, using Netcdf-3 file format.
|
public static void setDebugFlags(DebugFlags debugFlag)
public static void wrapNcMLresource(NetcdfDataset ncDataset, java.lang.String ncmlResourceLocation, CancelTask cancelTask) throws java.io.IOException
ncDataset
- modify this datasetncmlResourceLocation
- resource location of NcMLcancelTask
- allow user to cancel task; may be nulljava.io.IOException
- on read errorpublic static void wrapNcML(NetcdfDataset ncDataset, java.lang.String ncmlLocation, CancelTask cancelTask) throws java.io.IOException
ncDataset
- modify this datasetncmlLocation
- URL location of NcMLcancelTask
- allow user to cancel task; may be nulljava.io.IOException
- on read errorpublic static NetcdfDataset mergeNcML(NetcdfFile ref, org.jdom2.Element parentElem) throws java.io.IOException
ref
- referenced datasetparentElem
- parent element - usually the aggregation element of the ncmljava.io.IOException
- on read errorpublic static NetcdfDataset mergeNcMLdirect(NetcdfDataset targetDS, org.jdom2.Element parentElem) throws java.io.IOException
targetDS
- referenced datasetparentElem
- parent element - usually the aggregation element of the ncmljava.io.IOException
- on read errorpublic static NetcdfDataset readNcML(java.lang.String ncmlLocation, CancelTask cancelTask) throws java.io.IOException
ncmlLocation
- the URL location string of the NcML documentcancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.lang.String ncmlLocation, java.lang.String referencedDatasetUri, CancelTask cancelTask) throws java.io.IOException
ncmlLocation
- the URL location string of the NcML documentreferencedDatasetUri
- if null (usual case) get this from NcML, otherwise use URI as the location of the referenced dataset.cancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.io.InputStream ins, CancelTask cancelTask) throws java.io.IOException
ins
- the InputStream containing the NcML documentcancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.io.Reader r, CancelTask cancelTask) throws java.io.IOException
r
- the Reader containing the NcML documentcancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.io.Reader r, java.lang.String ncmlLocation, CancelTask cancelTask) throws java.io.IOException
r
- the Reader containing the NcML documentncmlLocation
- the URL location string of the NcML document, used to resolve reletive path of the referenced dataset,
or may be just a unique name for caching purposes.cancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.lang.String ncmlLocation, org.jdom2.Element netcdfElem, CancelTask cancelTask) throws java.io.IOException
ncmlLocation
- the URL location string of the NcML document, used to resolve reletive path of the referenced dataset,
or may be just a unique name for caching purposes.netcdfElem
- the JDOM Document's root (netcdf) elementcancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(java.lang.String ncmlLocation, org.jdom2.Element netcdfElem, java.lang.String referencedDatasetUri, CancelTask cancelTask) throws java.io.IOException
ncmlLocation
- the URL location string of the NcML document, used as a unique name for caching purposes.netcdfElem
- the JDOM Document's root (netcdf) elementreferencedDatasetUri
- the URL location string of the underlying dataset, which overrides anything in netcdfElem.
prepend with "file:" to eliminate reletive resolving against ncmlLocationcancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static Array readAttributeValues(org.jdom2.Element s) throws java.lang.IllegalArgumentException
s
- JDOM element to parsejava.lang.IllegalArgumentException
- if string values not parsable to specified data typepublic static void writeNcMLToFile(java.lang.String ncmlLocation, java.lang.String fileOutName) throws java.io.IOException
ncmlLocation
- read this NcML filefileOutName
- write to this local filejava.io.IOException
- on write errorFileWriter2
public static void writeNcMLToFile(java.io.InputStream ncml, java.lang.String fileOutName) throws java.io.IOException
ncml
- read NcML from this input streamfileOutName
- write to this local filejava.io.IOException
- on errorFileWriter2
public static void writeNcMLToFile(java.io.InputStream ncml, java.lang.String fileOutName, NetcdfFileWriter.Version version, Nc4Chunking chunker) throws java.io.IOException
ncml
- read NcML from this input streamfileOutName
- write to this local fileversion
- kind of netcdf filechunker
- optional chunking (netcdf4 only)java.io.IOException
public static void main(java.lang.String[] arg)