Exemple #1
0
def test_interpolate_to_timestep():
    """Test the interoplation method on the continuous collection."""
    values = list(xrange(24))
    test_header = Header(GenericType('Test Type', 'test'), 'test',
                         AnalysisPeriod(end_month=1, end_day=1))
    dc2 = HourlyContinuousCollection(test_header, values)

    # check the interpolate data functions
    interp_coll1 = dc2.interpolate_to_timestep(2)
    interp_coll2 = dc2.interpolate_to_timestep(2, True)
    assert interp_coll1[1] == 0.5
    assert interp_coll2[1] == 0.25
    assert 'Minute' in interp_coll1.timestep_text
Exemple #2
0
def test_hourlyplot_sub_hourly():
    """Test the initialization of MonthlyChart with a sub-hourly collection."""
    header = Header(Temperature(), 'C', AnalysisPeriod())
    values = list(range(8760))
    dc1 = HourlyContinuousCollection(header, values)
    data_coll = dc1.interpolate_to_timestep(4)
    month_chart = MonthlyChart([data_coll])

    meshes = month_chart.data_meshes
    assert len(meshes) == 1
    assert isinstance(meshes[0], Mesh2D)
    assert len(meshes[0].faces) == 24 * 12 * 4
    assert meshes[0].min == Point2D(0, 0)
Exemple #3
0
def test_hourlyplot_sub_hourly():
    """Test the initialization of HourlyPlot and basic properties."""
    header = Header(Temperature(), 'C', AnalysisPeriod())
    values = list(range(8760))
    dc1 = HourlyContinuousCollection(header, values)
    data_coll = dc1.interpolate_to_timestep(4)
    hour_plot = HourlyPlot(data_coll, y_dim=1)

    mesh = hour_plot.colored_mesh2d
    assert isinstance(mesh, Mesh2D)
    assert len(mesh.faces) == 8760 * 4
    assert mesh.min == Point2D(0, 0)
    assert mesh.max == Point2D(365, 4 * 24)