コード例 #1
0
ファイル: sky_mtx_test.py プロジェクト: zha/honeybee-radiance
def test_to_and_from_dict():
    wea = './tests/assets/wea/denver.wea'
    wea = Wea.from_file(wea)
    sky_mtx = SkyMatrix(wea)
    sky_mtx_from_dict = sky_mtx.from_dict(sky_mtx.to_dict())

    # update this once Wea class has equality method implemeneted
    assert sky_mtx.wea.location == sky_mtx_from_dict.wea.location
    assert sky_mtx.wea.direct_normal_irradiance.values == \
        sky_mtx_from_dict.wea.direct_normal_irradiance.values
    assert sky_mtx.wea.direct_normal_irradiance.datetimes == \
        sky_mtx_from_dict.wea.direct_normal_irradiance.datetimes
コード例 #2
0
ファイル: sky_mtx_test.py プロジェクト: zha/honeybee-radiance
def test_check_defaults():
    wea = './tests/assets/wea/denver.wea'
    wea = Wea.from_file(wea)
    sky_mtx = SkyMatrix(wea)
    assert sky_mtx.wea == wea
    assert sky_mtx.north == 0
    assert sky_mtx.density == 1
    assert sky_mtx.location == wea.location
    sky_mtx_radiance = sky_mtx.to_radiance()
    # gendaymtx -O0 in.wea > sky.mtx
    assert '> sky.mtx' in sky_mtx_radiance
    assert '-O0 in.wea' in sky_mtx_radiance
    assert sky_mtx.is_climate_based is True
    assert sky_mtx.is_point_in_time is False
コード例 #3
0
ファイル: sky_mtx_test.py プロジェクト: zha/honeybee-radiance
def tets_to_radiance_options():
    wea = './tests/assets/wea/denver.wea'
    wea = Wea.from_file(wea)
    sky_mtx = SkyMatrix(wea, density=4)
    assert '-m 4' in sky_mtx.to_radiance()
    assert '-O1' in sky_mtx.to_radiance(output_type=1)
    assert '-A' in sky_mtx.to_radiance(cumulative=True)
    assert '-d' in sky_mtx.to_radiance(components=1)
    assert '-s' in sky_mtx.to_radiance(components=2)
コード例 #4
0
ファイル: sky_mtx_test.py プロジェクト: zha/honeybee-radiance
def test_north():
    wea = './tests/assets/wea/denver.wea'
    wea = Wea.from_file(wea)
    sky_mtx = SkyMatrix(wea, 120)
    assert sky_mtx.north == 120
    assert '-r 120' in sky_mtx.to_radiance()
コード例 #5
0
try:
    from honeybee_radiance.lightsource.sky import SkyMatrix
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
    from ladybug_rhino.togeometry import to_vector2d
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

import math


if all_required_inputs(ghenv.Component):
    # process the north input
    north_ = north_ or 0
    try:  # it's a vector
        north_ = math.degrees(to_vector2d(north_).angle_clockwise(Vector2D(0, 1)))
    except AttributeError:  # north angle instead of vector
        north_ = float(north_)

    # set default values and process the hoys if they are input
    _density_ = _density_ or 1
    if len(hoys_) != 0:
        _wea = _wea.filter_by_hoys(hoys_)

    # create the sky object
    skymtx = SkyMatrix(_wea, north_, _density_)