Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
The beginning of the period to request data for.
end : datetime
The end of the period to request data for.
"""
doe_arm_api_key = os.getenv('DOE_ARM_API_KEY')
if doe_arm_api_key is None:
raise KeyError('"DOE_ARM_API_KEY" environment variable must be '
'set to update DOE ARM observation data.')
doe_arm_user_id = os.getenv('DOE_ARM_USER_ID')
if doe_arm_user_id is None:
raise KeyError('"DOE_ARM_USER_ID" environment variable must be '
'set to update DOE ARM observation data.')
doe_arm_sites = common.filter_by_networks(sites, 'DOE ARM')
for site in doe_arm_sites:
common.update_site_observations(
api, partial(fetch, doe_arm_user_id=doe_arm_user_id,
doe_arm_api_key=doe_arm_api_key),
site, observations, start, end)
USCRN site between start and end.
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
sites: list of solarforecastarbiter.datamodel.Site
List of all reference sites
observations: list of solarforecastarbiter.datamodel.Observation
List of all reference observations.
start : datetime
The beginning of the period to request data for.
end : datetime
The end of the period to request data for.
"""
crn_sites = common.filter_by_networks(sites, 'NOAA USCRN')
for site in crn_sites:
common.update_site_observations(
api, fetch, site, observations, start, end)
The end of the period to request data for.
Raises
------
KeyError
If NREL_PVDAQ_API_KEY environmental variable is not set.
Abuse of KeyError - should probably be ValueError - but kept for
consistency with other reference_observations modules.
"""
nrel_pvdaq_api_key = os.getenv('NREL_PVDAQ_API_KEY')
if nrel_pvdaq_api_key is None:
raise KeyError('"NREL_PVDAQ_API_KEY" environment variable must be '
'set to update PVDAQ observation data.')
pvdaq_sites = common.filter_by_networks(sites, ['NREL PVDAQ'])
for site in pvdaq_sites:
common.update_site_observations(
api, partial(fetch, nrel_pvdaq_api_key=nrel_pvdaq_api_key),
site, observations, start, end)
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
sites: list
List of all reference sites as Objects
observations: list of solarforecastarbiter.datamodel.Observation
List of all reference observations.
start : datetime
The beginning of the period to request data for.
end : datetime
The end of the period to request data for.
"""
midc_sites = common.filter_by_networks(sites, ['NREL MIDC'])
for site in midc_sites:
common.update_site_observations(
api, fetch, site, observations, start, end)
from start to end.
api : :py:class:`solarforecastarbiter.io.api.APISession`
An active Reference user session.
sites: list of :py:class:`solarforecastarbiter.datamodel.Site`
List of all reference sites as Objects
observations: list of :py:class:`solarforecastarbiter.datamodel.Observation`
List of all reference observations as Objects
start : datetime
The beginning of the period to request data for.
end : datetime
The end of the period to request data for.
""" # noqa
srml_sites = common.filter_by_networks(sites, 'UO SRML')
for site in srml_sites:
common.update_site_observations(api, fetch, site, observations,
start, end)
sites: list of solarforecastarbiter.datamodel.Site
List of all reference sites as Objects
observations: list of solarforecastarbiter.datamodel.Observation
List of all reference observations.
start : datetime
The beginning of the period to request data for.
end : datetime
The end of the period to request data for.
"""
doe_rtc_api_key = os.getenv('DOE_RTC_API_KEY')
if doe_rtc_api_key is None:
raise KeyError('"DOE_RTC_API_KEY" environment variable must be '
'set to update DOE RTC observation data.')
doe_rtc_sites = common.filter_by_networks(sites, 'DOE RTC')
for site in doe_rtc_sites:
common.update_site_observations(
api, partial(fetch, doe_rtc_api_key=doe_rtc_api_key), site,
observations, start, end)