/** * Read NcML from a JDOM Document, and pass in the name of the dataset. Used to augment datasetScan with NcML * * @param ncmlLocation the URL location string of the NcML document, used as a unique name for caching purposes. * @param netcdfElem the JDOM Document's root (netcdf) element * @param referencedDatasetUri the URL location string of the underlying dataset, which overrides anything in netcdfElem. * prepend with "file:" to eliminate reletive resolving against ncmlLocation * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, Element netcdfElem, String referencedDatasetUri, CancelTask cancelTask) throws IOException { NcMLReader reader = new NcMLReader(); return reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); }
/** * Read NcML from a JDOM Document, and pass in the name of the dataset. Used to augment datasetScan with NcML * * @param ncmlLocation the URL location string of the NcML document, used as a unique name for caching purposes. * @param netcdfElem the JDOM Document's root (netcdf) element * @param referencedDatasetUri the URL location string of the underlying dataset, which overrides anything in netcdfElem. * prepend with "file:" to eliminate reletive resolving against ncmlLocation * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, Element netcdfElem, String referencedDatasetUri, CancelTask cancelTask) throws IOException { NcMLReader reader = new NcMLReader(); return reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); }
/** * Use NCML to directly modify the dataset * * @param targetDS referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcMLdirect(NetcdfDataset targetDS, Element parentElem) throws IOException { NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
/** * Use NCML to directly modify the dataset * * @param targetDS referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcMLdirect(NetcdfDataset targetDS, Element parentElem) throws IOException { NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
/** * Use NCML to directly modify the dataset * * @param targetDS referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcMLdirect(NetcdfDataset targetDS, Element parentElem) throws IOException { NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
/** * 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 * * @param ref referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcML(NetcdfFile ref, Element parentElem) throws IOException { NetcdfDataset targetDS = new NetcdfDataset(ref, null); // no enhance NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
NcMLReader reader = new NcMLReader(); NetcdfDataset ncd = reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.readNcML result= \n" + ncd);
NcMLReader reader = new NcMLReader(); NetcdfDataset ncd = reader.readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.readNcML result= \n" + ncd);
/** * 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 * * @param ref referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcML(NetcdfFile ref, Element parentElem) throws IOException { NetcdfDataset targetDS = new NetcdfDataset(ref, null); // no enhance NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
referencedDatasetUri = AliasTranslator.translateAlias(referencedDatasetUri); NcMLReader reader = new NcMLReader(); NetcdfDataset ncd = reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.readNcML result= \n" + ncd);
/** * Read NcML from a JDOM Document, and construct a NetcdfDataset. * * @param 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. * @param netcdfElem the JDOM Document's root (netcdf) element * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, Element netcdfElem, CancelTask cancelTask) throws IOException { // the ncml probably refers to another dataset, but doesnt have to String referencedDatasetUri = netcdfElem.getAttributeValue("location"); if (referencedDatasetUri == null) referencedDatasetUri = netcdfElem.getAttributeValue("url"); NcMLReader reader = new NcMLReader(); return reader.readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); }
/** * 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 * * @param ref referenced dataset * @param parentElem parent element - usually the aggregation element of the ncml * @return new dataset with the merged info * @throws IOException on read error */ static public NetcdfDataset mergeNcML(NetcdfFile ref, Element parentElem) throws IOException { NetcdfDataset targetDS = new NetcdfDataset(ref, null); // no enhance NcMLReader reader = new NcMLReader(); reader.readGroup(targetDS, targetDS, null, null, parentElem); targetDS.finish(); return targetDS; }
/** * Read NcML from a JDOM Document, and construct a NetcdfDataset. * * @param 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. * @param netcdfElem the JDOM Document's root (netcdf) element * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, Element netcdfElem, CancelTask cancelTask) throws IOException { // the ncml probably refers to another dataset, but doesnt have to String referencedDatasetUri = netcdfElem.getAttributeValue("location"); if (referencedDatasetUri == null) referencedDatasetUri = netcdfElem.getAttributeValue("url"); NcMLReader reader = new NcMLReader(); return reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); }
NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncDataset.getLocation(), ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset);
NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncDataset.getLocation(), ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset);
NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncDataset.getLocation(), ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset);
/** * Use NCML to modify the dataset, getting NcML from a URL * * @param ncDataset modify this dataset * @param ncmlLocation URL location of NcML * @param cancelTask allow user to cancel task; may be null * @throws IOException on read error */ static public void wrapNcML(NetcdfDataset ncDataset, String ncmlLocation, CancelTask cancelTask) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); if (debugURL) System.out.println(" NetcdfDataset URL = <" + ncmlLocation + ">"); doc = builder.build(ncmlLocation); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (debugXML) System.out.println(" SAXBuilder done"); if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncmlLocation, ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset); }
/** * Use NCML to modify the dataset, getting NcML from a URL * * @param ncDataset modify this dataset * @param ncmlLocation URL location of NcML * @param cancelTask allow user to cancel task; may be null * @throws IOException on read error */ static public void wrapNcML(NetcdfDataset ncDataset, String ncmlLocation, CancelTask cancelTask) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); if (debugURL) System.out.println(" NetcdfDataset URL = <" + ncmlLocation + ">"); doc = builder.build(ncmlLocation); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (debugXML) System.out.println(" SAXBuilder done"); if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncmlLocation, ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset); }
/** * Use NCML to modify the dataset, getting NcML from a URL * * @param ncDataset modify this dataset * @param ncmlLocation URL location of NcML * @param cancelTask allow user to cancel task; may be null * @throws IOException on read error */ static public void wrapNcML(NetcdfDataset ncDataset, String ncmlLocation, CancelTask cancelTask) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); if (debugURL) System.out.println(" NetcdfDataset URL = <" + ncmlLocation + ">"); doc = builder.build(ncmlLocation); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (debugXML) System.out.println(" SAXBuilder done"); if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); NcMLReader reader = new NcMLReader(); reader.readNetcdf(ncmlLocation, ncDataset, ncDataset, netcdfElem, cancelTask); if (debugOpen) System.out.println("***NcMLReader.wrapNcML result= \n" + ncDataset); }
/** * Read NcML from a JDOM Document, and construct a NetcdfDataset. * * @param 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. * @param netcdfElem the JDOM Document's root (netcdf) element * @param cancelTask allow user to cancel the task; may be null * @return the resulting NetcdfDataset * @throws IOException on read error, or bad referencedDatasetUri URI */ static public NetcdfDataset readNcML(String ncmlLocation, Element netcdfElem, CancelTask cancelTask) throws IOException { // the ncml probably refers to another dataset, but doesnt have to String referencedDatasetUri = netcdfElem.getAttributeValue("location"); if (referencedDatasetUri == null) referencedDatasetUri = netcdfElem.getAttributeValue("url"); if (referencedDatasetUri != null) referencedDatasetUri = AliasTranslator.translateAlias(referencedDatasetUri); NcMLReader reader = new NcMLReader(); return reader._readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask); }