Example #1
0
def test_data_mesh():
    """Test the data_mesh meshod."""
    path = './tests/fixtures/epw/tokyo.epw'
    epw = EPW(path)
    psych_chart = PsychrometricChart(epw.dry_bulb_temperature,
                                     epw.relative_humidity)

    test_pt = psych_chart.plot_point(20, 50)
    assert isinstance(test_pt, Point2D)

    mesh = psych_chart.colored_mesh
    assert isinstance(mesh, Mesh2D)
    assert len(mesh.faces) > 1

    data_mesh, container = psych_chart.data_mesh(epw.wind_speed)
    assert isinstance(data_mesh, Mesh2D)
    assert len(mesh.faces) == len(data_mesh.faces) > 1
    assert isinstance(container, GraphicContainer)
Example #2
0
                new_pt = Point2D(base_pt.x + move_dist * (i + 1), base_pt.y)
                psy_chart = PsychrometricChart(all_data[-2],
                                               all_data[-1],
                                               pressure,
                                               leg_par_by_index(0),
                                               new_pt,
                                               x_dim,
                                               y_dim,
                                               t_min,
                                               t_max,
                                               use_ip=use_ip)
                psy_chart.z = z
                psy_chart.original_temperature = original_temperature
                draw_psych_chart(psy_chart)
                psych_chart.append(psy_chart)
                lb_mesh, container = psy_chart.data_mesh(
                    d, leg_par_by_index(i + 1))
                mesh.append(from_mesh2d(lb_mesh, z))
                legend.append(legend_objects(container.legend))
                move_vec = Vector2D(base_pt.x + move_dist * (i + 1), 0)
                points.append(
                    [from_point2d(pt.move(move_vec)) for pt in lb_points])

                # add a title for the new chart
                title_items = ['{} [{}]'.format(d.header.data_type, d.header.unit)] + \
                    ['{}: {}'.format(key, val) for key, val in d.header.metadata.items()]
                title[j + j * len(data_) + (i + 1)].append(
                    text_objects('\n'.join(title_items),
                                 psy_chart.container.upper_title_location,
                                 psy_chart.legend_parameters.text_height * 1.5,
                                 psy_chart.legend_parameters.font, 0, 0))