Example #1
0
    def test_from_location(self):
        """Test the from_location() class method"""
        city = 'Tehran'
        country = 'Iran'
        latitude = 36
        longitude = 34
        time_zone = 3.5
        elevation = 54

        loc = Location(city=city, country=country, latitude=latitude,
                       longitude=longitude, time_zone=time_zone,
                       elevation=elevation)

        loc_from_loc = Location.from_location(loc)

        assert loc_from_loc.city == city
        assert loc_from_loc.country == country
        assert loc_from_loc.latitude == latitude
        assert loc_from_loc.longitude == longitude
        assert loc_from_loc.time_zone == time_zone
        assert loc_from_loc.elevation == elevation
Example #2
0
def test_from_location():
    """Test the from_location() class method"""
    city = 'Tehran'
    country = 'Iran'
    latitude = 36
    longitude = 34
    time_zone = 3.5
    elevation = 54

    loc = Location(city=city, country=country, latitude=latitude,
                   longitude=longitude, time_zone=time_zone,
                   elevation=elevation)

    loc_from_loc = Location.from_location(loc)

    assert loc_from_loc.city == city
    assert loc_from_loc.country == country
    assert loc_from_loc.latitude == latitude
    assert loc_from_loc.longitude == longitude
    assert loc_from_loc.time_zone == time_zone
    assert loc_from_loc.elevation == elevation
Example #3
0
# assign inputs
north_, _location, _month_, _day_, _hour_, _type_ = IN
sky = None

try:
    from honeybee.radiance.sky.cie import CIE
    from ladybug.location import Location
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

if _location:
    if not hasattr(_location, 'isLocation'):
        _location = Location.from_location(_location)
    # set default values if they are not set
    north_ = north_ or 0
    _type_ = _type_ or 0
    _month_ = _month_ or 6
    _day_ = _day_ or 21
    _hour_ = _hour_ or 12
    sky = CIE(_location, _month_, _day_, _hour_, _type_, north_)

# assign outputs to OUT
OUT = (sky, )