public class NcMLReader extends Object
| Constructor and Description |
|---|
NcMLReader() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(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(InputStream ins,
CancelTask cancelTask)
Read NcML doc from an InputStream, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(Reader r,
CancelTask cancelTask)
Read NcML doc from a Reader, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(Reader r,
String ncmlLocation,
CancelTask cancelTask)
Read NcML doc from a Reader, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(String ncmlLocation,
CancelTask cancelTask)
Read an NcML file from a URL location, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(String ncmlLocation,
org.jdom2.Element netcdfElem,
CancelTask cancelTask)
Read NcML from a JDOM Document, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(String ncmlLocation,
org.jdom2.Element netcdfElem,
String referencedDatasetUri,
CancelTask cancelTask)
Read NcML from a JDOM Document, and pass in the name of the dataset.
|
static NetcdfDataset |
readNcML(String ncmlLocation,
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,
String ncmlLocation,
CancelTask cancelTask)
Use NCML to modify the dataset, getting NcML from a URL
|
static void |
wrapNcMLresource(NetcdfDataset ncDataset,
String ncmlResourceLocation,
CancelTask cancelTask)
Use NCML to modify a dataset, getting the NcML document as a resource stream.
|
static void |
writeNcMLToFile(InputStream ncml,
String fileOutName)
Read an NcML and write an equivalent NetcdfFile to a physical file, using Netcdf-3 file format.
|
static void |
writeNcMLToFile(InputStream ncml,
String fileOutName,
NetcdfFileWriter.Version version,
ucar.nc2.write.Nc4Chunking chunker)
Read an NcML and write an equivilent NetcdfFile to a physical file, using Netcdf-3 file format.
|
public static void setDebugFlags(DebugFlags debugFlag)
public static void wrapNcMLresource(NetcdfDataset ncDataset, String ncmlResourceLocation, CancelTask cancelTask) throws IOException
ncDataset - modify this datasetncmlResourceLocation - resource location of NcMLcancelTask - allow user to cancel task; may be nullIOException - on read errorpublic static void wrapNcML(NetcdfDataset ncDataset, String ncmlLocation, CancelTask cancelTask) throws IOException
ncDataset - modify this datasetncmlLocation - URL location of NcMLcancelTask - allow user to cancel task; may be nullIOException - on read errorpublic static NetcdfDataset mergeNcML(NetcdfFile ref, org.jdom2.Element parentElem) throws IOException
ref - referenced datasetparentElem - parent element - usually the aggregation element of the ncmlIOException - on read errorpublic static NetcdfDataset mergeNcMLdirect(NetcdfDataset targetDS, org.jdom2.Element parentElem) throws IOException
targetDS - referenced datasetparentElem - parent element - usually the aggregation element of the ncmlIOException - on read errorpublic static NetcdfDataset readNcML(String ncmlLocation, CancelTask cancelTask) throws IOException
ncmlLocation - the URL location string of the NcML documentcancelTask - allow user to cancel the task; may be nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(String ncmlLocation, String referencedDatasetUri, CancelTask cancelTask) throws 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 nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(InputStream ins, CancelTask cancelTask) throws IOException
ins - the InputStream containing the NcML documentcancelTask - allow user to cancel the task; may be nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(Reader r, CancelTask cancelTask) throws IOException
r - the Reader containing the NcML documentcancelTask - allow user to cancel the task; may be nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(Reader r, String ncmlLocation, CancelTask cancelTask) throws 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 nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(String ncmlLocation, org.jdom2.Element netcdfElem, CancelTask cancelTask) throws 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 nullIOException - on read error, or bad referencedDatasetUri URIpublic static NetcdfDataset readNcML(String ncmlLocation, org.jdom2.Element netcdfElem, String referencedDatasetUri, CancelTask cancelTask) throws 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 nullIOException - on read error, or bad referencedDatasetUri URIpublic static Array readAttributeValues(org.jdom2.Element s) throws IllegalArgumentException
s - JDOM element to parseIllegalArgumentException - if string values not parsable to specified data typepublic static void writeNcMLToFile(InputStream ncml, String fileOutName) throws IOException
ncml - read NcML from this input streamfileOutName - write to this local fileIOException - on errorFileWriter2public static void writeNcMLToFile(InputStream ncml, String fileOutName, NetcdfFileWriter.Version version, ucar.nc2.write.Nc4Chunking chunker) throws IOException
ncml - read NcML from this input streamfileOutName - write to this local fileversion - kind of netcdf filechunker - optional chunking (netcdf4 only)IOExceptionpublic static void main(String[] arg)