Package ucar.ma2

Examples of ucar.ma2.Section


  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


    // we have to translate the want section into the same rank as the storageSize, in order to be able to call
    // Section.intersect(). It appears that storageSize (actually msl.chunkSize) may have an extra dimension, reletive
    // to the Variable.
    if ((dtype == DataType.CHAR) && (wantSection.getRank() < vinfo.storageSize.length))
      this.want = new Section(wantSection).appendRange(1);
    else
      this.want = wantSection;

    // one less chunk dimension, except in the case of char
    int nChunkDims = (dtype == DataType.CHAR) ? vinfo.storageSize.length : vinfo.storageSize.length - 1;
View Full Code Here

    // we have to translate the want section into the same rank as the storageSize, in order to be able to call
    // Section.intersect(). It appears that storageSize (actually msl.chunkSize) may have an extra dimension, reletive
    // to the Variable.
    DataType dtype = v2.getDataType();
    if ((dtype == DataType.CHAR) && (wantSection.getRank() < vinfo.storageSize.length))
      this.want = new Section(wantSection).appendRange(1);
    else
      this.want = wantSection;

    // one less chunk dimension, except in the case of char
    nChunkDims = (dtype == DataType.CHAR) ? vinfo.storageSize.length : vinfo.storageSize.length - 1;
View Full Code Here

    try {
      ncfile = NetcdfFile.open(filename);

      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

    System.out.println("\n------Reading ncfile "+ncfile.location);
    try {

      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

    System.out.printf("%s%n", spec);
    assert spec.section.equals(v.getShapeAsSection());

    spec = ParsedSectionSpec.parseVariableSection(ncfile, "temperature(1,0:127:2)");
    System.out.printf("%s%n", spec);
    Section s = new Section("1,0:127:2");
    assert spec.section.equals(s) : spec.section + " != " + s;

    spec = ParsedSectionSpec.parseVariableSection(ncfile, "temperature(:,0:127:2)");
    System.out.printf("%s%n", spec);
    s = new Section("0:63,0:127:2");
    assert spec.section.equals(s) : spec.section + " != " + s;

    ncfile.close();
  }
View Full Code Here

    System.out.printf("%s%n", spec);
    assert spec.section.equals(v2.getShapeAsSection());

    spec = ParsedSectionSpec.parseVariableSection(ncfile, "group\\.name/var\\.name(1,0:0)");
    System.out.printf("%s%n", spec);
    Section s = new Section("1,0");
    assert spec.section.equals(s);

    ncfile.close();
  }
View Full Code Here

    System.out.printf("%s%n", spec);
    assert spec.section.equals(v2.getShapeAsSection());

    spec = ParsedSectionSpec.parseVariableSection(ncfile, "group\\(name/var\\(name(1,0:0)");
    System.out.printf("%s%n", spec);
    Section s = new Section("1,0");
    assert spec.section.equals(s);

    ncfile.close();
  }
View Full Code Here

    super(name);
  }

  public void testFull() throws InvalidRangeException {
    int[] shape = new int[] {123,22,92,12};
    Section section = new Section(shape);
    IndexChunker index = new IndexChunker(shape, section);
    assert index.getTotalNelems() == section.computeSize();
    IndexChunker.Chunk chunk = index.next();
    assert chunk.getNelems() == section.computeSize();
    assert !index.hasNext();
  }
View Full Code Here

TOP

Related Classes of ucar.ma2.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.