Package jsonij.json

Examples of jsonij.json.JSON$Array


    String units = v.getUnitsString();
    assert units != null;
    assert units.equals("hours since 2006-09-25T06:00:00Z");

    int count = 0;
    Array data = v.read();
    NCdumpW.printArray(data, "time", new PrintWriter(System.out), null);
    while (data.hasNext()) {
      assert TestAll.closeEnough(data.nextInt(), (count + 1) * 3);
      count++;
    }

    ncfile.close();
  }
View Full Code Here


    String units = v.getUnitsString();
    assert units != null;
    assert units.equals("hours since 2007-04-11T00:00:00Z") : units;

    int count = 0;
    Array data = v.read();
    NCdumpW.printArray(data, "time", new PrintWriter(System.out), null);
    while (data.hasNext()) {
      assert data.nextInt() == count * 3;
      count++;
    }

    ncfile.close();
  }
View Full Code Here

        sbuff = new StringBuilder(64000);
        sbuff.append(structMetadata);
      }

      // read and parse the ODL
      Array A = structMetadataVar.read();
      ArrayChar ca = (ArrayChar) A;
      structMetadata = ca.getString(); // common case only StructMetadata.0, avoid extra copy

      if (sbuff != null)
        sbuff.append(structMetadata);
View Full Code Here

      // make new variable for this dimension map
      Variable v = new Variable(ncfile, parent, null, dataDimName);
      v.setDimensions(geoDimName);
      v.setDataType(DataType.INT);
      int npts = (int) v.getSize();
      Array data = Array.makeArray(v.getDataType(), npts, offset, incr);
      v.setCachedData(data, true);
      v.addAttribute(new Attribute("_DimensionMap", ""));
      parent.addVariable(v);
      if (showWork) System.out.printf(" Add dimensionMap %s %n", v);
    }
View Full Code Here

     */
    public Array readData1(ucar.nc2.Variable v2, Section section)
    throws IOException, InvalidRangeException {
        //doData(raf, ncfile, varList);
        int[] sh=section.getShape();
        Array temp=Array.factory(v2.getDataType(), sh);
        long pos0=0;
        // Suppose that the data has LayoutRegular
        LayoutRegular index=new LayoutRegular(pos0, v2.getElementSize(), v2.getShape(), section);
        if (v2.getShortName().startsWith("time") | v2.getShortName().startsWith("numGates")) {
            temp=readIntData(index, v2);
View Full Code Here

     // Vgroup vgroup = (Vgroup) v2.getSPobject();
     // Range scanRange = section.getRange(0);
     // Range radialRange = section.getRange(1);
     // Range gateRange = section.getRange(2);

      Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape());
      IndexIterator ii = data.getIndexIterator();

      List groups = null;
      String shortName = v2.getShortName();
      if( shortName.startsWith("Reflectivity"))
        groups = volScan.getReflectivityGroups();
View Full Code Here

     * @param channel  WritableByteChannel object - channel that can write bytes.
     * @return the number of bytes written, possibly zero.
     */
    public long readToByteChannel11(ucar.nc2.Variable v2, Section section, WritableByteChannel channel)
    throws java.io.IOException, ucar.ma2.InvalidRangeException {
        Array data = readData(v2, section);
        float[] ftdata=new float[(int)data.getSize()];
        byte[] bytedata=new byte[(int)data.getSize()*4];
        IndexIterator iter=data.getIndexIterator();
        int i=0;
        ByteBuffer buffer=ByteBuffer.allocateDirect(bytedata.length);
        while (iter.hasNext()) { ftdata[i]=iter.getFloatNext();
        bytedata[i]=new Float(ftdata[i]).byteValue();
        buffer.put(bytedata[i]);
View Full Code Here

        xout.writeBytes("  <metar>\n");
        for (Iterator iter = sdata.getMembers().iterator(); iter.hasNext();) {
          StructureMembers.Member m = (StructureMembers.Member) iter.next();
          xout.writeBytes("    <data name='" + m.getName() + "'>");

          Array sdataArray = sdata.getArray(m);
          // System.out.println(m.getName()+" "+m.getDataType()+" "+sdataArray.toString());
          xout.writeBytes(sdataArray.toString() + "</data>\n");
        }

        xout.writeBytes("  </metar>\n");
      }
    };
View Full Code Here

    GridDataset gds = GridDataset.open (filename);
    GeoGrid grid = gds.findGridByName("Temperature");

    long startTime = System.currentTimeMillis();

    Array data = grid.readDataSlice(0, -1, -1, -1);

    long endTime = System.currentTimeMillis();
    long diff = endTime - startTime;
    System.out.println("read "+data.getSize()+"  took "+diff+ " msecs");

    startTime = endTime;
    float[] jdata = (float []) data.get1DJavaArray(float.class);
    endTime = System.currentTimeMillis();
    diff = endTime - startTime;
    System.out.println("convert took "+diff+ " msecs "+jdata[0]);
  }
View Full Code Here

      GeoGrid gg = gridDs.findGridByName("Temperature");
      long took = System.currentTimeMillis() - start;
      System.out.println("open took = " + took+" msecs");

      start = System.currentTimeMillis();
      Array data = gg.readVolumeData(0);
      took = System.currentTimeMillis() - start;
      float size = (float) data.getSize() * gg.getDataType().getSize() / (1000 * 1000);
      System.out.println(size+" Mbytes, took = " + took+" msecs");

    } catch (Exception ioe) {
      ioe.printStackTrace();
    }
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.