Example #1
0
        _startHour_: Start hour (0-23).
        _endMonth_: End month (1-12).
        _endDay_: End day (1-31).
        _endHour_: End hour (0-23).
        _timestep_: An integer number from 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
    Returns:
        analysisPeriod: Analysis period.
        hoys: List of dates in this analysis period.
        dates: List of hours of the year in this analysis period.
"""

ghenv.Component.Name = "LadybugPlus_Analysis Period"
ghenv.Component.NickName = 'analysisPeriod'
ghenv.Component.Message = 'VER 0.0.01\nJUL_28_2017'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = '01 :: Analyze Weather Data'
ghenv.Component.AdditionalHelpFromDocStrings = "1"

try:
    import ladybug.analysisperiod as ap
    import ladybug.output as output
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

anp = ap.AnalysisPeriod(_startMonth_, _startDay_, _startHour_, _endMonth_,
                        _endDay_, _endHour_, _timestep_)

if anp:
    analysisPeriod = anp
    dates = output.wrap(anp.datetimes)
    hoys = output.wrap(anp.hoys)
Example #2
0
    
    Returns:
        period: Analysis period.
        hoys: List of dates in this analysis period.
        dates: List of hours of the year in this analysis period.
"""

ghenv.Component.Name = 'LB Analysis Period'
ghenv.Component.NickName = 'AnalysisPeriod'
ghenv.Component.Message = '0.1.1'
ghenv.Component.Category = 'Ladybug'
ghenv.Component.SubCategory = '1 :: Analyze Data'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

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

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

anp = ap.AnalysisPeriod(_start_month_, _start_day_, _start_hour_, _end_month_,
                        _end_day_, _end_hour_, _timestep_)

if anp:
    period = anp
    dates = wrap_output(anp.datetimes)
    hoys = anp.hoys
Example #3
0
    def lb_generate_sun_path(self):

        #instance properties to be reterived by sunlight hours  panel
        self.m_vectors = []
        self.m_hoys = []
        self.m_timestep = 1  #default - to be implemented in eto

        location = self.lb_location(self.m_epw_file)
        self.m_epw_file = ""
        daylightSavingPeriod = None  # temporary until we fully implement it
        north = self.m_north_updown.Value
        centerPt = Rhino.Geometry.Point3d(0, 0, 0)
        scale = self.m_sun_path_updown.Value
        sunScale = self.m_sun_sphere_updown.Value
        annual = self.m_annual_check_box.Checked
        hoys = ()

        if not self.m_annual_check_box.Checked:
            month = self.m_date.Value.Month
            day = self.m_date.Value.Day
            hour = self.m_time.Value.Hour
            minute = self.m_time.Value.Minute
            if not self.m_period_check_box.Checked:
                datetime = dt.DateTime(month, day, hour, minute)
                hoys = [datetime.hoy]
            else:
                to_month = self.m_to_date.Value.Month
                to_day = self.m_to_date.Value.Day
                to_hour = self.m_to_time.Value.Hour
                to_minute = self.m_to_time.Value.Minute
                anp = ap.AnalysisPeriod(\
                   month, day, hour, to_month, to_day, to_hour, self.m_timestep)
                if anp:
                    analysisPeriod = anp
                    dates = list(anp.datetimes)
                    hoys = list(anp.hoys)

        # initiate sunpath based on location
        sp = Sunpath.from_location(location, north, daylightSavingPeriod)
        # draw sunpath geometry
        sunpath_geo = \
            sp.draw_sunpath(hoys, centerPt, scale, sunScale, annual)

        analemma = sunpath_geo.analemma_curves
        compass = sunpath_geo.compass_curves
        daily = sunpath_geo.daily_curves

        sunPts = sunpath_geo.sun_geos

        suns = sunpath_geo.suns
        self.m_vectors = list(geo.vector(*sun.sun_vector) for sun in suns)
        altitudes = (sun.altitude for sun in suns)
        azimuths = (sun.azimuth for sun in suns)
        centerPt = centerPt or geo.point(0, 0, 0)
        self.m_hoys = list(sun.hoy for sun in suns)
        datetimes = (sun.datetime for sun in suns)

        #bake geo in scene
        geo_list = list(sunPts) + list(analemma) + list(compass) + list(
            daily) + [centerPt]
        LadybugEto.bakeGeo(geo_list, 'lb_sunpath')

        return