Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(extra): Improve Vis Set component to accept lists of arguments #375

Merged
merged 1 commit into from Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified ladybug_grasshopper/icon/LB Preview VisualizationSet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ladybug_grasshopper/icon/LB Wind Rose.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ladybug_grasshopper/json/LB_Preview_VisualizationSet.json
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "VisSet",
"outputs": [
[
Expand Down
4 changes: 2 additions & 2 deletions ladybug_grasshopper/json/LB_Wind_Rose.json

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions ladybug_grasshopper/src/LB Preview VisualizationSet.py
Expand Up @@ -60,7 +60,7 @@ def __init__(self):
def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_):
ghenv.Component.Name = 'LB Preview VisualizationSet'
ghenv.Component.NickName = 'VisSet'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '4 :: Extra'
ghenv.Component.AdditionalHelpFromDocStrings = '1'
Expand All @@ -84,8 +84,14 @@ def RunScript(self, _vis_set, legend_par_, leg_par2d_, data_set_):
vis_set = _vis_set[0]
else:
if hasattr(_vis_set[0], 'data'):
vis_set = objectify_output(
'Multiple Vis Set Args', [obj.data for obj in _vis_set])
arr_type = (list, tuple)
if isinstance(_vis_set[0].data, arr_type) and \
isinstance(_vis_set[0].data[0], arr_type):
vis_set = objectify_output(
'Multiple Vis Set Args', [obj.data[0] for obj in _vis_set])
else:
vis_set = objectify_output(
'Multiple Vis Set Args', [obj.data for obj in _vis_set])
else:
vis_set = objectify_output(
'Multiple Vis Sets', [[obj] for obj in _vis_set])
Expand Down
12 changes: 6 additions & 6 deletions ladybug_grasshopper/src/LB Wind Rose.py
Expand Up @@ -105,7 +105,7 @@

ghenv.Component.Name = 'LB Wind Rose'
ghenv.Component.NickName = 'WindRose'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '2 :: Visualize Data'
ghenv.Component.AdditionalHelpFromDocStrings = '5'
Expand Down Expand Up @@ -228,14 +228,13 @@ def title_text(data_col):
_max_freq_lines_ = max(max_freqs)

# plot the windroses
first_windrose = None
all_windroses = []
for i, speed_data in enumerate(_data):
# make the windrose
win_dir = _wind_direction if isinstance(speed_data.header.data_type, Speed) \
else filt_wind_dir
windrose = WindRose(win_dir, speed_data, _dir_count_)
if i == 0:
first_windrose = windrose
all_windroses.append(windrose)

# set the wind rose properties
if len(legend_par_) > 0:
Expand Down Expand Up @@ -313,5 +312,6 @@ def title_text(data_col):
theta = 180.0 / _dir_count_
angles = [(angle + theta) % 360.0 for angle in windrose.angles[:-1]]
prevailing = windrose.prevailing_direction
vis_set = objectify_output(
'VisualizationSet Aruments [Sunpath]', [first_windrose, _center_pt_.z])
vis_set = []
for wr in all_windroses:
vis_set.append(objectify_output('VisualizationSet Aruments [WindRose]', [wr, _center_pt_.z]))
Binary file not shown.
Binary file modified ladybug_grasshopper/user_objects/LB Wind Rose.ghuser
Binary file not shown.