# You should have received a copy of the GNU General Public License
# along with Ladybug; If not, see <http://www.gnu.org/licenses/>.
#
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
"""
Use this component to generate colors based on values and legend parameters.
-
    Args:
        _values: A numerical data set.
        legend_par_: Optional legend parameters from the Ladybug Legend Parameters component.
    Returns:
        colors: The colors associated with each input value.
"""

ghenv.Component.Name = "LadybugPlus_Generate Colors"
ghenv.Component.NickName = 'genColors'
ghenv.Component.Message = 'VER 0.0.04\nOCT_14_2018'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = "03 :: Extra"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    import ladybug.legendparameters as lpar
    import ladybug.dotnet as dotnet
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

if _values:
    legend_par = legend_par_ or lpar.LegendParameters()
    colors = dotnet.color_to_color(legend_par.calculate_colors(_values))
Exemplo n.º 2
0
# assign inputs
_analysisGrid, blindStates_, _occSchedule_, _threshold_, _targetHrs_, _targetArea_ = IN
success = ASE = perArea = prblmPts = prblmHrs = legendPar = None

try:
    import ladybug.geometry as lg
    import ladybug.output as output
    import ladybug.legendparameters as lp
    import ladybug.color as color
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))


col = color.Colorset.original()
legendPar = lp.LegendParameters((0, 250), colors=col)

if _analysisGrid:
    states = _analysisGrid.parse_blind_states(blindStates_)
    success, ASE, perArea, prblmPts, prblmHrs = _analysisGrid.annual_solar_exposure(
         _threshold_, states, _occSchedule_, _targetHrs_, _targetArea_
    )

    prblmPts = (lg.point(s.location.x, s.location.y, s.location.z) for s in prblmPts)
    # convert list of lists to data tree
    try:
        prblmHrs = output.list_to_tree(prblmHrs, ghenv.Component.RunCount - 1)
    except NameError:
        # dynamo
        pass

# assign outputs to OUT
Exemplo n.º 3
0
    Args:
        _domain_: A number representing the higher boundary of the legend's numerical range. The default is set to the highest value of the data stream that the legend refers to.
        _cType_:
        _colors_: A list of colors that will be used to re-color the legend and the corresponding colored mesh(es).  The number of colors input here should match the numSegments_ value input above.  An easy way to generate a list of colors to input here is with the Grasshopper "Gradient" component and a Grasshopper "Series" component connected to the Gradient component's "t" input.  A bunch of Grasshopper "Swatch" components is another way to generate a list of custom colors.  The default colors are a gradient spectrum from blue to yellow to red.
    Returns:
        legendPar: A legend parameters to be plugged into any of the Ladybug components with a legend.
"""

ghenv.Component.Name = "LadybugPlus_Legend Parameters"
ghenv.Component.NickName = 'legendPar'
ghenv.Component.Message = 'VER 0.0.01\nJUL_21_2017'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = "3 :: Extra"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    import ladybug.legendparameters as lpar
    import ladybug.color as col
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

# TODO: Add color convertor to [+]
if _colors_:
    pass
    # colors = tuple(col.ColorConvertor.toLBColor(_colors_))

legendPar = lpar.LegendParameters(legendRange=_domain_,
                                  numberOfSegments=11,
                                  colors=_colors_,
                                  chartType=_cType_)
This component particularly helpful in making the colors of Ladybug graphics consistent
for a presentation or for synchonizing the numerical range and colors between Ladybug graphics.
-


    Args:
        _domain_: A number representing the higher boundary of the legend's numerical range. The default is set to the highest value of the data stream that the legend refers to.
        _c_type_:
        _colors_: A list of colors that will be used to re-color the legend and the corresponding colored mesh(es).  The number of colors input here should match the numSegments_ value input above.  An easy way to generate a list of colors to input here is with the Grasshopper "Gradient" component and a Grasshopper "Series" component connected to the Gradient component's "t" input.  A bunch of Grasshopper "Swatch" components is another way to generate a list of custom colors.  The default colors are a gradient spectrum from blue to yellow to red.
    Returns:
        legend_par: A legend parameters to be plugged into any of the Ladybug components with a legend.
"""

ghenv.Component.Name = "LadybugPlus_Legend Parameters"
ghenv.Component.NickName = 'legendPar'
ghenv.Component.Message = 'VER 0.0.04\nOCT_14_2018'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = "03 :: Extra"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    import ladybug.legendparameters as lpar
    import ladybug.color as col
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

legend_par = lpar.LegendParameters(
    legend_range=_domain_, number_of_segments=11,
    colors=_colors_, chart_type=_c_type_
)
            recieves equal or more than the threshold.
        CDA: Continuous daylight autonomy.
        UDI: Useful daylight illuminance. The percentage of time that illuminace
            falls between minimum and maximum thresholds.
        UDI_less: The percentage of time that illuminace falls less than minimum
            threshold.
        UDI_more: The percentage of time that illuminace falls more than maximum
            threshold.
        legend_par: Suggested legend parameters for annual metrics.
"""

ghenv.Component.Name = "HoneybeePlus_Annual Daylight Metrics"
ghenv.Component.NickName = 'annualMetrics'
ghenv.Component.Message = 'VER 0.0.05\nOCT_22_2018'
ghenv.Component.Category = "HoneybeePlus"
ghenv.Component.SubCategory = '04 :: Daylight :: Daylight'
ghenv.Component.AdditionalHelpFromDocStrings = "3"

try:
    import ladybug.legendparameters as lp
    import ladybug.color as color
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

col = color.Colorset.nuanced()
legend_par = lp.LegendParameters((0, 100), colors=col)

if _analysis_grid:
    states = _analysis_grid.parse_blind_states(blind_states_)
    DA, CDA, UDI, UDI_less, UDI_more = _analysis_grid.annual_metrics(
        _threshold_, _min_max_, states, _occ_schedule_)