diff --git a/ladybug_grasshopper/icon/LB Adaptive Comfort Parameters.png b/ladybug_grasshopper/icon/LB Adaptive Comfort Parameters.png index 3d42285..1ca2560 100644 Binary files a/ladybug_grasshopper/icon/LB Adaptive Comfort Parameters.png and b/ladybug_grasshopper/icon/LB Adaptive Comfort Parameters.png differ diff --git a/ladybug_grasshopper/json/LB_Adaptive_Comfort_Parameters.json b/ladybug_grasshopper/json/LB_Adaptive_Comfort_Parameters.json index 6afd729..be7cdb2 100644 --- a/ladybug_grasshopper/json/LB_Adaptive_Comfort_Parameters.json +++ b/ladybug_grasshopper/json/LB_Adaptive_Comfort_Parameters.json @@ -1,5 +1,5 @@ { - "version": "1.8.0", + "version": "1.8.1", "nickname": "AdaptPar", "outputs": [ [ @@ -16,14 +16,14 @@ { "access": "item", "name": "_ashrae_or_en_", - "description": "A boolean to note whether to use the ASHRAE-55 neutral\ntemperature function (True) or the european neutral function (False),\nwhich is consistent with both EN-15251 and EN-16798. Note that this\ninput will also determine default values for many of the other\nproperties of this object.", + "description": "A boolean to note whether to use the ASHRAE-55 neutral\ntemperature function (True) or the european neutral function (False),\nwhich is consistent with EN-16798 (and the older EN-15251).\nPreference is given to EN-16798 in places where EN-16798 and\nEN-15251 differ (eg. the 1C lower cold threshold in EN-16798).\nNote that this input will also determine default values for\nmany of the other properties of this object.", "type": "bool", "default": null }, { "access": "item", "name": "_neutral_offset_", - "description": "The number of degrees Celcius from the neutral temperature\nwhere the input operative temperature is considered acceptable.\nThe default is 2.5C when the neutral temperature function is ASHRAE-55\n(consistent with 90% PPD) and 3C when the neutral temperature\nfunction is EN (consistent with comfort class II).\n_\nFor ASHRAE-55, the following neutral offsets apply.\n* 90 PPD - 2.5C\n* 80 PPD - 3.5C\n_\nFor the EN standard, the following neutral offsets apply.\n* Class I - 2C\n* Class II - 3C\n* Class III - 4C", + "description": "The number of degrees Celcius from the neutral temperature\nwhere the input operative temperature is considered acceptable.\nThe default is 2.5C when the neutral temperature function is ASHRAE-55\n(consistent with 90% PPD) and 3C when the neutral temperature\nfunction is EN-16798 (consistent with comfort class II). Note that,\nwhen the neutral temperature function is EN-16798, one degree\nCelsius is automatically added to the offset value input here to\nget the lower temperature threshold. This accounts for the fact that\nEN-16798 does not interpret the neutral offset symmetically.\n_\nFor ASHRAE-55, the following neutral offsets apply.\n* 90 PPD - 2.5C\n* 80 PPD - 3.5C\n_\nFor the EN standard, the following neutral offsets apply.\n* Class I - 2C\n* Class II - 3C\n* Class III - 4C", "type": "double", "default": null }, diff --git a/ladybug_grasshopper/json/LB_Monthly_Chart.json b/ladybug_grasshopper/json/LB_Monthly_Chart.json index 378a393..c29577f 100644 --- a/ladybug_grasshopper/json/LB_Monthly_Chart.json +++ b/ladybug_grasshopper/json/LB_Monthly_Chart.json @@ -1,5 +1,5 @@ { - "version": "1.8.0", + "version": "1.8.2", "nickname": "MonthlyChart", "outputs": [ [ @@ -141,7 +141,7 @@ } ], "subcategory": "2 :: Visualize Data", - "code": "\ntry:\n from ladybug_geometry.geometry2d.pointvector import Point2D\n from ladybug_geometry.geometry3d.pointvector import Vector3D, 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.monthlychart import MonthlyChart\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import conversion_to_meters, tolerance\n from ladybug_{{cad}}.color import color_to_color\n from ladybug_{{cad}}.togeometry import to_point2d\n from ladybug_{{cad}}.fromgeometry import from_mesh2d, from_mesh2d_to_outline, \\\n from_polyline2d, from_linesegment2d\n from ladybug_{{cad}}.text import text_objects\n from ladybug_{{cad}}.colorize import ColoredPolyline\n from ladybug_{{cad}}.fromobjects import legend_objects\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, objectify_output, \\\n schedule_solution\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and None not in _data:\n # set default values for the chart dimensions\n z_val = _base_pt_.Z if _base_pt_ is not None else 0\n z_val_tol = z_val + tolerance\n _base_pt_ = to_point2d(_base_pt_) if _base_pt_ is not None else Point2D()\n _x_dim_ = _x_dim_ if _x_dim_ is not None else 10.0 / conversion_to_meters()\n _y_dim_ = _y_dim_ if _y_dim_ is not None else 40.0 / conversion_to_meters()\n stack_ = stack_ if stack_ is not None else False\n percentile_ = percentile_ if percentile_ is not None else 34.0\n lpar = legend_par_[0] if len(legend_par_) != 0 else None\n\n # create the monthly chart object and get the main pieces of geometry\n month_chart = MonthlyChart(_data, lpar, _base_pt_, _x_dim_, _y_dim_,\n stack_, percentile_)\n if len(legend_par_) > 1:\n if legend_par_[1].min is not None:\n month_chart.set_minimum_by_index(legend_par_[1].min, 1)\n if legend_par_[1].max is not None:\n month_chart.set_maximum_by_index(legend_par_[1].max, 1)\n\n # get the main pieces of geometry\n data_lines = []\n d_meshes = month_chart.data_meshes\n if d_meshes is not None:\n data_mesh = [from_mesh2d(msh, z_val_tol) for msh in d_meshes]\n if month_chart.time_interval == 'Monthly':\n data_lines += [l for msh in d_meshes for l in\n from_mesh2d_to_outline(msh, z_val_tol)]\n d_lines = month_chart.data_polylines\n if d_lines is not None:\n data_lines += [from_polyline2d(lin, z_val_tol) for lin in d_lines]\n borders = [from_polyline2d(month_chart.chart_border, z_val)] + \\\n [from_linesegment2d(line, z_val) for line in month_chart.y_axis_lines] + \\\n [from_linesegment2d(line, z_val_tol) for line in month_chart.month_lines]\n leg = month_chart.legend\n if z_val != 0 and leg.legend_parameters.is_base_plane_default:\n nl_par = leg.legend_parameters.duplicate()\n m_vec = Vector3D(0, 0, z_val)\n nl_par.base_plane = nl_par.base_plane.move(m_vec)\n leg._legend_par = nl_par\n legend = legend_objects(leg)\n\n # process all of the text-related outputs\n title_txt = month_chart.title_text if global_title_ is None else global_title_\n txt_hgt = month_chart.legend_parameters.text_height\n font = month_chart.legend_parameters.font\n ttl_tp = month_chart.lower_title_location\n if z_val != 0:\n ttl_tp = Plane(n=ttl_tp.n, o=Point3D(ttl_tp.o.x, ttl_tp.o.y, z_val), x=ttl_tp.x)\n title = text_objects(title_txt, ttl_tp, txt_hgt, font)\n\n # process the first y axis\n y1_txt = month_chart.y_axis_title_text1 if len(y_axis_title_) == 0 else y_axis_title_[0]\n y1_tp = month_chart.y_axis_title_location1\n if z_val != 0:\n y1_tp = Plane(n=y1_tp.n, o=Point3D(y1_tp.o.x, y1_tp.o.y, z_val), x=y1_tp.x)\n y_title = text_objects(y1_txt, y1_tp, txt_hgt, font)\n if time_marks_:\n txt_h = _x_dim_ / 20 if _x_dim_ / 20 < txt_hgt * 0.75 else txt_hgt * 0.75\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_h, font, 1, 0)\n for txt, pt in zip(month_chart.time_labels, month_chart.time_label_points)]\n borders.extend([from_linesegment2d(line, z_val_tol) for line in month_chart.time_ticks])\n else:\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 1, 0)\n for txt, pt in zip(month_chart.month_labels, month_chart.month_label_points)]\n label2 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 2, 3)\n for txt, pt in zip(month_chart.y_axis_labels1, month_chart.y_axis_label_points1)]\n labels = label1 + label2\n\n # process the second y axis if it exists\n if month_chart.y_axis_title_text2 is not None:\n y2_txt = month_chart.y_axis_title_text2 if len(y_axis_title_) <= 1 else y_axis_title_[1]\n y2_tp = month_chart.y_axis_title_location2\n if z_val != 0:\n y2_tp = Plane(n=y2_tp.n, o=Point3D(y2_tp.o.x, y2_tp.o.y, z_val), x=y2_tp.x)\n y_title2 = text_objects(y2_txt, y2_tp, txt_hgt, font)\n y_title = [y_title, y_title2]\n label3 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 0, 3)\n for txt, pt in zip(month_chart.y_axis_labels2, month_chart.y_axis_label_points2)]\n labels = labels + label3\n\n # if there are colored lines, then process them to be output from the component\n if month_chart.time_interval == 'MonthlyPerHour':\n cols = [color_to_color(col) for col in month_chart.colors]\n col_lines, month_count = [], len(data_lines) / len(_data)\n for i, pline in enumerate(data_lines):\n col_line = ColoredPolyline(pline)\n col_line.color = cols[int(i / month_count)]\n col_line.thickness = 3\n col_lines.append(col_line)\n # CWM: I don't know why we have to re-schedule the solution but this is the\n # only way I found to get the colored polylines to appear (redraw did not work).\n schedule_solution(ghenv.Component, 2)\n\n # output arguments for the visualization set\n vis_set = [month_chart, z_val, time_marks_, global_title_, y_axis_title_]\n vis_set = objectify_output('VisualizationSet Aruments [MonthlyChart]', vis_set)\n", + "code": "\ntry:\n from ladybug_geometry.geometry2d.pointvector import Point2D\n from ladybug_geometry.geometry3d.pointvector import Vector3D, 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.monthlychart import MonthlyChart\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import conversion_to_meters, tolerance\n from ladybug_{{cad}}.color import color_to_color\n from ladybug_{{cad}}.togeometry import to_point2d\n from ladybug_{{cad}}.fromgeometry import from_mesh2d, from_mesh2d_to_outline, \\\n from_polyline2d, from_linesegment2d\n from ladybug_{{cad}}.text import text_objects\n from ladybug_{{cad}}.colorize import ColoredPolyline\n from ladybug_{{cad}}.fromobjects import legend_objects\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, objectify_output, \\\n schedule_solution\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and None not in _data:\n # set default values for the chart dimensions\n z_val = _base_pt_.Z if _base_pt_ is not None else 0\n z_val_tol = z_val + tolerance\n _base_pt_ = to_point2d(_base_pt_) if _base_pt_ is not None else Point2D()\n _x_dim_ = _x_dim_ if _x_dim_ is not None else 10.0 / conversion_to_meters()\n _y_dim_ = _y_dim_ if _y_dim_ is not None else 40.0 / conversion_to_meters()\n stack_ = stack_ if stack_ is not None else False\n percentile_ = percentile_ if percentile_ is not None else 34.0\n lpar = legend_par_[0] if len(legend_par_) != 0 else None\n\n # create the monthly chart object and get the main pieces of geometry\n month_chart = MonthlyChart(_data, lpar, _base_pt_, _x_dim_, _y_dim_,\n stack_, percentile_)\n if len(legend_par_) > 1:\n if legend_par_[1].min is not None:\n month_chart.set_minimum_by_index(legend_par_[1].min, 1)\n if legend_par_[1].max is not None:\n month_chart.set_maximum_by_index(legend_par_[1].max, 1)\n\n # get the main pieces of geometry\n data_lines = []\n d_meshes = month_chart.data_meshes\n if d_meshes is not None:\n data_mesh = [from_mesh2d(msh, z_val_tol) for msh in d_meshes]\n if month_chart.time_interval == 'Monthly':\n data_lines += [l for msh in d_meshes for l in\n from_mesh2d_to_outline(msh, z_val_tol)]\n line_results = month_chart.data_polylines_with_colors\n if line_results is not None:\n d_lines, d_cols = line_results\n data_lines += [from_polyline2d(lin, z_val_tol) for lin in d_lines]\n borders = [from_polyline2d(month_chart.chart_border, z_val)] + \\\n [from_linesegment2d(line, z_val) for line in month_chart.y_axis_lines] + \\\n [from_linesegment2d(line, z_val_tol) for line in month_chart.month_lines]\n leg = month_chart.legend\n if z_val != 0 and leg.legend_parameters.is_base_plane_default:\n nl_par = leg.legend_parameters.duplicate()\n m_vec = Vector3D(0, 0, z_val)\n nl_par.base_plane = nl_par.base_plane.move(m_vec)\n leg._legend_par = nl_par\n legend = legend_objects(leg)\n\n # process all of the text-related outputs\n title_txt = month_chart.title_text if global_title_ is None else global_title_\n txt_hgt = month_chart.legend_parameters.text_height\n font = month_chart.legend_parameters.font\n ttl_tp = month_chart.lower_title_location\n if z_val != 0:\n ttl_tp = Plane(n=ttl_tp.n, o=Point3D(ttl_tp.o.x, ttl_tp.o.y, z_val), x=ttl_tp.x)\n title = text_objects(title_txt, ttl_tp, txt_hgt, font)\n\n # process the first y axis\n y1_txt = month_chart.y_axis_title_text1 if len(y_axis_title_) == 0 else y_axis_title_[0]\n y1_tp = month_chart.y_axis_title_location1\n if z_val != 0:\n y1_tp = Plane(n=y1_tp.n, o=Point3D(y1_tp.o.x, y1_tp.o.y, z_val), x=y1_tp.x)\n y_title = text_objects(y1_txt, y1_tp, txt_hgt, font)\n if time_marks_:\n txt_h = _x_dim_ / 20 if _x_dim_ / 20 < txt_hgt * 0.75 else txt_hgt * 0.75\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_h, font, 1, 0)\n for txt, pt in zip(month_chart.time_labels, month_chart.time_label_points)]\n borders.extend([from_linesegment2d(line, z_val_tol) for line in month_chart.time_ticks])\n else:\n label1 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 1, 0)\n for txt, pt in zip(month_chart.month_labels, month_chart.month_label_points)]\n label2 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 2, 3)\n for txt, pt in zip(month_chart.y_axis_labels1, month_chart.y_axis_label_points1)]\n labels = label1 + label2\n\n # process the second y axis if it exists\n if month_chart.y_axis_title_text2 is not None:\n y2_txt = month_chart.y_axis_title_text2 if len(y_axis_title_) <= 1 else y_axis_title_[1]\n y2_tp = month_chart.y_axis_title_location2\n if z_val != 0:\n y2_tp = Plane(n=y2_tp.n, o=Point3D(y2_tp.o.x, y2_tp.o.y, z_val), x=y2_tp.x)\n y_title2 = text_objects(y2_txt, y2_tp, txt_hgt, font)\n y_title = [y_title, y_title2]\n label3 = [text_objects(txt, Plane(o=Point3D(pt.x, pt.y, z_val)), txt_hgt, font, 0, 3)\n for txt, pt in zip(month_chart.y_axis_labels2, month_chart.y_axis_label_points2)]\n labels = labels + label3\n\n # if there are colored lines, then process them to be output from the component\n if month_chart.time_interval == 'MonthlyPerHour':\n cols = [color_to_color(col) for col in d_cols]\n col_lines = []\n for pline, line_col in zip(data_lines, cols):\n col_line = ColoredPolyline(pline)\n col_line.color = line_col\n col_line.thickness = 3\n col_lines.append(col_line)\n # CWM: I don't know why we have to re-schedule the solution but this is the\n # only way I found to get the colored polylines to appear (redraw did not work).\n schedule_solution(ghenv.Component, 2)\n\n # output arguments for the visualization set\n vis_set = [month_chart, z_val, time_marks_, global_title_, y_axis_title_]\n vis_set = objectify_output('VisualizationSet Aruments [MonthlyChart]', vis_set)\n", "category": "Ladybug", "name": "LB Monthly Chart", "description": "Create a chart in the Rhino scene with data organized by month.\n_\nData will display as a bar chart if the input data is monthly or daily. If the\ndata is hourly or sub-hourly, it will be plotted with lines and/or a colored\nmesh that shows the range of the data within specific percentiles.\n-" diff --git a/ladybug_grasshopper/src/LB Adaptive Comfort Parameters.py b/ladybug_grasshopper/src/LB Adaptive Comfort Parameters.py index e34c9e0..a125d82 100644 --- a/ladybug_grasshopper/src/LB Adaptive Comfort Parameters.py +++ b/ladybug_grasshopper/src/LB Adaptive Comfort Parameters.py @@ -19,14 +19,20 @@ Args: _ashrae_or_en_: A boolean to note whether to use the ASHRAE-55 neutral temperature function (True) or the european neutral function (False), - which is consistent with both EN-15251 and EN-16798. Note that this - input will also determine default values for many of the other - properties of this object. + which is consistent with EN-16798 (and the older EN-15251). + Preference is given to EN-16798 in places where EN-16798 and + EN-15251 differ (eg. the 1C lower cold threshold in EN-16798). + Note that this input will also determine default values for + many of the other properties of this object. _neutral_offset_: The number of degrees Celcius from the neutral temperature where the input operative temperature is considered acceptable. The default is 2.5C when the neutral temperature function is ASHRAE-55 (consistent with 90% PPD) and 3C when the neutral temperature - function is EN (consistent with comfort class II). + function is EN-16798 (consistent with comfort class II). Note that, + when the neutral temperature function is EN-16798, one degree + Celsius is automatically added to the offset value input here to + get the lower temperature threshold. This accounts for the fact that + EN-16798 does not interpret the neutral offset symmetically. _ For ASHRAE-55, the following neutral offsets apply. * 90 PPD - 2.5C @@ -71,7 +77,7 @@ ghenv.Component.Name = 'LB Adaptive Comfort Parameters' ghenv.Component.NickName = 'AdaptPar' -ghenv.Component.Message = '1.8.0' +ghenv.Component.Message = '1.8.1' ghenv.Component.Category = 'Ladybug' ghenv.Component.SubCategory = '4 :: Extra' ghenv.Component.AdditionalHelpFromDocStrings = '4' diff --git a/ladybug_grasshopper/src/LB Monthly Chart.py b/ladybug_grasshopper/src/LB Monthly Chart.py index 7fe590e..e80f6bb 100644 --- a/ladybug_grasshopper/src/LB Monthly Chart.py +++ b/ladybug_grasshopper/src/LB Monthly Chart.py @@ -77,7 +77,7 @@ ghenv.Component.Name = 'LB Monthly Chart' ghenv.Component.NickName = 'MonthlyChart' -ghenv.Component.Message = '1.8.0' +ghenv.Component.Message = '1.8.2' ghenv.Component.Category = 'Ladybug' ghenv.Component.SubCategory = '2 :: Visualize Data' ghenv.Component.AdditionalHelpFromDocStrings = '1' @@ -137,8 +137,9 @@ if month_chart.time_interval == 'Monthly': data_lines += [l for msh in d_meshes for l in from_mesh2d_to_outline(msh, z_val_tol)] - d_lines = month_chart.data_polylines - if d_lines is not None: + line_results = month_chart.data_polylines_with_colors + if line_results is not None: + d_lines, d_cols = line_results 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] + \ @@ -192,11 +193,11 @@ # if there are colored lines, then process them to be output from the component if month_chart.time_interval == 'MonthlyPerHour': - cols = [color_to_color(col) for col in month_chart.colors] - col_lines, month_count = [], len(data_lines) / len(_data) - for i, pline in enumerate(data_lines): + cols = [color_to_color(col) for col in d_cols] + col_lines = [] + for pline, line_col in zip(data_lines, cols): col_line = ColoredPolyline(pline) - col_line.color = cols[int(i / month_count)] + col_line.color = line_col col_line.thickness = 3 col_lines.append(col_line) # CWM: I don't know why we have to re-schedule the solution but this is the diff --git a/ladybug_grasshopper/user_objects/LB Adaptive Comfort Parameters.ghuser b/ladybug_grasshopper/user_objects/LB Adaptive Comfort Parameters.ghuser index 3473a40..c474325 100644 Binary files a/ladybug_grasshopper/user_objects/LB Adaptive Comfort Parameters.ghuser and b/ladybug_grasshopper/user_objects/LB Adaptive Comfort Parameters.ghuser differ diff --git a/ladybug_grasshopper/user_objects/LB Monthly Chart.ghuser b/ladybug_grasshopper/user_objects/LB Monthly Chart.ghuser index 6f9c249..6bb5e56 100644 Binary files a/ladybug_grasshopper/user_objects/LB Monthly Chart.ghuser and b/ladybug_grasshopper/user_objects/LB Monthly Chart.ghuser differ