Package kameleon.document2

Examples of kameleon.document2.Array


  static private void readColumns(NetcdfFile ncfile) throws IOException {
    long start = System.currentTimeMillis();
    List varList = ncfile.getVariables();
    for (int i = 0; i < varList.size(); i++) {
      Variable variable = (Variable) varList.get(i);
      Array data = variable.read();
    }
    double took = (System.currentTimeMillis() - start) * .001;
    System.out.println("   nvars = " + varList.size());
    System.out.println(" readCols took=" + took + " secs");
  }
View Full Code Here


  static private void readColumns(NetcdfFile ncfile) throws IOException {
    long start = System.currentTimeMillis();
    long total = 0;
    for (Variable variable : ncfile.getVariables()) {
      Array data = variable.read();
      total += data.getSize();
    }
    double took = (System.currentTimeMillis() - start) * .001;
    System.out.println("   nvars = " + ncfile.getVariables().size());
    System.out.println(" readCols took=" + took + " secs ("+total+")");
  }
View Full Code Here

  static private void readOneVariable(NetcdfFile ncfile, String varName) throws IOException {
    long start = System.currentTimeMillis();
    long total = 0;
    Variable variable = ncfile.findVariable(varName);
      Array data = variable.read();
      total += data.getSize();
    double took = (System.currentTimeMillis() - start) * .001;
    System.out.println("   read var = " + varName+" from "+ncfile.getLocation());
    System.out.println(" readOneVariable took=" + took + " secs ("+total+")");
  }
View Full Code Here

      String ncmli = StringUtil.replace(ncml,'%',Integer.toString(i));
      NetcdfFile ncfile = NcMLReader.readNcML(new StringReader(ncmli), filename, null);
      System.out.println(" TestNcmlAggExisting.open "+ filename);

      Variable timev = ncfile.findVariable("time");
      Array timeD = timev.read();

      int count1 = RandomAccessFile.getOpenFiles().size();
      System.out.printf("count files at dir %d count= %d%n", i, count1);
      ncfile.close();
    }
View Full Code Here

    assert time.getShape()[0] == n;
    assert time.getDataType() == DataType.DOUBLE;

    assert time.getDimension(0) == ncfile.findDimension("time");

    Array data = time.read();
    assert data.getRank() == 1;
    assert data.getSize() == n;
    assert data.getShape()[0] == n;
    assert data.getElementType() == double.class;

    double prev = Double.NaN;
    IndexIterator dataI = data.getIndexIterator();
    while (dataI.hasNext()) {
      double dval = dataI.getDoubleNext();
      System.out.println(" coord=" + dval);
      assert (Double.isNaN(prev) || dval > prev);
      prev = dval;
View Full Code Here

      int dcount = 0;
      int scount = 0;
      for (PointObVar v : nvars) {
        if (v.getDataType().isNumeric()) {
          Array data = sdata.getArray(v.getName());
          data.resetLocalIterator();
          if (data.hasNext())
            dvals[dcount++] = data.nextDouble();

        } else if (v.getDataType().isString()) {
          ArrayChar data = (ArrayChar) sdata.getArray(v.getName());
          svals[scount++] = data.getString();
        }
      }

      ucar.unidata.geoloc.EarthLocation loc = pobsData.getLocation();
      writer.addPoint(loc.getLatitude(), loc.getLongitude(), loc.getAltitude(), pobsData.getObservationTimeAsDate(),
View Full Code Here

    if (showStatus) System.out.println( "**** testReadData done on "+ncfile.getLocation());
  }

  static public void testVarMatchesData( Variable v, boolean showStatus) throws IOException {
    Array data = v.read();
    assert data.getSize() == v.getSize();
    assert data.getElementType() == v.getDataType().getPrimitiveClassType();

    assert data.getRank() == v.getRank();
    int[] dataShape = data.getShape();
    int[] varShape = v.getShape();
    for (int i=0; i<data.getRank(); i++)
      assert dataShape[i] == varShape[i];

    if (showStatus) System.out.println( "**** testReadData done on "+v.getFullName());
  }
View Full Code Here

    assert(null != (v = ncfile.findVariable("bvar")));
    assert !v.isUnsigned();
    assert v.getDataType() == DataType.BYTE;

    boolean hasSigned = false;
    Array data = v.read();
    while (data.hasNext()) {
      byte b = data.nextByte();
      if (b < 0) hasSigned = true;
    }
    assert hasSigned;

    ncfile.close();
View Full Code Here

    Variable v = null;
    assert(null != (v = ncfile.findVariable("bvar")));
    assert v.getDataType() == DataType.FLOAT;

    boolean hasSigned = false;
    Array data = v.read();
    while (data.hasNext()) {
      float b = data.nextFloat();
      if (b < 0) hasSigned = true;
    }
    assert !hasSigned;

    ncfile.close();
View Full Code Here

    Variable v = null;
    assert(null != (v = ncd.findVariable("bvar")));
    assert v.getDataType() == DataType.FLOAT;

    boolean hasSigned = false;
    Array data = v.read();
    while (data.hasNext()) {
      float b = data.nextFloat();
      if (b < 0) hasSigned = true;
    }
    assert !hasSigned;

    ncd.close();
View Full Code Here

TOP

Related Classes of kameleon.document2.Array

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.