Package org.jruby.ext.ffi

Examples of org.jruby.ext.ffi.Type$Array


    CoordinateAxis1D zAxis = gcs.getVerticalAxis();
    int zidx = zAxis.findCoordElement( zCoord);

    int[] xy = gcs.findXYindexFromLatLon(lat, lon, null);

    Array data  = grid.readDataSlice(tidx, zidx, xy[1], xy[0]);

    // use actual grid midpoint
    LatLonPoint latlon = gcs.getLatLon(xy[0], xy[1]);

    Point p = new Point();
    p.lat = latlon.getLatitude();
    p.lon = latlon.getLongitude();
    p.z = zAxis.getCoordValue( zidx);
    p.dataValue = data.getDouble( data.getIndex());
    return p;
  }
View Full Code Here


    Variable v = ncd.findCoordinateAxis("Longitude");
    assert v != null;
    assert v instanceof CoordinateAxis1D;

    // if offset is applied twice, the result is not in +-180 range
    Array data = v.read();
    NCdumpW.printArray(data);
    IndexIterator ii = data.getIndexIterator();
    while (ii.hasNext()) {
      assert Math.abs(ii.getDoubleNext()) < 180 : ii.getDoubleCurrent();
    }
    ncd.close();
  }
View Full Code Here

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

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

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

    IndexIterator dataI = data.getIndexIterator();
    while (dataI.hasNext())
      System.out.println(" coord="+dataI.getObjectNext());
  }
View Full Code Here

    assert gsys.getYHorizAxis() != null;
    assert gsys.getTimeAxis() != null;
    assert gsys.getVerticalAxis() == null;
    assert gsys.getProjection() != null;

    Array data = g.readVolumeData(0);
    assert data.getRank() == 2;
    assert data.getShape()[0] == 1008;
    assert data.getShape()[1] == 1536;
    assert data.getElementType() == short.class;
  }
View Full Code Here

  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

TOP

Related Classes of org.jruby.ext.ffi.Type$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.