当前位置: 首页>>代码示例>>Python>>正文


Python Location.get_clearsky方法代码示例

本文整理汇总了Python中pvlib.location.Location.get_clearsky方法的典型用法代码示例。如果您正苦于以下问题:Python Location.get_clearsky方法的具体用法?Python Location.get_clearsky怎么用?Python Location.get_clearsky使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pvlib.location.Location的用法示例。


在下文中一共展示了Location.get_clearsky方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_clearsky_valueerror

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_valueerror():
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    times = pd.DatetimeIndex(start='20160101T0600-0700',
                             end='20160101T1800-0700',
                             freq='3H')
    with pytest.raises(ValueError):
        clearsky = tus.get_clearsky(times, model='invalid_model')
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:9,代码来源:test_location.py

示例2: test_get_clearsky_haurwitz

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_haurwitz(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    clearsky = tus.get_clearsky(times, model='haurwitz')
    expected = pd.DataFrame(data=np.array(
                            [[   0.        ],
                             [ 242.30085588],
                             [ 559.38247117],
                             [ 384.6873791 ],
                             [   0.        ]]),
                            columns=['ghi'],
                            index=times)
    assert_frame_equal(expected, clearsky)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:14,代码来源:test_location.py

示例3: test_get_clearsky

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky(mocker, times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    m = mocker.spy(pvlib.clearsky, 'ineichen')
    out = tus.get_clearsky(times)
    assert m.call_count == 1
    assert_index_equal(out.index, times)
    # check that values are 0 before sunrise and after sunset
    assert out.iloc[0, :].sum().sum() == 0
    assert out.iloc[-1:, :].sum().sum() == 0
    # check that values are > 0 during the day
    assert (out.iloc[1:-1, :] > 0).all().all()
    assert (out.columns.values == ['ghi', 'dni', 'dhi']).all()
开发者ID:mikofski,项目名称:pvlib-python,代码行数:14,代码来源:test_location.py

示例4: test_get_clearsky_simplified_solis

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_simplified_solis(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    clearsky = tus.get_clearsky(times, model='simplified_solis')
    expected = pd.DataFrame(data=np.
        array([[   0.        ,    0.        ,    0.        ],
               [  70.00146271,  638.01145669,  236.71136245],
               [ 101.69729217,  852.51950946,  577.1117803 ],
               [  86.1679965 ,  755.98048017,  385.59586091],
               [   0.        ,    0.        ,    0.        ]]),
                            columns=['dhi', 'dni', 'ghi'],
                            index=times)
    expected = expected[['ghi', 'dni', 'dhi']]
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:15,代码来源:test_location.py

示例5: test_get_clearsky_simplified_solis_aod_pw

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_simplified_solis_aod_pw(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    clearsky = tus.get_clearsky(times, model='simplified_solis',
                                aod700=0.25, precipitable_water=2.)
    expected = pd.DataFrame(data=np.
        array([[   0.        ,    0.        ,    0.        ],
               [  85.77821205,  374.58084365,  179.48483117],
               [ 143.52743364,  625.91745295,  490.06254157],
               [ 114.63275842,  506.52275195,  312.24711495],
               [   0.        ,    0.        ,    0.        ]]),
                            columns=['dhi', 'dni', 'ghi'],
                            index=times)
    expected = expected[['ghi', 'dni', 'dhi']]
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:16,代码来源:test_location.py

示例6: test_get_clearsky

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky():
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    times = pd.DatetimeIndex(start='20160101T0600-0700',
                             end='20160101T1800-0700',
                             freq='3H')
    clearsky = tus.get_clearsky(times)
    expected = pd.DataFrame(data=np.array([
        (  0.0,                0.0,              0.0),
        (262.77734276159333, 791.1972825869296, 46.18714900637892),
        (616.764693938387,   974.9610353623959, 65.44157429054201),
        (419.6512657626518,  901.6234995035793, 54.26016437839348),
        (  0.0,                0.0,              0.0)],
        dtype=[('ghi', '<f8'), ('dni', '<f8'), ('dhi', '<f8')]), index=times)
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:16,代码来源:test_location.py

示例7: test_get_clearsky_simplified_solis_pressure

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_simplified_solis_pressure(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    clearsky = tus.get_clearsky(times, model='simplified_solis',
                                pressure=95000)
    expected = pd.DataFrame(data=np.
        array([[   0.        ,    0.        ,    0.        ],
               [  70.20556637,  635.53091983,  236.17716435],
               [ 102.08954904,  850.49502085,  576.28465815],
               [  86.46561686,  753.70744638,  384.90537859],
               [   0.        ,    0.        ,    0.        ]]),
                            columns=['dhi', 'dni', 'ghi'],
                            index=times)
    expected = expected[['ghi', 'dni', 'dhi']]
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:16,代码来源:test_location.py

示例8: test_get_clearsky_simplified_solis_dni_extra

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_simplified_solis_dni_extra(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    clearsky = tus.get_clearsky(times, model='simplified_solis',
                                dni_extra=1370)
    expected = pd.DataFrame(data=np.
        array([[   0.        ,    0.        ,    0.        ],
               [  67.82281485,  618.15469596,  229.34422063],
               [  98.53217848,  825.98663808,  559.15039353],
               [  83.48619937,  732.45218243,  373.59500313],
               [   0.        ,    0.        ,    0.        ]]),
                            columns=['dhi', 'dni', 'ghi'],
                            index=times)
    expected = expected[['ghi', 'dni', 'dhi']]
    assert_frame_equal(expected, clearsky)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:16,代码来源:test_location.py

示例9: test_get_clearsky_haurwitz

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_haurwitz():
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    times = pd.DatetimeIndex(start='20160101T0600-0700',
                             end='20160101T1800-0700',
                             freq='3H')
    clearsky = tus.get_clearsky(times, model='haurwitz')
    expected = pd.DataFrame(data=np.array(
                            [[   0.        ],
                             [ 242.30085588],
                             [ 559.38247117],
                             [ 384.6873791 ],
                             [   0.        ]]),
                            columns=['ghi'],
                            index=times)
    assert_frame_equal(expected, clearsky)
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:17,代码来源:test_location.py

示例10: test_get_clearsky

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky():
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    times = pd.DatetimeIndex(start='20160101T0600-0700',
                             end='20160101T1800-0700',
                             freq='3H')
    clearsky = tus.get_clearsky(times)
    expected = pd.DataFrame(data=np.
        array([[   0.        ,    0.        ,    0.        ],
               [ 258.60422702,  761.57329257,   50.1235982 ],
               [ 611.96347869,  956.95353414,   70.8232806 ],
               [ 415.10904044,  878.52649603,   59.07820922],
               [   0.        ,    0.        ,    0.        ]]),
                            columns=['ghi', 'dni', 'dhi'],
                            index=times)
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:caskeep,项目名称:pvlib-python,代码行数:17,代码来源:test_location.py

示例11: test_get_clearsky_ineichen_supply_linke

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_ineichen_supply_linke(mocker):
    tus = Location(32.2, -111, 'US/Arizona', 700)
    times = pd.date_range(start='2014-06-24-0700', end='2014-06-25-0700',
                          freq='3h')
    mocker.spy(pvlib.clearsky, 'ineichen')
    out = tus.get_clearsky(times, linke_turbidity=3)
    # we only care that the LT is passed in this test
    pvlib.clearsky.ineichen.assert_called_once_with(ANY, ANY, 3, ANY, ANY)
    assert_index_equal(out.index, times)
    # check that values are 0 before sunrise and after sunset
    assert out.iloc[0:2, :].sum().sum() == 0
    assert out.iloc[-2:, :].sum().sum() == 0
    # check that values are > 0 during the day
    assert (out.iloc[2:-2, :] > 0).all().all()
    assert (out.columns.values == ['ghi', 'dni', 'dhi']).all()
开发者ID:mikofski,项目名称:pvlib-python,代码行数:17,代码来源:test_location.py

示例12: test_get_clearsky_simplified_solis_apparent_elevation

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_simplified_solis_apparent_elevation(times):
    tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
    solar_position = {'apparent_elevation': pd.Series(80, index=times),
                      'apparent_zenith': pd.Series(10, index=times)}
    clearsky = tus.get_clearsky(times, model='simplified_solis',
                                solar_position=solar_position)
    expected = pd.DataFrame(data=np.
        array([[  131.3124497 ,  1001.14754036,  1108.14147919],
               [  131.3124497 ,  1001.14754036,  1108.14147919],
               [  131.3124497 ,  1001.14754036,  1108.14147919],
               [  131.3124497 ,  1001.14754036,  1108.14147919],
               [  131.3124497 ,  1001.14754036,  1108.14147919]]),
                            columns=['dhi', 'dni', 'ghi'],
                            index=times)
    expected = expected[['ghi', 'dni', 'dhi']]
    assert_frame_equal(expected, clearsky, check_less_precise=2)
开发者ID:mikofski,项目名称:pvlib-python,代码行数:18,代码来源:test_location.py

示例13: test_get_clearsky_ineichen_supply_linke

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def test_get_clearsky_ineichen_supply_linke():
    tus = Location(32.2, -111, 'US/Arizona', 700)
    times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='3h')
    times_localized = times.tz_localize(tus.tz)
    expected = pd.DataFrame(np.
        array([[    0.        ,     0.        ,     0.        ],
               [    0.        ,     0.        ,     0.        ],
               [   79.73090244,   316.16436502,    40.45759009],
               [  703.43653498,   876.41452667,    95.15798252],
               [ 1042.37962396,   939.86391062,   118.44687715],
               [  851.32411813,   909.11186737,   105.36662462],
               [  257.18266827,   646.16644264,    62.02777094],
               [    0.        ,     0.        ,     0.        ],
               [    0.        ,     0.        ,     0.        ]]),
                            columns=['ghi', 'dni', 'dhi'],
                            index=times_localized)
    out = tus.get_clearsky(times_localized, linke_turbidity=3)
    assert_frame_equal(expected, out, check_less_precise=2)
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:20,代码来源:test_location.py

示例14: detect_clearsky_data

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
def detect_clearsky_data():
    test_dir = os.path.dirname(os.path.abspath(
        inspect.getfile(inspect.currentframe())))
    file = os.path.join(test_dir, '..', 'data', 'detect_clearsky_data.csv')
    expected = pd.read_csv(file, index_col=0, parse_dates=True, comment='#')
    expected = expected.tz_localize('UTC').tz_convert('Etc/GMT+7')
    metadata = {}
    with open(file) as f:
        for line in f:
            if line.startswith('#'):
                key, value = line.strip('# \n').split(':')
                metadata[key] = float(value)
            else:
                break
    metadata['window_length'] = int(metadata['window_length'])
    loc = Location(metadata['latitude'], metadata['longitude'],
                   altitude=metadata['elevation'])
    # specify turbidity to guard against future lookup changes
    cs = loc.get_clearsky(expected.index, linke_turbidity=2.658197)
    return expected, cs
开发者ID:mikofski,项目名称:pvlib-python,代码行数:22,代码来源:test_clearsky.py

示例15: Location

# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_clearsky [as 别名]
from pvlib import solarposition
from pvlib import irradiance
from pvlib import atmosphere

from conftest import requires_ephem, requires_numba, needs_numpy_1_10

# setup times and location to be tested.
tus = Location(32.2, -111, 'US/Arizona', 700)

# must include night values
times = pd.date_range(start='20140624', freq='6H', periods=4, tz=tus.tz)

ephem_data = solarposition.get_solarposition(
    times, tus.latitude, tus.longitude, method='nrel_numpy')

irrad_data = tus.get_clearsky(times, model='ineichen', linke_turbidity=3)

dni_et = irradiance.extraradiation(times.dayofyear)

ghi = irrad_data['ghi']


# setup for et rad test. put it here for readability
timestamp = pd.Timestamp('20161026')
dt_index = pd.DatetimeIndex([timestamp])
doy = timestamp.dayofyear
dt_date = timestamp.date()
dt_datetime = datetime.datetime.combine(dt_date, datetime.time(0))
dt_np64 = np.datetime64(dt_datetime)
value = 1383.636203
开发者ID:dpete2008,项目名称:Sandia,代码行数:32,代码来源:test_irradiance.py


注:本文中的pvlib.location.Location.get_clearsky方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。