Package ucar.ma2

Examples of ucar.ma2.StructureData


        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

                doubleWithinEpsilon( pointOb.getLocation().getLongitude(), trajDsInfo.getExampleTrajStartLon(), 0.0001 ) );
    assertTrue( "Start alt (getPointObsData) <" + pointOb.getLocation().getAltitude() + "> not as expected <" + trajDsInfo.getExampleTrajStartElev() + ">.",
                doubleWithinEpsilon( pointOb.getLocation().getAltitude(), trajDsInfo.getExampleTrajStartElev(), 0.0001 ) );

    // Test with
    StructureData sdata;
    try
    {
      sdata = traj1.getData( 0);
    }
    catch ( IOException e )
View Full Code Here

    {
      assertTrue( "IOException on call to getPointObsData(0): " + e.getMessage(),
                  false );
      return;
    }
    StructureData sdata;
    try
    {
      sdata = pointOb.getData();
    }
    catch ( IOException e )
    {
      assertTrue( "IOException on getData(): " + e.getMessage(),
                  false);
      return;
    }

    String u = sdata.findMember( "alt").getUnitsString();
    assert u.equals( "meters") : "traj.getPointObsData().getData().findMember( \"alt\") units <" + u + "> not as expected";
    //assertTrue( "traj.getPointObsData().getData().findMember( \"alt\") units <" + u + "> not as expected <meters>.",
    //            u.equals( "meters") );

    // ... from getData(0)
View Full Code Here

    // read all the data, create a RecordObs
    ArrayList records = new ArrayList();
    int recno = 0;
    StructureDataIterator ii = recordVar.getStructureIterator();
    while (ii.hasNext()) {
      StructureData sdata = ii.next();
      StructureMembers members = sdata.getStructureMembers();

      Object stationId = null;
      if (hasStations) {
        if ( stationIdType == DataType.INT) {
          int stationNum = sdata.getScalarInt(stnIdVName);
          stationId = new Integer(stationNum);
        } else
          stationId = sdata.getScalarString( stnIdVName).trim();
      }

      String desc = (stnDescVName == null) ? null : sdata.getScalarString(stnDescVName);
      double lat = sdata.convertScalarDouble(latVName);
      double lon = sdata.convertScalarDouble(lonVName);
      double alt = (altVName == null) ? Double.NaN : altScaleFactor * sdata.convertScalarDouble(altVName);
      double obsTime = sdata.convertScalarDouble(members.findMember( obsTimeVName));
      double nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble( members.findMember( nomTimeVName));

      //double obsTime = sdata.convertScalarDouble( members.findMember( obsTimeVName) );
      //double nomTime = (nomTimeVName == null) ? obsTime : sdata.convertScalarDouble( members.findMember( nomTimeVName));

      if (hasStations) {
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.