示例#1
0
    def test_monthly_cooling_design_days(self):
        relative_path = './tests/stat/chicago.stat'
        stat = STAT(relative_path)

        m_ddy_050 = stat.monthly_cooling_design_days_050
        m_ddy_100 = stat.monthly_cooling_design_days_100
        m_ddy_020 = stat.monthly_cooling_design_days_020
        m_ddy_004 = stat.monthly_cooling_design_days_004

        assert len(m_ddy_050) == len(m_ddy_100) == len(m_ddy_020) == \
            len(m_ddy_004) == 12

        ddy_path = './tests/ddy/chicago_monthly.ddy'
        monthly_ddy = DDY(stat.location, m_ddy_050)
        monthly_ddy.save(ddy_path)
示例#2
0
def test_monthly_cooling_design_days():
    """Test the monthly cooling design days within the stat object."""
    relative_path = './tests/stat/chicago.stat'
    stat = STAT(relative_path)

    m_ddy_050 = stat.monthly_cooling_design_days_050
    m_ddy_100 = stat.monthly_cooling_design_days_100
    m_ddy_020 = stat.monthly_cooling_design_days_020
    m_ddy_004 = stat.monthly_cooling_design_days_004

    assert len(m_ddy_050) == len(m_ddy_100) == len(m_ddy_020) == \
        len(m_ddy_004) == 12

    ddy_path = './tests/ddy/chicago_monthly.ddy'
    monthly_ddy = DDY(stat.location, m_ddy_050)
    monthly_ddy.save(ddy_path)
示例#3
0
        
    Returns:
        ddy_file: A .ddy file path that has been written to your system.
"""

ghenv.Component.Name = "LadybugPlus_Write DDY"
ghenv.Component.NickName = 'writeDDY'
ghenv.Component.Message = 'VER 0.0.04\nOCT_14_2018'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = '00 :: Ladybug'
ghenv.Component.AdditionalHelpFromDocStrings = "5"

import os
try:
    from ladybug.designday import DDY
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

if _location and _design_days != [] and _run == True:
    # default folder and file name
    if _folder_ is None:
        _folder_ = os.path.join(os.environ['USERPROFILE'], 'ladybug')
    if _name_ is None:
        _name_ = 'unnamed.ddy'
    if not _name_.lower().endswith('.ddy'):
        _name_ = _name_ + '.ddy'
    ddy_file = os.path.join(_folder_, _name_)

    # write the DDY file
    ddy_obj = DDY(_location, _design_days)
    ddy_obj.save(ddy_file)