Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
try:
site_extra_params = common.decode_extra_parameters(site)
except ValueError:
logger.error('Failed to initialize reference forecasts for '
f'{site.name} extra parameters could not be loaded.')
return
site_arm_vars = _determine_site_vars(site_extra_params['network_api_id'])
sfa_vars = [DOE_ARM_VARIABLE_MAP[v] for v in site_arm_vars]
common.create_forecasts(api, site, sfa_vars,
default_forecasts.TEMPLATE_FORECASTS)
def initialize_site_forecasts(api, site):
"""
Create a forecasts for each variable in DOE_RTC_VARIABLE_MAP at each site
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
common.create_forecasts(api, site, DOE_RTC_VARIABLE_MAP.values(),
default_forecasts.TEMPLATE_FORECASTS)
def initialize_site_forecasts(api, site):
"""
Create forecasts for each variable in surfrad_variables at the site
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
common.create_forecasts(api, site, surfrad_variables,
default_forecasts.TEMPLATE_FORECASTS)
def initialize_site_forecasts(api, site):
"""
Create a forecasts for each variable measured at the site
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
common.create_forecasts(api, site, solrad_variables,
default_forecasts.TEMPLATE_FORECASTS)
def initialize_site_forecasts(api, site):
"""
Create a forecasts for each variable measured at the site
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
common.create_forecasts(
api, site, crn_variables,
default_forecasts.TEMPLATE_DETERMINISTIC_NWP_FORECASTS)
extra_params = common.decode_extra_parameters(site)
except ValueError:
logger.warning('Cannot create reference observations at PVDAQ site '
f'{site.name}, missing required parameters.')
return
site_api_id = int(extra_params['network_api_id'])
with open(DEFAULT_SITEFILE) as fp:
obs_metadata = json.load(fp)['observations']
obs_vars = []
for obs in obs_metadata:
obs_extra_params = json.loads(obs['extra_parameters'])
if obs_extra_params['network_api_id'] == site_api_id:
obs_vars.append(obs['variable'])
common.create_forecasts(
api, site, obs_vars, default_forecasts.TEMPLATE_FORECASTS)
Parameters
----------
api : solarforecastarbiter.io.api.APISession
An active Reference user session.
site : datamodel.Site
The site object for which to create Forecasts.
"""
try:
extra_params = common.decode_extra_parameters(site)
except ValueError:
logger.warning('Cannot create reference observations at MIDC site '
f'{site.name}, missing required parameters.')
return
site_api_id = extra_params['network_api_id']
common.create_forecasts(
api, site, midc_config.midc_var_map[site_api_id].keys(),
default_forecasts.TEMPLATE_FORECASTS)
def initialize_site_forecasts(api, site):
"""
Create a forecasts for each variable measured at the site
Parameters
----------
api : :py:class:`solarforecastarbiter.io.api.APISession`
An active Reference user session.
site : :py:class:`solarforecastarbiter.datamodel.Site`
The site object for which to create Forecasts.
"""
variables = list(srml_variable_map.values())
if isinstance(site, SolarPowerPlant):
variables += ['ac_power', 'dc_power']
common.create_forecasts(
api, site, variables,
default_forecasts.TEMPLATE_FORECASTS)