Exemplo n.º 1
0
            windrose.frequency_spacing_distance = _freq_dist_

        windrose.north = north_
        windrose.show_freq = _show_freq_

        calm_text = ''
        if isinstance(speed_data.header.data_type, Speed):
            windrose.show_zeros = _show_calmrose_
            calm_text = '\nCalm for {}% of the time = {} hours.'.format(
                round(
                    windrose._zero_count / len(windrose.analysis_values) *
                    100.0, 2), windrose._zero_count)
        windrose.base_point = Point2D(center_pt_2d.x, center_pt_2d.y)

        # Make the mesh
        mesh = from_mesh2d(windrose.colored_mesh, _center_pt_.z)

        # Make the graphic outputs
        legend = legend_objects(windrose.legend)
        freq_per = windrose._frequency_hours / \
            len([b for a in windrose.histogram_data for b in a])
        freq_text = '\nEach closed polyline shows frequency of {}% = {} hours.'.format(
            round(freq_per * 100, 1), windrose._frequency_hours)
        title = text_objects(
            title_text(speed_data) + calm_text + freq_text,
            windrose.container.lower_title_location,
            windrose.legend_parameters.text_height,
            windrose.legend_parameters.font)
        compass = compass_objects(windrose.compass, _center_pt_.z, None)
        orient_line = [
            from_linesegment2d(seg, _center_pt_.z)
Exemplo n.º 2
0
                           ] + ['{}: {}'.format(k, v) for k, v in meta_i]
        else:
            title_items = ['Psychrometric Chart']
        title[j + j * len(data_)].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))
        psych_chart.append(psy_chart)

        # plot the data on the chart
        lb_points = psy_chart.data_points
        points.append([from_point2d(pt) for pt in lb_points])
        if len(lb_points) != 1:  # hide the points and just display the mesh
            hide_output(ghenv.Component, 8)
            mesh.append(from_mesh2d(psy_chart.colored_mesh, z))
            legend.append(legend_objects(psy_chart.legend))
        else:  # show the single point on the chart
            show_output(ghenv.Component, 8)

        # process any of the connected data into a legend and colors
        if len(data_) != 0:
            data_colls.append(all_data[:-2])
            move_dist = x_dim * (psy_chart.max_temperature -
                                 psy_chart.min_temperature + 20)
            for i, d in enumerate(all_data[:-2]):
                # create a new psychrometric chart offset from the original
                new_pt = Point2D(base_pt.x + move_dist * (i + 1), base_pt.y)
                psy_chart = PsychrometricChart(all_data[-2],
                                               all_data[-1],
                                               pressure,
    percentile_ = percentile_ if percentile_ is not None else 34.0
    lpar = legend_par_[0] if len(legend_par_) != 0 else None

    # create the monthly chart object and get the main pieces of geometry
    month_chart = MonthlyChart(_data, lpar, _base_pt_, _x_dim_, _y_dim_,
                               stack_, percentile_)
    if len(legend_par_) > 1:
        if legend_par_[1].min is not None:
            month_chart.set_minimum_by_index(legend_par_[1].min, 1)
        if legend_par_[1].max is not None:
            month_chart.set_maximum_by_index(legend_par_[1].max, 1)

    #  get the main pieces of geometry
    d_meshes = month_chart.data_meshes
    if d_meshes is not None:
        data_mesh = [from_mesh2d(msh, z_val_tol) for msh in d_meshes]
    d_lines = month_chart.data_polylines
    if d_lines is not None:
        data_lines = [from_polyline2d(lin, z_val_tol) for lin in d_lines]
    borders = [from_polyline2d(month_chart.chart_border, z_val)] + \
            [from_linesegment2d(line, z_val) for line in month_chart.y_axis_lines] + \
            [from_linesegment2d(line, z_val_tol) for line in month_chart.month_lines]
    legend = legend_objects(month_chart.legend)

    # process all of the text-related outputs
    title_txt = month_chart.title_text if global_title_ is None else global_title_
    txt_hgt = month_chart.legend_parameters.text_height
    font = month_chart.legend_parameters.font
    title = text_objects(title_txt, month_chart.lower_title_location, txt_hgt,
                         font)
Exemplo n.º 4
0
    mesh = []
    title = []
    all_legends = []
    all_borders = []
    all_labels = []

    for i, data_coll in enumerate(_data):
        try:  # sense when several legend parameters are connected
            lpar = legend_par_[i]
        except IndexError:
            lpar = None if len(legend_par_) == 0 else legend_par_[-1]

        # create the hourly plot object and get the main pieces of geometry
        hour_plot = HourlyPlot(data_coll, lpar, _base_pt_, _x_dim_, _y_dim_,
                               _z_dim_, reverse_y_)
        msh = from_mesh2d(hour_plot.colored_mesh2d, _base_pt_.z) if _z_dim_ == 0 else \
            from_mesh3d(hour_plot.colored_mesh3d)
        mesh.append(msh)
        border = [from_polyline2d(hour_plot.chart_border2d, _base_pt_.z)] + \
            [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.hour_lines2d] + \
            [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.month_lines2d]
        all_borders.append(border)
        legnd = legend_objects(hour_plot.legend)
        all_legends.append(legnd)
        tit_txt = text_objects(hour_plot.title_text,
                               hour_plot.lower_title_location,
                               hour_plot.legend_parameters.text_height,
                               hour_plot.legend_parameters.font)
        title.append(tit_txt)

        # create the text label objects