Examples of StructureDS


Examples of ucar.nc2.dataset.StructureDS

        -1, null, NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    // record variable
    Variable record = nc.findVariable("record");
    assert record instanceof StructureDS;
    StructureDS rs = (StructureDS) record;
    assert rs.getRank() == 1;
    assert rs.getDimension(0).getLength() == 2;

    /* Read a record */
    Array rsValues = rs.read("1:1:2");
    assert (rsValues instanceof ArrayStructure);
    assert rsValues.getRank() == 1;
    assert rsValues.getShape()[0] == 1;

    StructureData sdata = (StructureData) rsValues.getObject(rsValues.getIndex());
    Array gdata = sdata.getArray("time");
    assert gdata instanceof ArrayInt.D0 : gdata.getClass().getName();
    ArrayInt.D0 tdata = (ArrayInt.D0) gdata;
    int t = tdata.get();
    assert t == 18;

    int t2 = sdata.getScalarInt("time");
    assert t2 == 18;

    /* Read the times: unlimited dimension */
    Variable time = rs.findVariable("time");
    assert time != null;
    Array timeValues = time.read();
    assert (timeValues instanceof ArrayInt.D0);
    ArrayInt.D0 ta = (ArrayInt.D0) timeValues;
    assert (ta.get() == 6) : ta.get();
View Full Code Here

Examples of ucar.nc2.dataset.StructureDS

    assert (Boolean) nc.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    // record variable
    Variable record = nc.findVariable("record");
    assert record instanceof StructureDS;
    StructureDS rs = (StructureDS) record;
    assert rs.getRank() == 1;
    assert rs.getDimension(0).getLength() == 2;

    /* Read a record */
    Array rsValues = rs.read("1:1:2");
    assert (rsValues instanceof ArrayStructure);
    assert rsValues.getRank() == 1;
    assert rsValues.getShape()[0] == 1;

    StructureData sdata = (StructureData) rsValues.getObject(rsValues.getIndex());
    Array gdata = sdata.getArray("time");
    assert gdata instanceof ArrayInt.D0 : gdata.getClass().getName();
    ArrayInt.D0 tdata = (ArrayInt.D0) gdata;
    int t = tdata.get();
    assert t == 18;

    int t2 = sdata.getScalarInt("time");
    assert t2 == 18;

    /* Read the times: unlimited dimension */
    Variable time = rs.findVariable("time");
    Array timeValues = time.read();
    assert (timeValues instanceof ArrayInt.D0);
    ArrayInt.D0 ta = (ArrayInt.D0) timeValues;
    assert (ta.get() == 6) : ta.get();

View Full Code Here

Examples of ucar.nc2.dataset.StructureDS

      if ((v.getDimension(0) == stationDim) &&
          ((v.getRank() == 1) || ((v.getRank() == 2) && (v.getDataType() == DataType.CHAR))))
          vars.add(v.getShortName());
    }

    StructureDS s = new StructurePseudoDS(ds, null, "stnStruct", vars, stationDim);
    obs.addJoin(new JoinMuiltdimStructure(s, obsDim.getLength()));
    obs.addJoin(new JoinArray( time, JoinArray.Type.modulo, obsDim.getLength()));

    if (needFinish) ds.finish();
    return obs;
View Full Code Here

Examples of ucar.nc2.dataset.StructureDS

    } else {
      if (recDimName == null)
        throw new IllegalArgumentException("File <" + this.ncfile.getLocation() +
                "> has no unlimited dimension, specify psuedo record dimension with observationDimension global attribute.");
      this.obsDim = this.ncfile.getRootGroup().findDimension(recDimName);
      this.recordVar = new StructureDS( null, new StructurePseudo(this.ncfile, null, "record", obsDim)); // true
    }

    // create member variables
    List<Variable> recordMembers = ncfile.getVariables();
    for (Variable v : recordMembers) {
View Full Code Here

Examples of ucar.nc2.dataset.StructureDS

      //stationTable.dim = stationDim;
      obsTable.lat = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Lat, stationDim);
      obsTable.lon = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Lon, stationDim);
      obsTable.elev = UnidataPointDatasetHelper.getCoordinateName(ds, AxisType.Height, stationDim);

      StructureDS stns = new StructurePseudoDS(ds, null, "stationPsuedoStructure", null, stationDim);
      obsTable.addJoin( new JoinParentIndex(stns, parentIndexVar));

      return obsTable;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.