Package org.codehaus.backport175.reader.bytecode

Examples of org.codehaus.backport175.reader.bytecode.AnnotationElement$Array


  public void utestEnum2() throws InvalidRangeException, IOException {
    NetcdfFile ncfile = NetcdfDataset.openFile("D:/netcdf4/tst_enum_data.nc", null);
    Variable v2 = ncfile.findVariable("primary_cloud");
    assert v2 != null;

    Array data = v2.read();
    assert data.getElementType() == byte.class;

    NetcdfDataset ncd = NetcdfDataset.openDataset("D:/netcdf4/tst_enum_data.nc");
    v2 = ncd.findVariable("primary_cloud");
    assert v2 != null;

    data = v2.read();
    assert data.getElementType() == String.class;
    ncfile.close();
  }
View Full Code Here


  public void testTime() throws IOException {
    H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    NetcdfFile ncfile = TestH5.openH5("support/time.h5");

    Variable v = ncfile.findVariable("dset");
    Array data = v.read();
    NCdump.printArray(data, "dset", System.out, null);
    System.out.println( "\n**** testReadNetcdf4 done\n\n"+ncfile);
    ncfile.close();
  }
View Full Code Here

  public void testCompoundEnum() throws IOException {
    H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    NetcdfFile ncfile = TestH5.openH5("support/cenum.h5");
    Variable v = ncfile.findVariable("enum");
    Array data = v.read();
    NCdump.printArray(data, "enum", System.out, null);
    System.out.println( "\n**** testReadNetcdf4 done\n\n"+ncfile);
    ncfile.close();
  }
View Full Code Here

  public void utestEnum() throws IOException {
    H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    String filename = testDir+"nc4/tst_enum_data.nc";
    NetcdfFile ncfile = TestNC2.open(filename);
    Variable v = ncfile.findVariable("primary_cloud");                       
    Array data = v.read();
    System.out.println("\n**** testReadNetcdf4 done\n\n" + ncfile);
    NCdumpW.printArray(data, "primary_cloud", new PrintWriter( System.out), null);
    ncfile.close();
  }
View Full Code Here

    //H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    String filename = testDir+"tst/tst_strings.nc";
    NetcdfFile ncfile = TestNC2.open(filename);
    System.out.println("\n**** testReadNetcdf4 done\n\n" + ncfile);
    Variable v = ncfile.findVariable("measure_for_measure_var");
    Array data = v.read();
    NCdumpW.printArray(data, "measure_for_measure_var"new PrintWriter( System.out), null);
    ncfile.close();
  }
View Full Code Here

    //String filename = "C:/data/work/bruno/fpsc_d1wave_24-11.nc";
    String filename = testDir+"vlen/fpcs_1dwave_2.nc";
    NetcdfFile ncfile = TestNC2.open(filename);
    System.out.println("\n**** testReadNetcdf4 done\n\n" + ncfile);
    Variable v = ncfile.findVariable("levels");
    Array data = v.read();
    NCdumpW.printArray(data, "read()"new PrintWriter( System.out), null);

    int  count = 0;
    while (data.hasNext()) {
      Array as = (Array) data.next();
      NCdumpW.printArray(as, " "+count,  new PrintWriter( System.out), null);
      count++;
    }

    // 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

    //H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    String filename = testDir+"vlen/cdm_sea_soundings.nc4";
    NetcdfFile ncfile = TestNC2.open(filename);
    System.out.println("\n**** testReadNetcdf4 done\n\n" + ncfile);
    Variable v = ncfile.findVariable("fun_soundings");
    Array data = v.read();
    NCdumpW.printArray(data, "fun_soundings"new PrintWriter( System.out), null);
    ncfile.close();
  }
View Full Code Here

     * @throws InvalidRangeException  invalid Range
     */
    public Array readData(Variable v2, Section section)
            throws IOException, InvalidRangeException {
        long  start = System.currentTimeMillis();
        Array array = areaReader.readVariable(v2, section);
        long  end   = System.currentTimeMillis() - start;
        return array;
    }
View Full Code Here

            throw new IllegalArgumentException(
                "McIDASArea coordTransformVariable " + ctv.getFullName()
                + " must have " + attName + " attribute");
        }

        Array arr = att.getValues();
        return (int[]) arr.get1DJavaArray(int.class);
    }
View Full Code Here

    String units = ds.findAttValueIgnoreCase(p0Var, "units", "hPa");

    // create the data and the variable
    try { // p(k) = p0 * exp(-lev(k))
      double p0 = p0Var.readScalarDouble();
      Array levelData = levelVar.read();
      Array pressureData = Array.factory(double.class, levelData.getShape());
      IndexIterator ii = levelData.getIndexIterator();
      IndexIterator iip = pressureData.getIndexIterator();
      while (ii.hasNext()) {
        double val = p0 * Math.exp(-1.0 * ii.getDoubleNext());
        iip.setDoubleNext(val);
      }

View Full Code Here

TOP

Related Classes of org.codehaus.backport175.reader.bytecode.AnnotationElement$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.