Package ucar.ma2

Examples of ucar.ma2.StructureData


  protected void initStationHelper() {
    try {
      stationHelper = new StationHelper();
      StructureDataIterator siter = ft.getStationDataIterator(-1);
      while (siter.hasNext()) {
        StructureData stationData = siter.next();
        Station s = makeStation(stationData, siter.getCurrentRecno());
        if (s != null)
          stationHelper.addStation( s);
      }
    } catch (IOException ioe) {
View Full Code Here


      e.printStackTrace();
    }
  }

  public StructureData getJoinData(Cursor cursor) {
    StructureData sdata = cursor.tableData[0]; // LOOK ??
    int index = sdata.getScalarInt(parentIndex);
    return parentData.getStructureData(index);
  }
View Full Code Here

      ucar.unidata.geoloc.Station ss = sod.getStation();
      assert (ss.getName().equals(s.getName()));

      System.out.println(ss.getName() + " " + format.toDateTimeStringISO( sod.getObservationTimeAsDate()));

      StructureData sdata = sod.getData();
      assert sdata != null;
    }

    System.out.println("------------------\n");
    Date start = format.isoDateTimeFormat("2007-03-27T09:18:56Z");
    Date end = format.isoDateTimeFormat("2007-03-30T10:52:48Z");

    iter = sdc.getDataIterator(s, start, end);
    while (iter.hasNext()) {
      Object o = iter.nextData();
      assert (o instanceof StationObsDatatype);
      StationObsDatatype sod = (StationObsDatatype) o;
      ucar.unidata.geoloc.Station ss = sod.getStation();
      assert (ss.getName().equals(s.getName()));

      System.out.println(ss.getName() + " " + format.toDateTimeStringISO( sod.getObservationTimeAsDate()));

      StructureData sdata = sod.getData();
      assert sdata != null;
    }

  }
View Full Code Here

    reset();
  }

  @Override
  public StructureData next() throws IOException {
    StructureData sdata;
    currRecord = indexIter.next();
    try {
      sdata = s.readStructure( currRecord);
    } catch (ucar.ma2.InvalidRangeException e) {
      log.error("StructureDataIteratorIndexed.nextStructureData recno=" + currRecord, e);
View Full Code Here

  }

  public boolean hasNext() throws IOException {

    while (true) {
      StructureData sdata = nextStructureData();
      if (sdata == null) break;
      feature = makeFeature(structIter.getCurrentRecno(), sdata);
      if (feature == null) continue;
      if (feature.getLocation().isMissing()) {
        continue;
View Full Code Here

    StructureMembers members = as.getStructureMembers();
    latMember = members.findMember(latVar.getShortName());
    lonMember = members.findMember(lonVar.getShortName());
    innerMember = members.findMember(innerSequence.getShortName());

    StructureData first = as.getStructureData(0);
    StructureData innerFirst = first.getScalarStructure(innerMember);
    StructureMembers innerMembers = innerFirst.getStructureMembers();

    if (isProfile) {
      timeMember = members.findMember(timeVar.getShortName());
      altMember = innerMembers.findMember(altVar.getShortName());
    } else {
View Full Code Here

    StructureMembers.Member altMember = members.findMember(altVar.getShortName());
    StructureMembers.Member idMember = members.findMember(ID);

    int n = (int) as.getSize();
    for (int i=0; i<n; i++) {
      StructureData sdata = as.getStructureData(i);
      double lat = sdata.convertScalarDouble(latMember);
      double lon = sdata.convertScalarDouble(lonMember);
      double alt = sdata.convertScalarDouble(altMember);
      int id = sdata.getScalarInt(idMember);

      StationImpl s = new StationImpl(Integer.toString(id), "Station"+i,lat, lon, alt);
      stations.add(s);
    }
  }
View Full Code Here

    ArrayStructure as = (ArrayStructure) dodsFile.readWithCE(outerSequence, CE);

    /* unwrap the outer structure
    StructureMembers outerMembers = as.getStructureMembers();
    StructureMembers.Member outerMember = outerMembers.findMember(outerSequence.getShortName()); */
    StructureData outerStructure = as.getStructureData(0);

    // get at the inner sequence
    ArrayStructure asInner = (ArrayStructure) outerStructure.getArray(innerSequence.getShortName());
    StructureMembers innerMembers = asInner.getStructureMembers();
    StructureMembers.Member timeMember = innerMembers.findMember(timeVar.getShortName());

    int n = (int) asInner.getSize();
    ArrayList stationData = new ArrayList(n);
    for (int i=0; i<n; i++) {
      StructureData sdata = asInner.getStructureData(i);
      double obsTime = sdata.convertScalarDouble(timeMember);
      stationData.add( new SeqStationObs(s, obsTime, sdata));
    }
    return stationData;
  }
View Full Code Here

      this.recno = recno;
      this.sdata = sdata;

      double lat = sdata.convertScalarDouble(latMember);
      double lon = sdata.convertScalarDouble(lonMember);
      StructureData inner = sdata.getScalarStructure(innerMember);

      double alt = 0.0;

      if (isProfile) {
        obsTime = sdata.convertScalarDouble(timeMember);
        alt = inner.convertScalarDouble(altMember);
      } else {
        obsTime = inner.convertScalarDouble(timeMember);
        alt = sdata.convertScalarDouble(altMember);
      }

      nomTime = obsTime;
      location = new ucar.unidata.geoloc.EarthLocationImpl( lat, lon, alt);
View Full Code Here

  public void utestNestedTable() throws IOException, InvalidRangeException {
    String filename = TestAll.cdmLocalTestDataDir + "dataset/nestedTable.bufr";
    NetcdfFile ncfile = ucar.nc2.dataset.NetcdfDataset.openFile(filename, null);
    Structure outer = (Structure) ncfile.findVariable(BufrIosp.obsRecord);
    StructureData data = outer.readStructure(0);
    //NCdumpW.printStructureData( new PrintWriter(System.out), data);

    assert data.getScalarShort("Latitude") == 32767;

    ArrayStructure as = data.getArrayStructure("struct1");
    assert as != null;
    assert as.getScalarShort(0, as.findMember("Wind_speed")) == 61;

    ncfile.close();
  }
View Full Code Here

TOP

Related Classes of ucar.ma2.StructureData

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.