def referencedata_update(verbose, user, password, base_url, network, start,
                         end):
    """
    Updates reference data for the given period.
    """
    set_log_level(verbose)
    token = cli_access_token(user, password)
    reference_data.update_reference_observations(token, start, end, network,
                                                 base_url)
Exemple #2
0
def referencedata_update(verbose, user, password, base_url, network, start,
                         end):
    """
    Updates reference data for the given period. START and END should be given
    as ISO8601 datetime strings. If no timezone is defined, UTC will be
    assumed.
    """
    set_log_level(verbose)
    token = cli_access_token(user, password)
    reference_data.update_reference_observations(token, start, end, network,
                                                 base_url)
Exemple #3
0
def test_update_reference_observations(mocker, mock_api, log, start, end,
                                       networks):
    api = mocker.patch('solarforecastarbiter.io.reference_observations.'
                       'reference_data.get_apisession')
    api.return_value = mock_api
    surfrad = mocker.patch(
        'solarforecastarbiter.io.reference_observations.reference_data.'
        'surfrad.update_observation_data')
    solrad = mocker.patch(
        'solarforecastarbiter.io.reference_observations.solrad.'
        'update_observation_data')
    reference_data.update_reference_observations('TOKEN', start, end, networks)
    surfrad.assert_called()
    solrad.assert_called()
    assert log.info.call_count == 1
Exemple #4
0
def test_update_reference_observations_gaps(mocker, mock_api, log, start, end,
                                            networks):
    api = mocker.patch('solarforecastarbiter.io.reference_observations.'
                       'reference_data.get_apisession')
    mocker.patch.dict('os.environ', {
        'DOE_ARM_API_KEY': 'key',
        'DOE_ARM_USER_ID': 'id'
    })
    api.return_value = mock_api
    common_update = mocker.patch(
        'solarforecastarbiter.io.reference_observations.common'
        '.update_site_observations')
    reference_data.update_reference_observations('TOKEN',
                                                 start,
                                                 end,
                                                 networks,
                                                 gaps_only=True)
    assert common_update.call_count == 3
    assert common_update.call_args[1]['gaps_only'] is True