TEST(FloodPlot, MatrixFloodPlotDataCountourLevels)
{
  Matrix matrix(10,10);
  for (unsigned i = 0; i < 10; ++i){
    for (unsigned j = 0; j < 10; ++j){
      matrix(i,j) = 10*i+j;
    }
  }
  Vector contourLevels(5);
  contourLevels(0) = 0;
  contourLevels(1) = 25;
  contourLevels(2) = 50;
  contourLevels(3) = 75;
  contourLevels(4) = 100;

  MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(matrix);
  data->interpMethod(LinearInterp);

  FloodPlot::Ptr fp = FloodPlot::create();
  fp->floodPlotData(data);
  fp->contourLevels(contourLevels);
  fp->colorMapRange(45,75);
  fp->showContour(true);
  
  fp->generateImage(toPath("testMatrixFloodPlotDataCountourLevels.png"));

  // passes the visual test
  EXPECT_TRUE(true);
};
TEST_F(SqlFileLargeFixture, FloodPlot8760)
{
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries("Albuquerque Intl Arpt  Isis NM USA TMY3 WMO#=723650", "Hourly", "Heating Coil Air Heating Rate",  "MOB FLOOR 2-4 PERIMETER 2 HEAT PUMP SUP HEAT COIL");
  ASSERT_TRUE(ts);

  // plot it
  FloodPlot::Ptr fp = FloodPlot::create();
  fp->timeseriesData(*ts);
  fp->generateImage(toPath("SqlFileLargeFixture_FloodPlot8760.png"));
}
TEST_F(SqlFileLargeFixture, FloodPlot84868)
{
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries("Albuquerque Intl Arpt  Isis NM USA TMY3 WMO#=723650", "HVAC System Timestep", "Chiller Fan Coil Part Load Ratio",  "COOLSYS1 CHILLER");
  ASSERT_TRUE(ts);

  // plot it
  FloodPlot::Ptr fp = FloodPlot::create();
  fp->timeseriesData(*ts);
  fp->generateImage(toPath("SqlFileLargeFixture_FloodPlot84868.png"));
}
TEST_F(SqlFileLargeFixture, FloodPlot52560)
{
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries("Albuquerque Intl Arpt  Isis NM USA TMY3 WMO#=723650", "HVAC System Timestep", "Zone Mean Air Temperature",  "FLOOR 2 LAB 1");
  ASSERT_TRUE(ts);

  // plot it
  FloodPlot::Ptr fp = FloodPlot::create();
  fp->timeseriesData(*ts);
  fp->generateImage(toPath("SqlFileLargeFixture_FloodPlot52560.png"));
}
TEST_F(RadIlluminanceMapFixture, IlluminanceMapPlot)
{
  utilities::application::Application::instance().qApplication();

  MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(outFile->xVector(),
                                                              outFile->yVector(),
                                                              outFile->illuminanceMap());
  data->interpMethod(linearInterp);

  FloodPlot::Ptr fp = FloodPlot::create();
  fp->setFloodPlotData(data);
  fp->initZoomer(); // no image generated without initializing zoomer
  fp->showContour(true);
  fp->generateImage(L"testRadIlluminanceMapPlot.png");

  // passes the visual test
  EXPECT_TRUE(true);
}
TEST(FloodPlot, MatrixFloodPlotData)
{
  Matrix matrix(10,10);
  for (unsigned i = 0; i < 10; ++i){
    for (unsigned j = 0; j < 10; ++j){
      matrix(i,j) = 10*i+j;
    }
  }

  MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(matrix);

  FloodPlot::Ptr fp = FloodPlot::create();
  fp->floodPlotData(data);
  fp->generateImage(toPath("testMatrixFloodPlotData.png"));

  // passes the visual test
  EXPECT_TRUE(true);
};
Beispiel #7
0
TEST_F(SqlFileFixture, FloodPlot)
{
  std::vector<std::string> availableEnvPeriods = sqlFile.availableEnvPeriods();
  ASSERT_FALSE(availableEnvPeriods.empty());

  // make a timeseries
  openstudio::OptionalTimeSeries ts = sqlFile.timeSeries(availableEnvPeriods[0], "Hourly", "Electricity:Facility",  "");
  ASSERT_TRUE(ts);

  // should have 365 days minus 1 hour
//  Time duration = ts->dateTimes().back() - ts->dateTimes().front();
  Time duration = ts->firstReportDateTime() + Time(ts->daysFromFirstReport(ts->daysFromFirstReport().size()-1)) - ts->firstReportDateTime();
  EXPECT_DOUBLE_EQ(365-1.0/24.0, duration.totalDays());

  // plot it
  FloodPlot::Ptr fp = FloodPlot::create();
  fp->timeseriesData(*ts);
  fp->generateImage(toPath("testFP.png"));
  EXPECT_TRUE(true);
}
TEST(FloodPlot, EricDataPlot)
{
  Vector x(3); x(0) = 3; x(1) = 4; x(2) = 5;
  Vector y(3); y(0) = 0.25; y(1) = 0.5; y(2) = 0.75;
  
  Matrix m(3,3);
  m(0,0) = 1.01328e+011; m(0,1) = 1.25153e+011; m(0,2) = 1.48116e+011;
  m(1,0) = 1.06746e+011; m(1,1) = 1.32534e+011; m(1,2) = 1.52106e+011;
  m(2,0) = 1.11509e+011; m(2,1) = 1.39306e+011; m(2,2) = 1.5545e+011;
  
  MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(x,y,m);
  //MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(m); // this one works (still has weird solid pixel in upper right)
  data->interpMethod(LinearInterp);

  FloodPlot::Ptr fp = FloodPlot::create();
  fp->floodPlotData(data);
  fp->generateImage(toPath("testEricData.png"));

  // does not pass the visual test
  EXPECT_TRUE(true);
};
TEST(FloodPlot, MatrixFloodPlotData2)
{
  Matrix matrix(10,10);
  for (unsigned i = 0; i < 10; ++i){
    for (unsigned j = 0; j < 10; ++j){
      matrix(i,j) = 10*i+j;
    }
  }

  Vector xVector(linspace(-100, 0, 10));
  Vector yVector(linspace(0, 100, 10));
  MatrixFloodPlotData::Ptr data = MatrixFloodPlotData::create(xVector, yVector, matrix);
  data->interpMethod(LinearInterp);

  FloodPlot::Ptr fp = FloodPlot::create();
  fp->floodPlotData(data);
  fp->bottomAxisTitle("X axis");
  fp->leftAxisTitle("Y axis");
  fp->generateImage(toPath("testMatrixFloodPlotData2.png"));

  // passes the visual test
  EXPECT_TRUE(true);
};