本文整理汇总了Python中pvlib.location.Location.get_airmass方法的典型用法代码示例。如果您正苦于以下问题:Python Location.get_airmass方法的具体用法?Python Location.get_airmass怎么用?Python Location.get_airmass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pvlib.location.Location
的用法示例。
在下文中一共展示了Location.get_airmass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_airmass
# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_airmass [as 别名]
def test_get_airmass():
tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
times = pd.DatetimeIndex(start='20160101T0600-0700',
end='20160101T1800-0700',
freq='3H')
airmass = tus.get_airmass(times)
expected = pd.DataFrame(data=np.array(
[[ nan, nan],
[ 3.61046506, 3.32072602],
[ 1.76470864, 1.62309115],
[ 2.45582153, 2.25874238],
[ nan, nan]]),
columns=['airmass_relative', 'airmass_absolute'],
index=times)
assert_frame_equal(expected, airmass)
airmass = tus.get_airmass(times, model='young1994')
expected = pd.DataFrame(data=np.array(
[[ nan, nan],
[ 3.6075018 , 3.31800056],
[ 1.7641033 , 1.62253439],
[ 2.45413091, 2.25718744],
[ nan, nan]]),
columns=['airmass_relative', 'airmass_absolute'],
index=times)
assert_frame_equal(expected, airmass)
示例2: test_get_airmass_valueerror
# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_airmass [as 别名]
def test_get_airmass_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_airmass(times, model='invalid_model')
示例3: ForecastModel
# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_airmass [as 别名]
#.........这里部分代码省略.........
Returns
-------
ghi : numeric
Estimated GHI.
"""
transmittance = ((100.0 - cloud_cover) / 100.0) * 0.75
return transmittance
def cloud_cover_to_irradiance_liujordan(self, cloud_cover, **kwargs):
"""
Estimates irradiance from cloud cover in the following steps:
1. Determine transmittance using a function of cloud cover e.g.
:py:meth:`~ForecastModel.cloud_cover_to_transmittance_linear`
2. Calculate GHI, DNI, DHI using the
:py:func:`pvlib.irradiance.liujordan` model
Parameters
----------
cloud_cover : Series
Returns
-------
irradiance : DataFrame
Columns include ghi, dni, dhi
"""
# in principle, get_solarposition could use the forecast
# pressure, temp, etc., but the cloud cover forecast is not
# accurate enough to justify using these minor corrections
solar_position = self.location.get_solarposition(cloud_cover.index)
dni_extra = extraradiation(cloud_cover.index)
airmass = self.location.get_airmass(cloud_cover.index)
transmittance = self.cloud_cover_to_transmittance_linear(cloud_cover,
**kwargs)
irrads = liujordan(solar_position['apparent_zenith'],
transmittance, airmass['airmass_absolute'],
dni_extra=dni_extra)
irrads = irrads.fillna(0)
return irrads
def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
**kwargs):
"""
Convert cloud cover to irradiance. A wrapper method.
Parameters
----------
cloud_cover : Series
how : str
Selects the method for conversion. Can be one of
clearsky_scaling or liujordan.
**kwargs
Passed to the selected method.
Returns
-------
irradiance : DataFrame
Columns include ghi, dni, dhi
"""
how = how.lower()
示例4: test_get_airmass_valueerror
# 需要导入模块: from pvlib.location import Location [as 别名]
# 或者: from pvlib.location.Location import get_airmass [as 别名]
def test_get_airmass_valueerror(times):
tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
with pytest.raises(ValueError):
clearsky = tus.get_airmass(times, model='invalid_model')