Package ucar.nc2.stream

Examples of ucar.nc2.stream.NcStreamProto$StructureData$Builder


  }

  private void entryTest( StructureDataIterator dodsIt, BasicEntry expectedEntry, float longDelta )
  {

    StructureData curData;
    try
    {
      if ( ! dodsIt.hasNext())
        assertTrue( "DODS result does not contain expected entry.", false);
      curData = dodsIt.next();
    }
    catch ( IOException e )
    {
      assertTrue( "Unexpected IOException reading from structure iterator: " + e.getMessage(),
                false);
      return;
    }
    int year = curData.getScalarInt( "year");
    int day = curData.getScalarInt( "day");
    int hours = curData.getScalarInt( "hours");
    int minutes = curData.getScalarInt( "minutes");
    int seconds = curData.getScalarInt( "seconds");
    int m_seconds = curData.getScalarInt( "m_seconds");
    float longitude = curData.getScalarFloat( "longitude");
    int rev_num = curData.getScalarInt( "rev_num");
    int wvc_rows = curData.getScalarInt( "wvc_rows");
    String dodsUrl = curData.getScalarString( "DODS_URL");
//    System.out.println( "year = " + year );
//    System.out.println( "day = " + day );
//    System.out.println( "hours = " + hours );
//    System.out.println( "minutes = " + minutes );
//    System.out.println( "longitude = " + longitude );
View Full Code Here


    System.out.printf(" count = %d%n", as.getStructureDataCount());

    int count = 0;
    StructureDataIterator iter = as.getStructureDataIterator();
    while (iter.hasNext()) {
      StructureData sdata = iter.next();
      count++;
    }
    System.out.printf(" count = %d%n", count);

    int count2 = 0;
    StructureDataIterator iter2 = record.getStructureIterator();
    while (iter2.hasNext()) {
      StructureData sdata = iter2.next();
      count2++;
    }
    System.out.printf(" count2 = %d%n", count2);

    assert count2 == count;
View Full Code Here

      return orgIter.hasNext();
    }

    @Override
    public StructureData next() throws IOException {
      StructureData sdata = orgIter.next();
      return newStruct.convert(sdata, count++);
    }
View Full Code Here

        profile.resetIteration();
        while (profile.hasNext()) {
          ucar.nc2.ft.PointFeature pointFeature = profile.next();
          System.out.printf("--pointFeature=%d %n", pointFeature.hashCode());
          StructureData sdata = pointFeature.getData();
          NCdumpW.printStructureData(pw, sdata);
        }
      }
    }
  }
View Full Code Here

    DateUnit timeUnit = pobs.getTimeUnit();
    assert timeUnit.makeDate(pobs.getNominalTime()).equals(pobs.getNominalTimeAsDate());
    assert timeUnit.makeDate(pobs.getObservationTime()).equals(pobs.getObservationTimeAsDate());

    StructureData sdata = pobs.getData();
    assert null != sdata;
    checkData(sdata);
  }
View Full Code Here

  int countObs(PointFeatureCollection pfc) throws IOException {
    int count = 0;
    pfc.resetIteration();
    while (pfc.hasNext()) {
      PointFeature pf = pfc.next();
      StructureData sd = pf.getData();
      count++;
    }
    return count;
  }
View Full Code Here

    int numObs = 0;
    while (dataIterator.hasNext()) {
      PointFeature po = (PointFeature) dataIterator.next();
      numObs++;
      ucar.unidata.geoloc.EarthLocation el = po.getLocation();
      StructureData structure = po.getData();
      assert llr.contains(el.getLatLon()) : el.getLatLon() + " not in " + llr;

      Date obsDate = po.getObservationTimeAsDate();
      assert dr.included(obsDate) : df.toDateTimeString(obsDate) + " not in " + dr;
      if (numObs % 1000 == 0)
View Full Code Here

      int numObs = 0;
      while (dataIterator.hasNext()) {
        PointFeature po = (PointFeature) dataIterator.next();
        numObs++;
        ucar.unidata.geoloc.EarthLocation el = po.getLocation();
        StructureData structure = po.getData();
        assert llr.contains(el.getLatLon()) : el.getLatLon();
        assert dr.included(po.getNominalTimeAsDate());
        if (numObs % 1000 == 0)
          System.out.printf("%d el = %s %n", numObs, el);
      }
View Full Code Here

      StationTimeSeriesFeature sf = sfc.next();

      sf.resetIteration();
      while (sf.hasNext()) {
        PointFeature pf = sf.next();
        StructureData sdata = pf.getData();
        byte bval = sdata.getScalarByte("_isMissing");
        if (bval == 1) countMissing++;
        count++;
      }
    }
View Full Code Here

    // Read all data in point oriented manner.
    startDate = System.currentTimeMillis();
    for ( int i = 0; i < trajDt.getNumberPoints(); i++ )
    {
      StructureData structData = trajDt.getData( i );
    }
    endDate = System.currentTimeMillis();
    System.out.println( "Point-oriented read of record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );

    // Read all data in point oriented manner with iterator.
    startDate = System.currentTimeMillis();
    for ( DataIterator it = trajDt.getDataIterator( 0); it.hasNext(); )
    {
      PointObsDatatype pointOb = (PointObsDatatype) it.nextData();
    }
    endDate = System.currentTimeMillis();
    System.out.println( "Point-oriented iterator read of record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );

    //================ non-record written data ====================
    location = testFilePath + "/" + test_Raf_1_3_NoRecvar_FileName;
    assertTrue( "Test file <" + location + "> does not exist.",
                new File( location ).exists() );
    try
    {
      StringBuilder errlog = new StringBuilder();
      me = (TrajectoryObsDataset) TypedDatasetFactory.open(FeatureType.TRAJECTORY, location, null, errlog);
    }
    catch ( IOException e )
    {
      String tmpMsg = "Couldn't create TrajectoryObsDataset from RAF aircraft file <" + location + ">: " + e.getMessage();
      assertTrue( tmpMsg,
                  false );
    }
    assertTrue( "Null TrajectoryObsDataset after open <" + location + "> ",
                me != null );
    assertTrue( "Dataset <" + location + "> not a RafTrajectoryObsDataset.",
                me instanceof RafTrajectoryObsDataset );

    // Read all data in variable oriented manner.
    trajDt = me.getTrajectory( "1Hz data" );

    range = trajDt.getFullRange();
    startDate = System.currentTimeMillis();
    for ( Iterator it = trajDt.getDataVariables().iterator(); it.hasNext(); )
    {
      VariableSimpleIF var = (VariableSimpleIF) it.next();
      Array a = trajDt.getData( range, var.getShortName() );
    }
    endDate = System.currentTimeMillis();
    System.out.println( "Variable-oriented read of non-record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );

    // Read all data in point oriented manner.
    startDate = System.currentTimeMillis();
    for ( int i = 0; i < trajDt.getNumberPoints(); i++ )
    {
      StructureData structData = trajDt.getData( i );
    }
    endDate = System.currentTimeMillis();
    System.out.println( "Point-oriented read of non-record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );

    // Read all data in point oriented manner with iterator.
View Full Code Here

TOP

Related Classes of ucar.nc2.stream.NcStreamProto$StructureData$Builder

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.