Examples of TrajectoryObsDataset


Examples of ucar.nc2.dt.TrajectoryObsDataset

      System.out.println( "Lat var not the same." );
  }

  public void testTwo()
  {
    TrajectoryObsDataset trajDs;
    try
    {
      //trajDs = TrajectoryObsDatasetFactory.open( testDataFileOut );
      StringBuilder errlog = new StringBuilder();
      trajDs = (TrajectoryObsDataset) TypedDatasetFactory.open(FeatureType.TRAJECTORY, testDataFileOut, null, errlog);
    }
    catch ( IOException e )
    {
      assertTrue( "Couldn't open TrajectoryObsDataset <" + testDataFileOut + ">: " + e.getMessage(),
                  false );
      return;
    }

    Date startDate = trajDs.getStartDate();
    Date endDate = trajDs.getEndDate();
    System.out.println( "Dataset start date=" + startDate );
    System.out.println( "Dataset end date  =" + endDate );
    TrajectoryObsDatatype traj = trajDs.getTrajectory( "trajectory data");
    Date trajEndDate;
    Array presArray;
    try
    {
      trajEndDate = traj.getTime( traj.getNumberPoints() - 1);
      presArray = traj.getData( traj.getNumberPoints() - 1, "HADS_A");
    }
    catch ( IOException e )
    {
      assertTrue( "Failed to read last time or pressure from <" + testDataFileOut + ">: " + e.getMessage(),
                  false );
      return;
    }
    System.out.println( "Traj end date  =" + trajEndDate );
    System.out.println( "Pressure end value=" + presArray.getFloat( presArray.getIndex()));


    try
    {
      Thread.sleep( 10000 );
    }
    catch ( InterruptedException e )
    {
    }

    if ( ! trajDs.syncExtend() )
      System.out.println( "File not extended." );
    else
      System.out.println( "File extended" );

    startDate = trajDs.getStartDate();
    endDate = trajDs.getEndDate();
    System.out.println( "Start date=" + startDate );
    System.out.println( "End date  =" + endDate );

    try
    {
View Full Code Here

Examples of ucar.nc2.dt.TrajectoryObsDataset

  public void testSimple_UW_KingAir() throws IOException {
    String location = testFilePath + "/" + testDataFileName;
    assertTrue( "Test file <" + location + "> does not exist.",
                new File( location).exists());

    TrajectoryObsDataset me = null;

    try
    {
      StringBuilder errlog = new StringBuilder();
      me = (TrajectoryObsDataset) TypedDatasetFactory.open(FeatureType.TRAJECTORY, location, null, errlog);
    }
    catch ( IOException e )
    {
      String tmpMsg = "Couldn't create TrajectoryObsDataset from UW KingAir aircraft file <" + location + ">: " + e.getMessage();
      assertTrue( tmpMsg,
                  false);
    }
    assertTrue( "Null TrajectoryObsDataset after open <" + location + "> ",
                me != null );
    assertTrue( "Dataset <" + location + "> not a SimpleTrajectoryObsDataset.",
                me instanceof SimpleTrajectoryObsDataset );

    // Check TypedDataset info.
    long startDateLong = 1106134797000l;
    long endDateLong = 1106149487000l;
    float expStartLat = 17.140499f;
    float expEndLat = 17.1403007f;
    float expStartLon = -61.77740097f;
    float expEndLon = -61.7790985f;
    float expStartElev = 17.0f;
    float expEndElev = 13.0f;
    Object exampleVarStartVal = new Float(13.1f);
    Object exampleVarEndVal = new Float(11.4f);

    TestTrajectoryObsDataset.TrajDatasetInfo trajDsInfo =
            new TestTrajectoryObsDataset.TrajDatasetInfo( null, null, location,
                                                   startDateLong, endDateLong, null,
                                                   1, "history", "TrackFile.java,v 1.19 2002/05/24 16:30:34 martin Exp",
                                                   15, "HWSPD", "wind speed", "m/s", 0, new int[] {}, DataType.FLOAT.toString(), 4,
                                                   exampleVarStartVal, exampleVarEndVal,
                                                   1, "trajectory data", null, 545,
                                                   expStartLat, expEndLat,
                                                   expStartLon, expEndLon,
                                                   expStartElev, expEndElev );
    TestTrajectoryObsDataset.testTrajInfo( me, trajDsInfo );

    me.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.TrajectoryObsDataset

  public void testSimple_WMI_Lear() throws IOException {
    String location = testFilePath + "/" + test_WMI_Lear_FileName;
    assertTrue( "Test file <" + location + "> does not exist.",
                new File( location ).exists() );

    TrajectoryObsDataset me = null;

    try
    {
      StringBuilder errlog = new StringBuilder();
      me = (TrajectoryObsDataset) TypedDatasetFactory.open(FeatureType.TRAJECTORY, location, null, errlog);
    }
    catch ( IOException e )
    {
      String tmpMsg = "Couldn't create TrajectoryObsDataset from UW KingAir aircraft file <" + location + ">: " + e.getMessage();
      assertTrue( tmpMsg,
                  false );
    }
    assertTrue( "Null TrajectoryObsDataset after open <" + location + "> ",
                me != null );
    assertTrue( "Dataset <" + location + "> not a SimpleTrajectoryObsDataset.",
                me instanceof SimpleTrajectoryObsDataset );

    // Check TypedDataset info.
    long startDateLong = 1054157297000l;
    long endDateLong = 1054159198000l;
    float expStartLat = 38.5473f;
    float expEndLat = 38.3979988098f;
    float expStartLon = -89.8163f;
    float expEndLon = -88.6897964f;
    float expStartElev = 89.90000188f;
    float expEndElev = 7998.0f;
    Object exampleVarStartVal = new Float( 29.0f );
    Object exampleVarEndVal = new Float( -28.2f );

    TestTrajectoryObsDataset.TrajDatasetInfo trajDsInfo =
            new TestTrajectoryObsDataset.TrajDatasetInfo( null, null, location,
                                                          startDateLong, endDateLong, null,
                                                          1, "history", "TrackFile.java,v 1.20 2003/05/07 04:53:23 maclean",
                                                          7, "tdry", "temperature", "deg_C", 0, new int[]{}, DataType.FLOAT.toString(), 5,
                                                          exampleVarStartVal, exampleVarEndVal,
                                                          1, "trajectory data", null, 588,
                                                          expStartLat, expEndLat,
                                                          expStartLon, expEndLon,
                                                          expStartElev, expEndElev );
    TestTrajectoryObsDataset.testTrajInfo( me, trajDsInfo );

    me.close();
  }
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.