Esempio n. 1
0
def test_design_day_hourly_data():
    """Test hourly data properties of a standard ddy."""
    location = Location('Test City', '-', 'USA', 34.20, -118.35, -8, 226)
    date = Date(8, 21)
    des_day = DesignDay.from_design_day_properties('Test Day',
                                                   'SummerDesignDay', location,
                                                   date, 36.8, 13.2, 'Wetbulb',
                                                   20.5, 98639, 3.9, 170,
                                                   'ASHRAETau', [0.436, 2.106])
    # dry bulb values
    db_data_collect = des_day.hourly_dry_bulb
    assert db_data_collect[5] == approx(23.6, rel=1e-1)
    assert db_data_collect[14] == approx(36.8, rel=1e-1)

    # dew point values
    dpt_data_collect = des_day.hourly_dew_point
    assert dpt_data_collect[0] == approx(11.296, rel=1e-1)
    assert dpt_data_collect[-1] == approx(11.296, rel=1e-1)

    # relative humidity values
    rh_data_collect = des_day.hourly_relative_humidity
    assert rh_data_collect[5] == approx(45.896, rel=1e-1)
    assert rh_data_collect[14] == approx(21.508, rel=1e-1)

    # barometric pressure values
    bp_data_collect = des_day.hourly_barometric_pressure
    assert bp_data_collect[0] == approx(98639, rel=1e-1)
    assert bp_data_collect[-1] == approx(98639, rel=1e-1)

    # wind speed values
    ws_data_collect = des_day.hourly_wind_speed
    assert -0.1 < ws_data_collect[0] - 3.9 < 0.1
    assert -0.1 < ws_data_collect[-1] - 3.9 < 0.1

    # wind direction values
    wd_data_collect = des_day.hourly_wind_direction
    assert wd_data_collect[0] == approx(170, rel=1e-1)
    assert wd_data_collect[-1] == approx(170, rel=1e-1)

    # radiation values
    direct_normal_rad, diffuse_horizontal_rad, global_horizontal_rad = \
        des_day.hourly_solar_radiation
    assert direct_normal_rad[0] == 0
    assert direct_normal_rad[11] == approx(891.46, rel=1e-1)
    assert diffuse_horizontal_rad[0] == 0
    assert diffuse_horizontal_rad[11] == approx(165.32, rel=1e-1)
    assert global_horizontal_rad[0] == 0
    assert global_horizontal_rad[11] == approx(985.05, rel=1e-1)

    # sky cover values
    sc_data_collect = des_day.hourly_sky_cover

    # sky cover values
    hi_data_collect = des_day.hourly_horizontal_infrared
Esempio n. 2
0
 def test_design_day_from_properties(self):
     """Test hourly data properties of a standard ddy."""
     location = Location('Test City', 'USA', 34.20, -118.35, -8, 226)
     a_period = AnalysisPeriod(12, 21, 0, 12, 21, 23)
     des_day = DesignDay.from_design_day_properties(
         'Test Day', 'WinterDesignDay', location, a_period, 3.9, 0,
         'Wetbulb', 3.9, 98639, 0.8, 330, 'ASHRAEClearSky', [0])
     assert des_day.location == location
     new_period = des_day.analysis_period
     assert new_period.st_month == a_period.st_month
     assert new_period.st_day == a_period.st_day
     assert new_period.st_hour == a_period.st_hour
     assert new_period.end_month == a_period.end_month
     assert new_period.end_day == a_period.end_day
     assert new_period.end_hour == a_period.end_hour
Esempio n. 3
0
ghenv.Component.SubCategory = '4 :: AlternativeWeather'
ghenv.Component.AdditionalHelpFromDocStrings = '3'

try:
    from ladybug.designday import DesignDay
    from ladybug.dt import Date, DateTime
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

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

if all_required_inputs(ghenv.Component):
    # set defaults for relevant items
    if _dry_bulb_range_ is None:
        _dry_bulb_range_ = 0
    if _barometric_p_ is None:
        _barometric_p_ = 101325

    # process the input date
    try:
        date = Date.from_date_string(_date)
    except ValueError:
        date = DateTime.from_date_time_string(_date).date

    design_day = DesignDay.from_design_day_properties(
        _name, _day_type, _location, date, _dry_bulb_max, _dry_bulb_range_,
        _humidity_type, _humidity_value, _barometric_p_, _wind_speed,
        _wind_dir, _sky_type, _sky_properties)