How to use the solarforecastarbiter.io.reference_observations.common.filter_by_networks function in solarforecastarbiter

To help you get started, we’ve selected a few solarforecastarbiter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / midc.py View on Github external
start to 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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / rtc.py View on Github external
api : solarforecastarbiter.io.api.APISession
        An active Reference user session.
    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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / surfrad.py View on Github external
def update_observation_data(api, sites, observations, start, end):
    """Post new observation data to a list of Surfrad Observations
    from start to end.

    api : solarforecastarbiter.io.api.APISession
        An active Reference user session.
    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.
    """
    surfrad_sites = common.filter_by_networks(sites, 'NOAA SURFRAD')
    for site in surfrad_sites:
        common.update_site_observations(
            api, fetch, site, observations, start, end)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / srml.py View on Github external
def update_observation_data(api, sites, observations, start, end):
    """Post new observation data to a list of SRML Observations
    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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / crn.py View on Github external
def update_observation_data(api, sites, observations, start, end):
    """ Post new observation data to all reference observations at each
    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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / pvdaq.py View on Github external
The beginning of the period to request data for.
    end : datetime
        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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / arm.py View on Github external
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_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)
github SolarArbiter / solarforecastarbiter-core / solarforecastarbiter / io / reference_observations / solrad.py View on Github external
def update_observation_data(api, sites, observations, start, end):
    """Post new observation data to all reference observations
    at each SOLRAD 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 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.
    """
    solrad_sites = common.filter_by_networks(sites, 'NOAA SOLRAD')
    for site in solrad_sites:
        common.update_site_observations(
            api, fetch, site, observations, start, end)