def title_text(data_col): """Get a text string for the title of the sunpath.""" title_array = ['{} ({})'.format(data_col.header.data_type, data_col.header.unit)] for key, val in data_col.header.metadata.items(): title_array.append('{}: {}'.format(key, val)) return '\n'.join(title_array) if all_required_inputs(ghenv.Component): # process all of the global inputs for the sunpath if north_ is not None: # process the north_ try: north_ = math.degrees( to_vector2d(north_).angle_clockwise(Vector2D(0, 1))) except AttributeError: # north angle instead of vector north_ = float(north_) else: north_ = 0 if _center_pt_ is not None: # process the center point into a Point2D center_pt, center_pt3d = to_point2d(_center_pt_), to_point3d(_center_pt_) z = _center_pt_.Z else: center_pt, center_pt3d = Point2D(), Point3D() z = 0 _scale_ = 1 if _scale_ is None else _scale_ # process the scale into a radius radius = (100 * _scale_) / conversion_to_meters() solar_time_ = False if solar_time_ is None else solar_time_ # process solat time # create a intersection of the input _hoys_ and the data hoys
except ValueError: dates = tuple( DateTime.from_date_time_string(date).date for date in holidays_) _run_period_.holidays = dates # set the start day of the week if it is input if _start_dow_ is not None: _run_period_.start_day_of_week = _start_dow_.title() # set the default timestep _timestep_ = _timestep_ if _timestep_ is not None else 6 # set the default timestep _terrain_ = _terrain_.title() if _terrain_ is not None else 'City' # return final simulation parameters sim_par = SimulationParameter(output=_output_, run_period=_run_period_, timestep=_timestep_, simulation_control=_sim_control_, shadow_calculation=_shadow_calc_, sizing_parameter=_sizing_, terrain_type=_terrain_) # set the north if it is not defaulted if _north_ is not None: try: sim_par.north_vector = to_vector2d(_north_) except AttributeError: # north angle instead of vector sim_par.north_angle = float(_north_)
try: from honeybee_radiance.lightsource.sky import ClimateBased 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 if they are not set _month_ = _month_ or 6 _day_ = _day_ or 21 _hour_ = _hour_ or 12 # create the sky object sky = ClimateBased.from_location( _location, _month_, _day_, _hour_, _dir_rad, _diff_rad, north_)
'the Model with the "HB Assign Grids and Views" component.' give_warning(ghenv.Component, msg) print(msg) all_grids = [ g.display_name for g in _model.properties.radiance.sensor_grids ] if len(_sensor_grids_) == 0 or _sensor_grids_[0] is None: _sensor_grids_ = all_grids # use all the Model's sensor grids else: for grid in _sensor_grids_: assert grid in all_grids, \ 'Sensor grid "{}" was not found in the Model.'.format(grid) assert isinstance(_wea, Wea), 'Expected Wea object. Got {}.'.format(type(_wea)) try: north_vector = to_vector2d(north_) north_angle = math.degrees(north_vector.angle_clockwise(Vector2D(0, 1))) except AttributeError: # north angle instead of vector north_angle = float(north_) # this part is an optional step for each recipe to process the model for luigi input def default_simulation_path(self): return os.path.join(hb_folders.default_simulation_folder, self._info['inputs']['model'].identifier, 'Radiance') def process_inputs(inputs, folder): model_fold = os.path.join(folder, 'model') if os.path.isdir(model_fold): nukedir(model_fold,