Package java.util

Examples of java.util.Formatter


    }
  }

  public void testGempak() throws Exception {
    String file = TestAll.cdmUnitTestDir +  "formats/gempak/surface/09052812.sf";
    Formatter buf = new Formatter();
    FeatureDatasetPoint pods =
        (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(
            ucar.nc2.constants.FeatureType.POINT, file, null, buf);
    if (pods == null) {  // try as ANY_POINT
      pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(
View Full Code Here


  static public void writeNcML(NetcdfFile ncfile, java.io.Writer os, boolean showCoords, String uri) throws IOException {
    writeNcML(ncfile, os, showCoords ? WantValues.coordsOnly : WantValues.none, uri);
  }

  static public void writeNcML(NetcdfFile ncfile, java.io.Writer os, WantValues showValues, String uri) throws IOException {
    writeNcML(ncfile, new Formatter(os), showValues, uri);
  }
View Full Code Here

  }

  public static void main(String[] args) throws  IOException {
    String server = "http://motherlode:8080/";
    String dataset = "/thredds/dodsC/fmrc/NCEP/GFS/Global_0p5deg/runs/NCEP-GFS-Global_0p5deg_RUN_2009-05-13T12:00:00Z";
    Formatter errlog = new Formatter();
    FeatureDataset fd = FeatureDatasetFactoryManager.open( FeatureType.GRID, server + dataset,  null, errlog );
    System.out.printf("%s%n", fd);
  }
View Full Code Here

        if (debug) System.out.printf(" featureScan=%s%n", f.getPath());
        ds = NetcdfDataset.openDataset(f.getPath());
        fileType = ds.getFileTypeId();
        setCoordMap(ds.getCoordinateSystems());

        Formatter errlog = new Formatter();
        try {
          FeatureDataset featureDataset = FeatureDatasetFactoryManager.wrap(null, ds, null, errlog);
          if (featureDataset != null) {
            featureType = featureDataset.getFeatureType();
            if (featureType != null)
              ftype = featureType.toString();
            ftImpl = featureDataset.getImplementationName();
            Formatter infof = new Formatter();
            featureDataset.getDetailInfo(infof);
            info = infof.toString();
          } else {
            ftype = "FAIL: " + errlog.toString();
          }
        } catch (Throwable t) {
          ftype = "ERR: " + t.getMessage();
View Full Code Here

    public String getFeatureImpl() {
      return ftImpl;
    }

    public String toString() {
      Formatter f = new Formatter();
      f.format("%s%n %s%n map = '%s'%n %s%n %s%n", getName(), getFileType(), getCoordMap(), getFeatureType(), getFeatureImpl());
      if (info != null) {
        f.format("\n%s", info);
      }
      if (problem != null) {
        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
        problem.printStackTrace(new PrintStream(bout));
        f.format("\n%s", bout.toString());
      }
      return f.toString();
    }
View Full Code Here

  // read URL to File
  static Formatter fout;
  static public void main(String[] args) throws IOException {
    FileOutputStream f = new FileOutputStream("C:/TEMP/read.txt");
    fout = new Formatter(f);
    //String url = "http://newmotherlode.ucar.edu:8081/thredds/fileServer/nexrad/level2/KDVN/20080921/Level2_KDVN_20080921_1024.ar2v";
    String url = "http://newmotherlode.ucar.edu:8081/thredds/fileServer/fmrc/NCEP/GFS/Global_onedeg/files/GFS_Global_onedeg_20080922_0600.grib2";
    long start = System.currentTimeMillis();
    IO.copyUrlB(url, null, 1000 * 1000); // read data and throw away
    double took = .001 * (System.currentTimeMillis() - start);
View Full Code Here

    }

    @Override
    public String toString() {
        // Output into coordinate format. Indices start from 1 instead of 0
        Formatter out = new Formatter();

        out.format("%10d %19d\n", size, Matrices.cardinality(this));

        for (VectorEntry e : this)
            if (e.get() != 0)
                out.format("%10d % .12e\n", e.index() + 1, e.get());

        return out.toString();
    }
View Full Code Here

    String level, where;
    public StringBuilder extra;
    boolean isDone, isStart;

    public String toString() {
      Formatter f = new Formatter();
      f.format("%s [%d] [%d] %s %s: ", getDate(), reqTime, reqSeq, level, where);

      if (isStart)
        f.format(" (%s) %s %n", ip, getPath());
      else if (isDone)
        f.format(" %d %d %d %n", returnCode, sizeBytes, msecs);

      if (extra != null)
        f.format(" %s", extra);

      return f.toString();
    }
View Full Code Here

    NetcdfDataset ncd = null;
    long start = System.currentTimeMillis();
    try {
      // ncd = NetcdfDataset.openDataset( access.getStandardUrlName());
      Formatter log = new Formatter();
      ncd = tdataFactory.openDataset(access, true, null, log);
      if (ncd == null) {
        countNoOpen++;
        out.println("  **FAILED to open " + access.getStandardUrlName() + " " + log);
        System.out.println("  **FAILED to open " + access.getStandardUrlName() + " " + log);
View Full Code Here

    VariableDS ctvSyn = CoordTransBuilder.makeDummyTransformVariable(ncd, ct);
    System.out.println(" dump of equivilent ctv = \n" + ctvSyn);

    if (ctv != null) {
      Formatter f = new Formatter(System.out);
      CompareNetcdf.checkContains(ctv.getAttributes(), ctvSyn.getAttributes(), f);
    }

    ncd.close();
    return proj;
View Full Code Here

TOP

Related Classes of java.util.Formatter

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.