Skip to content

Commit

Permalink
add test for clearsky_filter function
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer committed Apr 17, 2024
1 parent a9141e1 commit 30760c4
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion rdtools/test/filtering_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest
import pandas as pd
import numpy as np
from rdtools import (csi_filter,
from rdtools import (clearsky_filter,
csi_filter,
poa_filter,
tcell_filter,
clip_filter,
Expand All @@ -15,6 +16,33 @@
from conftest import assert_warnings


def test_clearsky_filter(mocker):
''' Unit tests for clearsky filter wrapper function.'''
measured_poa = pd.Series([1, 1, 0, 1.15, 0.85])
clearsky_poa = pd.Series([1, 2, 1, 1.00, 1.00])

# Check that a ValueError is thrown when a model is passed that
# is not in the acceptable list.
pytest.raises(ValueError, clearsky_filter,
measured_poa,
clearsky_poa,
model='invalid')

# Check that the csi_filter function is called
mock_csi_filter = mocker.patch('rdtools.filtering.csi_filter')
clearsky_filter(measured_poa,
clearsky_poa,
model='csi')
mock_csi_filter.assert_called_once()

# Check that the pvlib_clearsky_filter function is called
mock_pvlib_filter = mocker.patch('rdtools.filtering.pvlib_clearsky_filter')
clearsky_filter(measured_poa,
clearsky_poa,
model='pvlib')
mock_pvlib_filter.assert_called_once()


def test_csi_filter():
''' Unit tests for clear sky index filter.'''

Expand Down

0 comments on commit 30760c4

Please sign in to comment.