Package kameleon.document2

Examples of kameleon.document2.Array


    List vars = ncd.getVariables();
    for (int i = 0; i < vars.size(); i++) {
      Variable v =  (Variable) vars.get(i);
      if (!v.getFullName().equals("record")) {
        Array data = v.read();
        System.out.println(" read "+v.getFullName()+" size = "+ data.getSize());
      }
    }

    ncd.close();
View Full Code Here


    assert v.getFullName().equals("svar");
    assert v.getRank() == 1;
    assert v.getSize() == 80;
    assert v.getDataType() == DataType.CHAR : v.getDataType();

    Array a = v.read();
    assert a.getRank() == 1;
    assert a.getSize() == 80 : a.getSize();
    assert a.getElementType() == DataType.CHAR.getPrimitiveClassType();

    a = v.read("1:10");
    assert a.getRank() == 1;
    assert a.getSize() == 10 : a.getSize();
    assert a.getElementType() == DataType.CHAR.getPrimitiveClassType();

    // string array
    assert(null != (v = dodsfile.findVariable("names")));
    assert v.getFullName().equals("names");
    assert v.getRank() == 2;
    assert v.getSize() == 3 * 80;
    assert v.getDataType() == DataType.CHAR : v.getDataType();

    a = v.read();
    assert a.getRank() == 2;
    assert a.getSize() == 3 * 80 : a.getSize();
    assert a.getElementType() == DataType.CHAR.getPrimitiveClassType();

    a = v.read("0:1,1:10");
    assert a.getRank() == 2;
    assert a.getSize() == 2 * 10 : a.getSize();
    assert a.getElementType() == DataType.CHAR.getPrimitiveClassType();
  }
View Full Code Here

    ncfile.close();

  }

   private void testReadData(Variable v) {
    Array a = null;
    assert(null != v);

    assert(null != v.getDimension(0));
    try {
        a = v.read();
        assert(null != a);
    } catch (java.io.IOException e) {
        e.printStackTrace();
        assert(false);
    }
    assert( v.getSize() == a.getSize() );
  }
View Full Code Here

        assert(false);
    }
    assert( v.getSize() == a.getSize() );
  }
   private float testReadScalar(Variable v) {
    Array a = null;
    assert(null != v);
    try {
        a = v.read();
        assert(null != a);
    } catch (java.io.IOException e) {
        e.printStackTrace();
        assert(false);
    }
    IndexIterator ii = a.getIndexIterator();
    return ii.getFloatNext();
  }
View Full Code Here

        assert scanR.getLength() == scanV.getLength();

        Variable elevR =  nexrad2.findVariable("elevationR");
        assert elevR != null;
        Array elevRdata = elevR.read();
        Variable elevR_HI =  nexrad2.findVariable("elevationR_HI");
        assert elevR_HI != null;
        Array elevR_HIdata = elevR_HI.read();
        assert elevR_HIdata != null;

        Variable elevV =  nexrad2.findVariable("elevationV");
        assert elevV != null;
        Array elevVdata = elevV.read();
        Variable elevV_HI =  nexrad2.findVariable("elevationV_HI");
        assert elevV_HI != null;
        Array elevV_HIdata = elevV_HI.read();
        assert elevV_HIdata != null;

        assert elevRdata.getSize() ==  elevVdata.getSize();

        Variable v =  nexrad2.findVariable("Reflectivity");
        assert v != null;
        Array data = v.read();

        v =  nexrad2.findVariable("RadialVelocity");
        assert v != null;
        data = v.read();
View Full Code Here

        assert scanR.getLength() == scanV.getLength();

        Variable elevR =  nexrad2.findVariable("elevationR");
        assert elevR != null;
        Array elevRdata = elevR.read();
        IndexIterator elevRiter = elevRdata.getIndexIterator();
        Variable elevR_HI =  nexrad2.findVariable("elevationR_HI");
        assert elevR_HI != null;
        Array elevRdataHI = elevR_HI.read();
        IndexIterator elevRiterHI = elevRdataHI.getIndexIterator();

        Variable elevV =  nexrad2.findVariable("elevationV");
        assert elevV != null;
        Array elevVdata = elevV.read();
        IndexIterator elevViter = elevVdata.getIndexIterator();
        Variable elevV_HI =  nexrad2.findVariable("elevationV_HI");
        assert elevV_HI != null;
        Array elevVdataHI = elevV.read();
        IndexIterator elevViterHI = elevVdataHI.getIndexIterator();

        assert elevRdata.getSize() ==  elevVdata.getSize();

        int count = 0;
        boolean ok = true;
View Full Code Here

    N3header.Vinfo vinfo = (N3header.Vinfo) readVar.getSPobject();
    assertTrue( vinfo.isRecord );
    assertEquals( 1, vinfo.vsize );

    Array byteData = readVar.read();

    // File was created with the following data
    //     byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9};
    // But extra padding (see issue CDM-52) caused each byte to be padded out to 4 bytes.
    assertEquals( 1, byteData.getByte( 0 ));
    assertEquals( 0, byteData.getByte( 1 ));
    assertEquals( 0, byteData.getByte( 2 ));
    assertEquals( 0, byteData.getByte( 3 ));
    assertEquals( 2, byteData.getByte( 4 ));
    assertEquals( 0, byteData.getByte( 5 ));
    assertEquals( 0, byteData.getByte( 6 ));
    assertEquals( 0, byteData.getByte( 7 ));
    assertEquals( 3, byteData.getByte( 8 ));
    assertEquals( 0, byteData.getByte( 9 ));
    assertEquals( 0, byteData.getByte( 10 ));
    assertEquals( 0, byteData.getByte( 11 ));
    assertEquals( 4, byteData.getByte( 12 ));
    assertEquals( 0, byteData.getByte( 13 ));
    assertEquals( 0, byteData.getByte( 14 ));
    assertEquals( 0, byteData.getByte( 15 ));
    assertEquals( 5, byteData.getByte( 16 ));
    assertEquals( 0, byteData.getByte( 17 ));

    try {
      byteData.getByte( 18 );
    } catch ( ArrayIndexOutOfBoundsException e ) {
      return;
    } catch ( Exception e) {
      fail( "Unexpected exception: " + e.getMessage());
      return;
View Full Code Here

    N3header.Vinfo vinfo = (N3header.Vinfo) var.getSPobject();
    assertTrue( vinfo.isRecord);
    assertEquals( 1, vinfo.vsize );

    byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9};
    Array dataArray = Array.factory( DataType.BYTE, new int[]{data.length}, data );
    ncfWriteable.write( var.getFullNameEscaped(), dataArray );
    ncfWriteable.close();

    NetcdfFile ncf = NetcdfFile.open( testFile.getPath() );
    Variable readVar = ncf.findVariable( "v" );
View Full Code Here

    vinfo = (N3header.Vinfo) var2.getSPobject();
    assertTrue( vinfo.isRecord);
    assertEquals( 4, vinfo.vsize );

    byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9};
    Array dataArray = Array.factory( DataType.BYTE, new int[]{data.length}, data );
    ncfWriteable.write( var.getFullNameEscaped(), dataArray );
    ncfWriteable.close();

    NetcdfFile ncf = NetcdfFile.open( testFile.getPath() );
    Variable readVar = ncf.findVariable( "v" );
View Full Code Here

    N3header.Vinfo vinfo = (N3header.Vinfo) var.getSPobject();
    assertTrue( vinfo.isRecord);
    assertEquals( 3, vinfo.vsize );

    byte[] data = {1, 2, 3, 11, 12, 13, 21, 22, 23, -1, -2, -3};
    Array dataArray = Array.factory( DataType.BYTE, new int[]{4,3}, data );
    ncfWriteable.write( var.getFullNameEscaped(), dataArray );
    ncfWriteable.close();

    NetcdfFile ncf = NetcdfFile.open( testFile.getPath() );
    Variable readVar = ncf.findVariable( "v" );
View Full Code Here

TOP

Related Classes of kameleon.document2.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.