congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
NcMLReader
Code IndexAdd Tabnine to your IDE (free)

How to use
NcMLReader
in
ucar.nc2.ncml

Best Java code snippets using ucar.nc2.ncml.NcMLReader (Showing top 20 results out of 315)

origin: edu.ucar/netcdf

/**
 * Read an NcML file from a URL location, and construct a NetcdfDataset.
 *
 * @param ncmlLocation the URL location string of the NcML document
 * @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, CancelTask cancelTask) throws IOException {
 return readNcML(ncmlLocation, (String) null, cancelTask);
}
origin: Unidata/thredds

public void augmentDataset(NetcdfDataset ncDataset, CancelTask cancelTask) throws IOException {
 NcMLReader.wrapNcMLresource(ncDataset, CoordSysBuilder.resourcesDir + "ATDRadar.ncml", cancelTask);
}
origin: edu.ucar/netcdf

/**
 * 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;
}
origin: Unidata/thredds

/**
 * 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);
}
origin: edu.ucar/netcdf

/**
 * 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);
}
origin: edu.ucar/netcdf

if (refv == null) { // new
 if (debugConstruct) System.out.println(" add new var = " + name);
 Variable nested = readVariableNew(ds, parentS.getParentGroup(), parentS, varElem);
 parentS.addMemberVariable(nested);
 return;
 readAtt(v, refv, attElem);
 cmdRemove(v, remElem.getAttributeValue("type"), remElem.getAttributeValue("name"));
 java.util.List<Element> varList = varElem.getChildren("variable", ncNS);
 for (Element vElem : varList) {
  readVariableNested(ds, s, refS, vElem);
  readValues(ds, v, varElem, valueElem);
origin: edu.ucar/cdm

readAtt(g, refg, attElem);
readEnumTypedef(g, refg, elem);
readDim(g, refg, dimElem);
readVariable(newds, g, refg, varElem);
cmdRemove(g, e.getAttributeValue("type"), e.getAttributeValue("name"));
readGroup(newds, refds, g, refg, gElem);
if (debugConstruct) System.out.println(" add group = " + g.getFullName());
origin: edu.ucar/netcdf

if (nameInFile == null)
 nameInFile = name;
else if (null == findAttribute(refParent, nameInFile)) { // has to exists
 errlog.format("NcML attribute orgName '%s' doesnt exist. att=%s in=%s%n", nameInFile, name, parent);
 return;
ucar.nc2.Attribute att = findAttribute(refParent, nameInFile);
if (att == null) { // new
 if (debugConstruct) System.out.println(" add new att = " + name);
 try {
  ucar.ma2.Array values = readAttributeValues(attElem);
  addAttribute(parent, new ucar.nc2.Attribute(name, values));
 } catch (RuntimeException e) {
  errlog.format("NcML new Attribute Exception: %s att=%s in=%s%n", e.getMessage(), name, parent);
 if (hasValue) {
  try {
   ucar.ma2.Array values = readAttributeValues(attElem);
   addAttribute(parent, new ucar.nc2.Attribute(name, values));
  } catch (RuntimeException e) {
   errlog.format("NcML existing Attribute Exception: %s att=%s in=%s%n", e.getMessage(), name, parent);
  addAttribute(parent, new ucar.nc2.Attribute(name, att.getValues()));
  removeAttribute(parent, att);
  if (debugConstruct) System.out.println(" remove old att = " + nameInFile);
origin: edu.ucar/netcdf

/**
 * 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);
}
origin: edu.ucar/cdm

 Aggregation agg = readAgg(aggElem, ncmlLocation, targetDS, cancelTask);
 targetDS.setAggregation(agg);
 agg.finish(cancelTask);
readGroup(targetDS, refds, null, null, netcdfElem);
String errors = errlog.toString();
if (errors.length() > 0)
origin: Unidata/thredds

if (convNcML != null) {
 CoordSysBuilder csb = new CoordSysBuilder();
 NcMLReader.wrapNcML(ds, convNcML, cancelTask);
 return csb;
origin: edu.ucar/netcdf

public NetcdfFile acquireFile(CancelTask cancelTask) throws IOException {
 if (debugOpenFile) System.out.println(" try to acquire " + cacheLocation);
 long start = System.currentTimeMillis();
 NetcdfFile ncfile = NetcdfDataset.acquireFile(reader, null, cacheLocation, -1, cancelTask, spiObject);
 // must merge NcML before enhancing
 if (mergeNcml != null)
  ncfile = NcMLReader.mergeNcML(ncfile, mergeNcml); // create new dataset
 if (enhance == null || enhance.isEmpty()) {
  if (debugOpenFile) System.out.println(" acquire (no enhance) " + cacheLocation + " took " + (System.currentTimeMillis() - start));
  return ncfile;
 }
 // must enhance
 NetcdfDataset ds;
 if (ncfile instanceof NetcdfDataset) {
  ds = (NetcdfDataset) ncfile;
  ds.enhance(enhance); // enhance "in place", ie modify the NetcdfDataset
 } else {
  ds = new NetcdfDataset(ncfile, enhance); // enhance when wrapping
 }
 if (debugOpenFile) System.out.println(" acquire (enhance) " + cacheLocation + " took " + (System.currentTimeMillis() - start));
 return ds;
}
origin: edu.ucar/cdm

NcMLReader.mergeNcMLdirect(result, protoConfig.outerNcml);
origin: Unidata/thredds

if (refv == null) { // new
 if (debugConstruct) System.out.println(" add new var = " + name);
 Variable nested = readVariableNew(ds, parentS.getParentGroup(), parentS, varElem);
 if (nested != null) parentS.addMemberVariable(nested);
 return;
 readAtt(v, refv, attElem);
 cmdRemove(v, remElem.getAttributeValue("type"), remElem.getAttributeValue("name"));
 java.util.List<Element> varList = varElem.getChildren("variable", ncNS);
 for (Element vElem : varList) {
  readVariableNested(ds, s, refS, vElem);
  readValues(ds, v, varElem, valueElem);
origin: Unidata/thredds

readAtt(g, refg, attElem);
readEnumTypedef(g, refg, elem);
readDim(g, refg, dimElem);
readVariable(newds, g, refg, varElem);
cmdRemove(g, e.getAttributeValue("type"), e.getAttributeValue("name"));
readGroup(newds, refds, g, refg, gElem);
if (debugConstruct) System.out.println(" add group = " + g.getFullName());
origin: edu.ucar/cdm

if (nameInFile == null)
 nameInFile = name;
else if (null == findAttribute(refParent, nameInFile)) { // has to exists
 errlog.format("NcML attribute orgName '%s' doesnt exist. att=%s in=%s%n", nameInFile, name, parent);
 return;
ucar.nc2.Attribute oldatt = findAttribute(refParent, nameInFile);
if (oldatt == null) { // new
 if (debugConstruct) System.out.println(" add new att = " + name);
 try {
  ucar.ma2.Array values = readAttributeValues(attElem);
  addAttribute(parent, new ucar.nc2.Attribute(name, values));
 } catch (RuntimeException e) {
  errlog.format("NcML new Attribute Exception: %s att=%s in=%s%n", e.getMessage(), name, parent);
 if (hasValue) {  // has a new value
  try {
   ucar.ma2.Array values = readAttributeValues(attElem);
   addAttribute(parent, new ucar.nc2.Attribute(name, values));
  } catch (RuntimeException e) {
   errlog.format("NcML existing Attribute Exception: %s att=%s in=%s%n", e.getMessage(), name, parent);
  Array oldval = oldatt.getValues();
  if (oldval != null)
   addAttribute(parent, new ucar.nc2.Attribute(name, oldatt.getValues()));
  else {  // weird corner case of attribute with no value - must use the type
   String unS = attElem.getAttributeValue("isUnsigned");
   String typeS = attElem.getAttributeValue("type");
origin: Unidata/thredds

/**
 * 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);
}
origin: edu.ucar/cdm

/**
 * 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);
}
origin: edu.ucar/netcdf

NcMLReader reader = new NcMLReader();
NetcdfDataset ncd = reader.readNcML(ncmlLocation, referencedDatasetUri, netcdfElem, cancelTask);
if (debugOpen) System.out.println("***NcMLReader.readNcML result= \n" + ncd);
return ncd;
origin: edu.ucar/netcdf

 Aggregation agg = readAgg(aggElem, ncmlLocation, targetDS, cancelTask);
 targetDS.setAggregation(agg);
 agg.finish(cancelTask);
readGroup(targetDS, refds, null, null, netcdfElem);
String errors = errlog.toString();
if (errors.length() > 0)
ucar.nc2.ncmlNcMLReader

Javadoc

Read NcML and create NetcdfDataset.

Most used methods

  • readNcML
    Read an NcML file from a URL location, and construct a NetcdfDataset.
  • wrapNcML
    Use NCML to modify the dataset, getting NcML from a URL
  • wrapNcMLresource
    Use NCML to modify a dataset, getting the NcML document as a resource stream. Uses ClassLoader.getRe
  • <init>
  • addAttribute
  • cmdRemove
  • findAttribute
  • mergeNcML
    Use NCML to modify the referenced dataset, create a new dataset with the merged info Used to wrap ea
  • mergeNcMLdirect
    Use NCML to directly modify the dataset
  • readAgg
  • readAtt
    Read an NcML attribute element.
  • readAttributeValues
    Parse the values element
  • readAtt,
  • readAttributeValues,
  • readDim,
  • readGroup,
  • readNetcdf,
  • readValues,
  • readVariable,
  • readVariableNested,
  • readVariableNew,
  • removeAttribute

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • Menu (java.awt)
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now