Package ucar.nc2.ncml

Examples of ucar.nc2.ncml.NcMLWriter


  protected void open(GridIndex index, CancelTask cancelTask) throws IOException {
    long start = System.currentTimeMillis();
    GridTableLookup lookup = (saveEdition == 2) ? getLookup2() : getLookup1();

    // make it into netcdf objects
    GridIndexToNC convert = new GridIndexToNC(index.filename);
    convert.open(index, lookup, saveEdition, ncfile, fmrcCoordSys, cancelTask);

    ncfile.finish();

    if (debugTiming) {
      long took = System.currentTimeMillis() - start;
View Full Code Here


    private ucar.unidata.io.RandomAccessFile myRaf;
    // private Nidsheader.Vinfo myInfo;
    protected UFheader headerParser;

    public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) {
        UFheader localHeader = new UFheader();
        return (localHeader.isValidFile(raf));
    }
View Full Code Here

    public void open(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile file,
                   ucar.nc2.util.CancelTask cancelTask) throws IOException {
        ncfile = file;
        myRaf = raf;

        headerParser = new UFheader();
        headerParser.read(myRaf, ncfile);
        //myInfo = headerParser.getVarInfo();
        HashMap variables = headerParser.variableGroup;

        Set vSet = variables.keySet();
View Full Code Here

   * @param showCoords shoe the values of coordinate axes
   * @param uri        use this for the uri attribute; if null use getLocation().
   * @throws IOException on write error
   */
  public void writeNcMLG(java.io.OutputStream os, boolean showCoords, String uri) throws IOException {
    new NcMLGWriter().writeXML(this, os, showCoords, uri);
  }
View Full Code Here

   * @param os  write to this Output Stream.
   * @param uri use this for the uri attribute; if null use getLocation().
   * @throws IOException
   */
  public void writeNcML(java.io.OutputStream os, String uri) throws IOException {
    new NcMLWriter().writeXML(this, os, uri);
  }
View Full Code Here

    }
  }

  public void testWriteNcml() throws IOException, InvalidRangeException {
    final Average fileAvg = new Average();
    final NcMLWriter writer = new NcMLWriter();

    testAllInDir(new File("C:/data/grib/"), new MClosure() {
      public void run(String filename) throws IOException, InvalidRangeException {
        if (!filename.endsWith("grib1")) return;
        NetcdfFile ncfile = NetcdfDataset.openFile(filename, null);
        File fileout = new File(filename + ".ncml");
        if (fileout.exists()) fileout.delete();
        writer.writeXMLexplicit(ncfile, new FileOutputStream(fileout), null);
        System.out.println(" wrote ncml file  =" + fileout);

      }
    });
  }
View Full Code Here

    }
  }

  public void testWriteNcml() throws IOException, InvalidRangeException {
    final Average fileAvg = new Average();
    final NcMLWriter writer = new NcMLWriter();

    testAllInDir( new File("C:/data/grib/"), new MClosure() {
      public void run(String filename) throws IOException, InvalidRangeException {
        if (!filename.endsWith("grib1")) return;
        NetcdfFile ncfile = NetcdfDataset.openFile(filename, null);
        File fileout = new File(filename+".ncml");
        if (fileout.exists()) fileout.delete();
        writer.writeXMLexplicit( ncfile, new FileOutputStream(fileout), null);
        System.out.println(" wrote ncml file  ="+fileout);
      }
    });
  }
View Full Code Here

    assert val.equals(trouble);

    ncfile.writeCDL(System.out, false);
    ncfile.writeNcML(System.out, null);

    NcMLWriter w = new NcMLWriter();
    w.writeXML(ncfile, System.out, null);

    OutputStream out = new FileOutputStream(TestLocal.cdmTestDataDir +"testSpecialChars.ncml");
    w.writeXML(ncfile, out, null);
    out.close();

    ncfile.close();
  }
View Full Code Here

    val = ncfile.findAttValueIgnoreCase(v, "yow", null);
    assert val != null;
    assert val.equals(trouble);

    NcMLWriter w = new NcMLWriter();
    w.writeXML(ncfile, System.out, null);

    ncfile.close();
  }
View Full Code Here

      dsMetadata.addContent(getDatasetSubset(ds));
     
      //--- For atomic dataset's add ncml for dataset to metadata
      if (!ds.hasNestedDatasets()) {
        NetcdfDataset ncD = NetcdfDataset.openDataset("thredds:"+ds.getCatalogUrl());
        NcMLWriter ncmlWriter = new NcMLWriter();
        Element ncml = Xml.loadString(ncmlWriter.writeXML(ncD),false);
        dsMetadata.addContent(ncml);
      }

            if(log.isDebugEnabled()) log.debug("Thredds metadata and ncml is:"+Xml.getString(dsMetadata));
View Full Code Here

TOP

Related Classes of ucar.nc2.ncml.NcMLWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.