Package jsonij.json

Examples of jsonij.json.JSON$Array


    NetcdfFile ncfile = TestH5.openH5("samples/opaque.h5");
    System.out.println( "\n"+ncfile);
    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


  public void testEnum() throws InvalidRangeException, IOException {
    NetcdfFile ncfile = TestH5.openH5("support/enum.h5");
    Variable v2 = ncfile.findVariable("enum");
    assert v2 != null;

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

    NetcdfDataset ncd = TestH5.openH5dataset("support/enum.h5");
    v2 = ncd.findVariable("enum");
    assert v2 != null;

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

  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

TOP

Related Classes of jsonij.json.JSON$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.