You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"description": "A colored mesh derived from the input _data. Multiple meshes will\nbe output for several data collections are input.",
10
-
"type": null,
11
-
"default": null
12
-
},
13
-
{
14
-
"access": "None",
15
-
"name": "legend",
16
-
"description": "Geometry representing the legend for each mesh.",
17
-
"type": null,
18
-
"default": null
19
-
},
20
-
{
21
-
"access": "None",
22
-
"name": "borders",
23
-
"description": "A list of lines and polylines representing different time\nintervals of the plot.",
24
-
"type": null,
25
-
"default": null
26
-
},
27
-
{
28
-
"access": "None",
29
-
"name": "labels",
30
-
"description": "A list of text objects that label the borders with the time\nintervals that they demarcate.",
31
-
"type": null,
32
-
"default": null
33
-
},
34
-
{
35
-
"access": "None",
36
-
"name": "title",
37
-
"description": "A text object for the global_title.",
38
-
"type": null,
39
-
"default": null
40
-
},
41
-
{
42
-
"access": "None",
43
-
"name": "vis_set",
44
-
"description": "An object containing VisualizationSet arguments for drawing a detailed\nversion of the Hourly Plot in the Rhino scene. This can be connected to\nthe \"LB Preview Visualization Set\" component to display this version\nof the Hourly Plot in Rhino.",
45
-
"type": null,
46
-
"default": null
47
-
}
48
-
]
49
-
],
2
+
"name": "LB Hourly Plot",
3
+
"code": "\ntry:\n from ladybug.datacollection import HourlyContinuousCollection\n from ladybug.hourlyplot import HourlyPlot\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_geometry.geometry3d.pointvector import Point3D\n from ladybug_geometry.geometry3d.plane import Plane\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_geometry:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import conversion_to_meters\n from ladybug_{{cad}}.togeometry import to_point3d\n from ladybug_{{cad}}.fromgeometry import from_mesh3d, from_mesh2d, \\\n from_polyline2d, from_linesegment2d\n from ladybug_{{cad}}.text import text_objects\n from ladybug_{{cad}}.fromobjects import legend_objects\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, list_to_data_tree, \\\n objectify_output\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # apply any analysis periods and conditional statements to the input collections\n if period_ is not None:\n _data = [coll.filter_by_analysis_period(period_) for coll in _data]\n if statement_ is not None:\n _data = HourlyContinuousCollection.filter_collections_by_statement(\n _data, statement_)\n\n # set default values for the chart dimensions\n _base_pt_ = to_point3d(_base_pt_) if _base_pt_ is not None else Point3D()\n reverse_y_ = reverse_y_ if reverse_y_ is not None else False\n _z_dim_ = _z_dim_ if _z_dim_ is not None else 0\n _x_dim_ = _x_dim_ if _x_dim_ is not None else 1.0 / conversion_to_meters()\n if _y_dim_ is None:\n t_step = _data[0].header.analysis_period.timestep\n _y_dim_ = 4.0 / conversion_to_meters() \\\n if t_step == 1 else (4 / t_step) / conversion_to_meters()\n\n # empty lists of objects to be filled with visuals\n mesh, title, all_legends, all_borders, all_labels, vis_set = [], [], [], [], [], []\n\n for i, data_coll in enumerate(_data):\n try: # sense when several legend parameters are connected\n lpar = legend_par_[i]\n except IndexError:\n lpar = None if len(legend_par_) == 0 else legend_par_[-1].duplicate()\n\n # create the hourly plot object and get the main pieces of geometry\n hour_plot = HourlyPlot(data_coll, lpar, _base_pt_,\n _x_dim_, _y_dim_, _z_dim_, reverse_y_)\n \n msh = from_mesh2d(hour_plot.colored_mesh2d, _base_pt_.z) if _z_dim_ == 0 else \\\n from_mesh3d(hour_plot.colored_mesh3d)\n mesh.append(msh)\n border = [from_polyline2d(hour_plot.chart_border2d, _base_pt_.z)] + \\\n [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.hour_lines2d] + \\\n [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.month_lines2d]\n all_borders.append(border)\n legnd = legend_objects(hour_plot.legend)\n all_legends.append(legnd)\n tit_txt = text_objects(hour_plot.title_text, hour_plot.lower_title_location,\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font)\n title.append(tit_txt)\n\n # create the text label objects\n hr_text = hour_plot.hour_labels_24 if clock_24_ else hour_plot.hour_labels\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, _base_pt_.z)),\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font, 2, 3)\n for txt, pt in zip(hr_text, hour_plot.hour_label_points2d)]\n label2 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, _base_pt_.z)),\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font, 1, 0)\n for txt, pt in zip(hour_plot.month_labels, hour_plot.month_label_points2d)]\n all_labels.append(label1 + label2)\n\n # increment the base point so that the next chart doesn't overlap this one\n try:\n next_aper = _data[i + 1].header.analysis_period\n next_tstep = next_aper.timestep\n next_hour = next_aper.end_hour - next_aper.st_hour + 1\n except IndexError:\n next_tstep = 1\n next_hour = 24\n txt_dist = hour_plot.legend_parameters.text_height * (len(_data[i].header.metadata) + 6) * 1.5\n increment = (next_hour * next_tstep * _y_dim_) + txt_dist\n _base_pt_ = Point3D(_base_pt_.x, _base_pt_.y - increment, _base_pt_.z)\n\n # append the VisualizationSet arguments with fixed geometry\n hp_leg_par3d = hour_plot.legend_parameters.properties_3d\n hp_leg_par3d.base_plane = hp_leg_par3d.base_plane\n hp_leg_par3d.segment_height = hp_leg_par3d.segment_height\n hp_leg_par3d.segment_width = hp_leg_par3d.segment_width\n hp_leg_par3d.text_height = hp_leg_par3d.text_height\n vis_set.append((hour_plot, _base_pt_.z))\n\n # convert nexted lists into data trees\n legend = list_to_data_tree(all_legends)\n borders = list_to_data_tree(all_borders)\n labels = list_to_data_tree(all_labels)\n vis_set = objectify_output('VisualizationSet Aruments [HourlyPlot]', vis_set)\n",
4
+
"category": "Ladybug",
50
5
"inputs": [
51
6
{
7
+
"default": null,
52
8
"access": "list",
53
-
"name": "_data",
54
9
"description": "A HourlyContinuousCollection or HourlyDiscontinuousCollection\nwhich will be used to generate the hourly plot.",
55
10
"type": "System.Object",
56
-
"default": null
11
+
"name": "_data"
57
12
},
58
13
{
14
+
"default": null,
59
15
"access": "item",
60
-
"name": "_base_pt_",
61
16
"description": "An optional Point3D to be used as a starting point to generate\nthe geometry of the plot (Default: (0, 0, 0)).",
62
17
"type": "Point3d",
63
-
"default": null
18
+
"name": "_base_pt_"
64
19
},
65
20
{
21
+
"default": null,
66
22
"access": "item",
67
-
"name": "_x_dim_",
68
-
"description": "A number to set the X dimension of the mesh cells (Default: 1 meters).",
23
+
"description": "A number to set the X dimension of the mesh cells. (Default: 1 meters).",
69
24
"type": "double",
70
-
"default": null
25
+
"name": "_x_dim_"
71
26
},
72
27
{
28
+
"default": null,
73
29
"access": "item",
74
-
"name": "_y_dim_",
75
-
"description": "A number to set the Y dimension of the mesh cells (Default: 4 meters).",
30
+
"description": "A number to set the Y dimension of the mesh cells. (Default: 4 meters,\nunless a fine timestep collection is connected, in which case\n4.0 meters / timestep is used).",
76
31
"type": "double",
77
-
"default": null
32
+
"name": "_y_dim_"
78
33
},
79
34
{
35
+
"default": null,
80
36
"access": "item",
81
-
"name": "_z_dim_",
82
37
"description": "A number to set the Z dimension of the entire chart. This will\nbe used to make the colored_mesh3d of the chart vary in the Z\ndimension according to the data. The value input here should usually be\nseveral times larger than the x_dim or y_dim in order to be noticable\n(e.g. 100). If 0, the colored_mesh3d will simply be flat. (Default: 0).",
83
38
"type": "double",
84
-
"default": null
39
+
"name": "_z_dim_"
85
40
},
86
41
{
42
+
"default": null,
87
43
"access": "item",
88
-
"name": "reverse_y_",
89
44
"description": "Boolean to note whether the Y-axis of the chart is reversed\nIf True, time over the course of the day will flow from the top of\nthe chart to the bottom instead of the bottom to the top.",
90
45
"type": "bool",
91
-
"default": null
46
+
"name": "reverse_y_"
92
47
},
93
48
{
49
+
"default": null,
94
50
"access": "item",
95
-
"name": "clock_24_",
96
51
"description": "Boolean to note whether the hour labels on the Y-Axis of the chart\nshould be in 24-hour clock format (eg. 18:00) or they should be\nin 12-hour clock format (eg. 6PM).",
97
52
"type": "bool",
98
-
"default": null
53
+
"name": "clock_24_"
99
54
},
100
55
{
56
+
"default": null,
101
57
"access": "list",
102
-
"name": "legend_par_",
103
58
"description": "An optional LegendParameter object to change the display of the\nHourlyPlot. This can also be a list of legend parameters to be\napplied to the different connected _data.",
104
59
"type": "System.Object",
105
-
"default": null
60
+
"name": "legend_par_"
106
61
},
107
62
{
63
+
"default": null,
108
64
"access": "item",
109
-
"name": "statement_",
110
65
"description": "A conditional statement as a string (e.g. a > 25).\n.\nThe variable of the first data collection should always be named 'a'\n(without quotations), the variable of the second list should be\nnamed 'b', and so on.\n.\nFor example, if three data collections are connected to _data\nand the following statement is applied:\n'18 < a < 26 and b < 80 and c > 2'\nThe resulting collections will only include values where the first\ndata collection is between 18 and 26, the second collection is less\nthan 80 and the third collection is greater than 2.",
111
66
"type": "string",
112
-
"default": null
67
+
"name": "statement_"
113
68
},
114
69
{
70
+
"default": null,
115
71
"access": "item",
116
-
"name": "period_",
117
72
"description": "A Ladybug analysis period to be applied to all of the input _data.",
118
73
"type": "System.Object",
119
-
"default": null
74
+
"name": "period_"
120
75
}
121
76
],
122
77
"subcategory": "2 :: Visualize Data",
123
-
"code": "\ntry:\n from ladybug.datacollection import HourlyContinuousCollection\n from ladybug.hourlyplot import HourlyPlot\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_geometry.geometry3d.pointvector import Point3D\n from ladybug_geometry.geometry3d.plane import Plane\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_geometry:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import conversion_to_meters\n from ladybug_{{cad}}.togeometry import to_point3d\n from ladybug_{{cad}}.fromgeometry import from_mesh3d, from_mesh2d, \\\n from_polyline2d, from_linesegment2d\n from ladybug_{{cad}}.text import text_objects\n from ladybug_{{cad}}.fromobjects import legend_objects\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, list_to_data_tree, \\\n objectify_output\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # apply any analysis periods and conditional statements to the input collections\n if period_ is not None:\n _data = [coll.filter_by_analysis_period(period_) for coll in _data]\n if statement_ is not None:\n _data = HourlyContinuousCollection.filter_collections_by_statement(\n _data, statement_)\n\n # set default values for the chart dimensions\n _base_pt_ = to_point3d(_base_pt_) if _base_pt_ is not None else Point3D()\n _x_dim_ = _x_dim_ if _x_dim_ is not None else 1.0 / conversion_to_meters()\n _y_dim_ = _y_dim_ if _y_dim_ is not None else 4.0 / conversion_to_meters()\n _z_dim_ = _z_dim_ if _z_dim_ is not None else 0\n reverse_y_ = reverse_y_ if reverse_y_ is not None else False\n\n # empty lists of objects to be filled with visuals\n mesh, title, all_legends, all_borders, all_labels, vis_set = [], [], [], [], [], []\n\n for i, data_coll in enumerate(_data):\n try: # sense when several legend parameters are connected\n lpar = legend_par_[i]\n except IndexError:\n lpar = None if len(legend_par_) == 0 else legend_par_[-1].duplicate()\n\n # create the hourly plot object and get the main pieces of geometry\n hour_plot = HourlyPlot(data_coll, lpar, _base_pt_,\n _x_dim_, _y_dim_, _z_dim_, reverse_y_)\n \n msh = from_mesh2d(hour_plot.colored_mesh2d, _base_pt_.z) if _z_dim_ == 0 else \\\n from_mesh3d(hour_plot.colored_mesh3d)\n mesh.append(msh)\n border = [from_polyline2d(hour_plot.chart_border2d, _base_pt_.z)] + \\\n [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.hour_lines2d] + \\\n [from_linesegment2d(line, _base_pt_.z) for line in hour_plot.month_lines2d]\n all_borders.append(border)\n legnd = legend_objects(hour_plot.legend)\n all_legends.append(legnd)\n tit_txt = text_objects(hour_plot.title_text, hour_plot.lower_title_location,\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font)\n title.append(tit_txt)\n\n # create the text label objects\n hr_text = hour_plot.hour_labels_24 if clock_24_ else hour_plot.hour_labels\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, _base_pt_.z)),\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font, 2, 3)\n for txt, pt in zip(hr_text, hour_plot.hour_label_points2d)]\n label2 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, _base_pt_.z)),\n hour_plot.legend_parameters.text_height,\n hour_plot.legend_parameters.font, 1, 0)\n for txt, pt in zip(hour_plot.month_labels, hour_plot.month_label_points2d)]\n all_labels.append(label1 + label2)\n\n # increment the base point so that the next chart doesn't overlap this one\n try:\n next_aper = _data[i + 1].header.analysis_period\n next_tstep = next_aper.timestep\n next_hour = next_aper.end_hour - next_aper.st_hour + 1\n except IndexError:\n next_tstep = 1\n next_hour = 24\n txt_dist = hour_plot.legend_parameters.text_height * (len(_data[i].header.metadata) + 6) * 1.5\n increment = (next_hour * next_tstep * _y_dim_) + txt_dist\n _base_pt_ = Point3D(_base_pt_.x, _base_pt_.y - increment, _base_pt_.z)\n\n # append the VisualizationSet arguments with fixed geometry\n hp_leg_par3d = hour_plot.legend_parameters.properties_3d\n hp_leg_par3d.base_plane = hp_leg_par3d.base_plane\n hp_leg_par3d.segment_height = hp_leg_par3d.segment_height\n hp_leg_par3d.segment_width = hp_leg_par3d.segment_width\n hp_leg_par3d.text_height = hp_leg_par3d.text_height\n vis_set.append((hour_plot, _base_pt_.z))\n\n # convert nexted lists into data trees\n legend = list_to_data_tree(all_legends)\n borders = list_to_data_tree(all_borders)\n labels = list_to_data_tree(all_labels)\n vis_set = objectify_output('VisualizationSet Aruments [HourlyPlot]', vis_set)\n",
124
-
"category": "Ladybug",
125
-
"name": "LB Hourly Plot",
126
-
"description": "Create a colored plot of any hourly data collection.\n-"
78
+
"outputs": [
79
+
[
80
+
{
81
+
"default": null,
82
+
"access": "None",
83
+
"description": "A colored mesh derived from the input _data. Multiple meshes will\nbe output for several data collections are input.",
84
+
"type": null,
85
+
"name": "mesh"
86
+
},
87
+
{
88
+
"default": null,
89
+
"access": "None",
90
+
"description": "Geometry representing the legend for each mesh.",
91
+
"type": null,
92
+
"name": "legend"
93
+
},
94
+
{
95
+
"default": null,
96
+
"access": "None",
97
+
"description": "A list of lines and polylines representing different time\nintervals of the plot.",
98
+
"type": null,
99
+
"name": "borders"
100
+
},
101
+
{
102
+
"default": null,
103
+
"access": "None",
104
+
"description": "A list of text objects that label the borders with the time\nintervals that they demarcate.",
105
+
"type": null,
106
+
"name": "labels"
107
+
},
108
+
{
109
+
"default": null,
110
+
"access": "None",
111
+
"description": "A text object for the global_title.",
112
+
"type": null,
113
+
"name": "title"
114
+
},
115
+
{
116
+
"default": null,
117
+
"access": "None",
118
+
"description": "An object containing VisualizationSet arguments for drawing a detailed\nversion of the Hourly Plot in the Rhino scene. This can be connected to\nthe \"LB Preview Visualization Set\" component to display this version\nof the Hourly Plot in Rhino.",
119
+
"type": null,
120
+
"name": "vis_set"
121
+
}
122
+
]
123
+
],
124
+
"description": "Create a colored plot of any hourly data collection.\n-",
0 commit comments