Package com.subhajit.build

Examples of com.subhajit.build.Manifest$Section


    this.done = 0;

    // LOOK - need test for "all" common case

    // The actual wanted data we can get from this section
    Section intersect = dataSection.intersect(wantSection);
    this.total = intersect.computeSize();
    if (total <= 0) {
      System.out.println("hey");
    }
    assert total > 0;
    int varRank = intersect.getRank();

    // create the List<Dim>
    // Section shifted = intersect.shiftOrigin(dataSection); // want reletive to dataSection
    int wantStride = 1;
    int dataStride = 1;
    for (int ii = varRank - 1; ii >= 0; ii--) {
      Range dr = dataSection.getRange(ii);
      Range wr = wantSection.getRange(ii);
      Range ir = intersect.getRange(ii);
      dimList.add(new Dim(dr, wr, ir, dataStride, wantStride)); // note reversed : fastest first
      dataStride *= dr.length();
      wantStride *= wr.length();
    }

View Full Code Here


      NetcdfFile ncfile = TestH5.open(filename);
      //System.out.println("\n"+ncfile);

      for (Variable v : ncfile.getVariables()) {
        if (v.getSize() > max_size) {
          Section s = makeSubset(v);
          System.out.println("  Try to read variable " + v.getNameAndDimensions() + " size= " + v.getSize() + " section= " + s);
          v.read(s);
        } else {
          System.out.println("  Try to read variable " + v.getNameAndDimensions() + " size= " + v.getSize());
          v.read();
View Full Code Here

  static int max_size = 1000 * 1000 * 10;
  static Section makeSubset(Variable v) throws InvalidRangeException {
    int[] shape = v.getShape();
    shape[0] = 1;
    Section s = new Section(shape);
    long size = s.computeSize();
    shape[0] = (int) Math.max(1, max_size / size);
    return new Section(shape);
  }
View Full Code Here

    if (null == axis) throw new IllegalArgumentException("There is no GeoZ coordinate");
    return readValue( axis, fromVar, index);
  }

  public double readValue(Variable targetVar, Variable fromVar, int[] index) throws InvalidRangeException, IOException {
    Section axisElement = mapIndex( targetVar, fromVar, index);
    Array result = targetVar.read(axisElement);
    return result.nextDouble();
  }
View Full Code Here

  }

  public Section mapIndex(Variable targetVar, Variable fromVar, int[] fromIndex) throws InvalidRangeException {
    List<Dimension> toDims = targetVar.getDimensions();
    List<Dimension> fromDims = fromVar.getDimensions();
    Section result = new Section();

    // each dimension in the target must be present in the source
    for (int i=0; i<toDims.size(); i++) {
      Dimension dim = toDims.get(i);
      int varIndex = fromDims.indexOf(toDims.get(i));
      if (varIndex < 0) throw new IllegalArgumentException("Dimension "+dim+" does not exist");
      result.appendRange(fromIndex[varIndex], fromIndex[varIndex]);
    }
    return result;
  }
View Full Code Here

    Variable v2 = ncfile.findVariable("Opaque");
    assert v2 != null;

    Array data = v2.read();
    assert data.getElementType() == ByteBuffer.class : data.getElementType();
    System.out.println( "data size= "+new Section(data.getShape()));
    NCdump.printArray(data, "Opaque data", System.out, null);


    Array odata = v2.read(new Section("1:20"));
    assert odata.getElementType() == ByteBuffer.class;
    assert odata.getSize() == 20;
    ncfile.close();
  }
View Full Code Here

    // try subset
    data = v.read("0:9:2, :");
    NCdumpW.printArray(data, "read(0:9:2,:)"new PrintWriter( System.out), null);

    data = v.read(new Section().appendRange(0,9,2).appendRange(null));
    NCdumpW.printArray(data, "read(Section)"new PrintWriter( System.out), null);

    // fail
    //int[] origin = new int[] {0, 0};
    //int[] size = new int[] {3, -1};
    //data = v.read(origin, size);

    // from bruno
    int initialIndex = 5;
    int finalIndex = 5;
    data = v.read(initialIndex + ":" + finalIndex + ",:");
    //NCdumpW.printArray(data, "read()",  new PrintWriter(System.out), null);

    System.out.println("Size: " + data.getSize());
    System.out.println("Data: " + data);
    System.out.println("Class: " + data.getClass().getName());
    // loop over outer dimension

    int x = 0;
    while (data.hasNext()) {
      Array as = (Array) data.next(); // inner variable length array of short
      System.out.println("Shape: " + new Section(as.getShape()));
      System.out.println(as);
    }


    ncfile.close();
View Full Code Here

        ncfile = iosp.open(filename);
        if (showFile) System.out.println("\n"+ncfile.toString());

        for (Variable v : ncfile.getVariables()) {
          if (v.getSize() > max_size) {
            Section s = makeSubset(v);
            if (showDetail)
              System.out.println("  Try to read variable " + v.getNameAndDimensions() + " size= " + v.getSize() + " section= " + s);
            v.read(s);
          } else {
            if (showDetail)
View Full Code Here

    int max_size = 1000 * 1000 * 10;

    Section makeSubset(Variable v) throws InvalidRangeException {
      int[] shape = v.getShape();
      shape[0] = 1;
      Section s = new Section(shape);
      long size = s.computeSize();
      shape[0] = (int) Math.max(1, max_size / size);
      return new Section(shape);
    }
View Full Code Here

  public void utestMargolis() throws IOException, InvalidRangeException {
    String dataDir = TestAll.cdmUnitTestDir + "nomads/gfs-hi/";
    GridDataset gridDataset = GridDataset.open( "D:/AStest/margolis/grib2ncdf.ncml" );
    GeoGrid grid = gridDataset.findGridByName( "Turbulence_SIGMET_AIRMET" );
    System.out.println("Grid= "+grid+" section="+ new Section(grid.getShape()));
    System.out.println(" coordSys= "+grid.getCoordinateSystem());

    GeoGrid subset = (GeoGrid) grid.makeSubset(new Range(0, 0), null, new Range(1,1), null, null, null);
    System.out.println("subset= "+subset+" section="+ new Section(subset.getShape()));
    System.out.println(" coordSys= "+subset.getCoordinateSystem());

    gridDataset.close();
  }
View Full Code Here

TOP

Related Classes of com.subhajit.build.Manifest$Section

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.