public class NcMLReader extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.jdom.Namespace |
ncNS |
| Constructor and Description |
|---|
NcMLReader() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] arg) |
static NetcdfDataset |
mergeNcML(NetcdfFile ref,
org.jdom.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.jdom.Element parentElem)
Use NCML to directly modify the dataset
|
static Array |
readAttributeValues(org.jdom.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.jdom.Element netcdfElem,
CancelTask cancelTask)
Read NcML from a JDOM Document, and construct a NetcdfDataset.
|
static NetcdfDataset |
readNcML(String ncmlLocation,
String referencedDatasetUri,
CancelTask cancelTask)
Read an NcML file from a URL location, and construct a NetcdfDataset.
|
void |
readNetcdf(String ncmlLocation,
NetcdfDataset targetDS,
NetcdfFile refds,
org.jdom.Element netcdfElem,
CancelTask cancelTask)
parse a netcdf JDOM Element, and add contents to the targetDS 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 equivilent NetcdfFile to a physical file, using Netcdf-3 file format.
|
static void |
writeNcMLToFile(String ncmlLocation,
String fileOutName)
Read an NcML file 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.jdom.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.jdom.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.jdom.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 void readNetcdf(String ncmlLocation, NetcdfDataset targetDS, NetcdfFile refds, org.jdom.Element netcdfElem, CancelTask cancelTask) throws IOException
ncmlLocation - NcML URL location, or may be just a unique name for caching purposes.targetDS - add the info to this one, never nullrefds - the referenced dataset; may equal newds, never nullnetcdfElem - JDOM netcdf elementcancelTask - allow user to cancel the task; may be nullIOException - on read errorpublic static Array readAttributeValues(org.jdom.Element s) throws IllegalArgumentException
s - JDOM element to parseIllegalArgumentException - if string values not parsable to specified data typepublic static void writeNcMLToFile(String ncmlLocation, String fileOutName) throws IOException
ncmlLocation - read this NcML filefileOutName - write to this local fileIOException - on write errorFileWriter.writeToFile(ucar.nc2.NetcdfFile, java.lang.String)public static void writeNcMLToFile(InputStream ncml, String fileOutName) throws IOException
ncml - read NcML from this input streamfileOutName - write to this local fileIOException - on errorFileWriter.writeToFile(ucar.nc2.NetcdfFile, java.lang.String)public static void main(String[] arg)
Copyright © 1999-2012 UCAR/Unidata. All Rights Reserved.