@@ -42,28 +42,31 @@ def irradiance_qcrad():
42
42
output = pd .DataFrame (
43
43
columns = ['ghi' , 'dhi' , 'dni' , 'solar_zenith' , 'dni_extra' ,
44
44
'ghi_limit_flag' , 'dhi_limit_flag' , 'dni_limit_flag' ,
45
+ 'ghi_extreme_limit_flag' , 'dhi_extreme_limit_flag' ,
46
+ 'dni_extreme_limit_flag' ,
45
47
'consistent_components' , 'diffuse_ratio_limit' ,
46
48
'consistent_components_outside_domain' ,
47
49
'diffuse_ratio_limit_outside_domain' ,
48
50
],
49
- data = np .array ([[- 100 , 100 , 100 , 30 , 1370 , 0 , 1 , 1 , 0 , 0 , 0 , 1 ],
50
- [100 , - 100 , 100 , 30 , 1370 , 1 , 0 , 1 , 0 , 0 , 1 , 0 ],
51
- [100 , 100 , - 100 , 30 , 1370 , 1 , 1 , 0 , 0 , 1 , 1 , 1 ],
52
- [1000 , 100 , 900 , 0 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ],
53
- [1000 , 200 , 800 , 15 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ],
54
- [1000 , 200 , 800 , 60 , 1370 , 0 , 1 , 1 , 0 , 1 , 0 , 1 ],
55
- [1000 , 300 , 850 , 80 , 1370 , 0 , 0 , 1 , 0 , 1 , 0 , 1 ],
56
- [1000 , 500 , 800 , 90 , 1370 , 0 , 0 , 1 , 0 , 1 , 0 , 1 ],
57
- [500 , 100 , 1100 , 0 , 1370 , 1 , 1 , 1 , 0 , 1 , 0 , 1 ],
58
- [1000 , 300 , 1200 , 0 , 1370 , 1 , 1 , 1 , 0 , 1 , 0 , 1 ],
59
- [500 , 600 , 100 , 60 , 1370 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ],
60
- [500 , 600 , 400 , 80 , 1370 , 0 , 0 , 1 , 0 , 0 , 0 , 0 ],
61
- [500 , 500 , 300 , 80 , 1370 , 0 , 0 , 1 , 1 , 1 , 1 , 1 ],
62
- [0 , 0 , 0 , 93 , 1370 , 1 , 1 , 1 , 0 , 0 , 1 , 1 ],
63
- [100 , 100 , 0 , 95 , 1370 , 0 , 0 , 1 , 0 , 0 , 1 , 1 ],
51
+ data = np .array ([[- 100 , 100 , 100 , 30 , 1370 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 0 , 0 , 1 ], # noqa: E501
52
+ [100 , - 100 , 100 , 30 , 1370 , 1 , 0 , 1 , 1 , 0 , 1 , 0 , 0 , 1 , 0 ], # noqa: E501
53
+ [100 , 100 , - 100 , 30 , 1370 , 1 , 1 , 0 , 1 , 1 , 0 , 0 , 1 , 1 , 1 ], # noqa: E501
54
+ [1000 , 100 , 900 , 0 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ],
55
+ [1000 , 200 , 800 , 15 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ], # noqa: E501
56
+ [1000 , 200 , 800 , 60 , 1370 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 1 , 0 , 1 ], # noqa: E501
57
+ [1000 , 300 , 850 , 80 , 1370 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 1 , 0 , 1 ], # noqa: E501
58
+ [1000 , 500 , 800 , 90 , 1370 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 1 ], # noqa: E501
59
+ [500 , 100 , 1100 , 0 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 0 , 1 ],
60
+ [1000 , 300 , 1200 , 0 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 0 , 1 ], # noqa: E501
61
+ [500 , 600 , 100 , 60 , 1370 , 1 , 1 , 1 , 1 , 0 , 1 , 0 , 0 , 0 , 0 ],
62
+ [500 , 600 , 400 , 80 , 1370 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 ],
63
+ [500 , 500 , 300 , 80 , 1370 , 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 , 1 , 1 ],
64
+ [0 , 0 , 0 , 93 , 1370 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 ],
65
+ [100 , 100 , 0 , 95 , 1370 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 1 ]
64
66
]))
65
67
dtypes = ['float64' , 'float64' , 'float64' , 'float64' , 'float64' ,
66
- 'bool' , 'bool' , 'bool' , 'bool' , 'bool' , 'bool' , 'bool' ]
68
+ 'bool' , 'bool' , 'bool' , 'bool' , 'bool' , 'bool' , 'bool' , 'bool' ,
69
+ 'bool' , 'bool' ]
67
70
for (col , typ ) in zip (output .columns , dtypes ):
68
71
output [col ] = output [col ].astype (typ )
69
72
return output
@@ -88,6 +91,13 @@ def test_check_ghi_limits_qcrad(irradiance_qcrad):
88
91
expected ['dni_extra' ])
89
92
assert_series_equal (ghi_out , ghi_out_expected , check_names = False )
90
93
94
+ ghi_out_extreme = irradiance .check_ghi_limits_qcrad (
95
+ expected ['ghi' ], expected ['solar_zenith' ], expected ['dni_extra' ],
96
+ limits = 'extreme' )
97
+ ghi_extreme_out_expected = expected ['ghi_extreme_limit_flag' ]
98
+ assert_series_equal (
99
+ ghi_out_extreme , ghi_extreme_out_expected , check_names = False )
100
+
91
101
92
102
def test_check_dhi_limits_qcrad (irradiance_qcrad ):
93
103
"""Test that QCRad identifies out of bounds DHI values.
@@ -108,6 +118,13 @@ def test_check_dhi_limits_qcrad(irradiance_qcrad):
108
118
expected ['dni_extra' ])
109
119
assert_series_equal (dhi_out , dhi_out_expected , check_names = False )
110
120
121
+ dhi_out_extreme = irradiance .check_dhi_limits_qcrad (
122
+ expected ['dhi' ], expected ['solar_zenith' ], expected ['dni_extra' ],
123
+ limits = 'extreme' )
124
+ dhi_extreme_out_expected = expected ['dhi_extreme_limit_flag' ]
125
+ assert_series_equal (
126
+ dhi_out_extreme , dhi_extreme_out_expected , check_names = False )
127
+
111
128
112
129
def test_check_dni_limits_qcrad (irradiance_qcrad ):
113
130
"""Test that QCRad identifies out of bounds DNI values.
@@ -128,6 +145,13 @@ def test_check_dni_limits_qcrad(irradiance_qcrad):
128
145
expected ['dni_extra' ])
129
146
assert_series_equal (dni_out , dni_out_expected , check_names = False )
130
147
148
+ dni_out_extreme = irradiance .check_dni_limits_qcrad (
149
+ expected ['dni' ], expected ['solar_zenith' ], expected ['dni_extra' ],
150
+ limits = 'extreme' )
151
+ dni_extreme_out_expected = expected ['dni_extreme_limit_flag' ]
152
+ assert_series_equal (
153
+ dni_out_extreme , dni_extreme_out_expected , check_names = False )
154
+
131
155
132
156
def test_check_irradiance_limits_qcrad (irradiance_qcrad ):
133
157
"""Test different input combinations to check_irradiance_limits_qcrad.
@@ -162,6 +186,20 @@ def test_check_irradiance_limits_qcrad(irradiance_qcrad):
162
186
assert_series_equal (dni_out , dni_out_expected , check_names = False )
163
187
164
188
189
+ def test_check_irradiance_limits_qcrad_extreme (irradiance_qcrad ):
190
+ """Test different input combinations to check_irradiance_limits_qcrad.
191
+ """
192
+ expected = irradiance_qcrad
193
+
194
+ ghi_out , dhi_out , dni_out = irradiance .check_irradiance_limits_qcrad (
195
+ expected ['solar_zenith' ], expected ['dni_extra' ], ghi = expected ['ghi' ],
196
+ dhi = expected ['dhi' ], dni = expected ['dni' ], limits = 'extreme' )
197
+
198
+ assert_series_equal (ghi_out , expected ['ghi_extreme_limit_flag' ], check_names = False ) # noqa: E501
199
+ assert_series_equal (dhi_out , expected ['dhi_extreme_limit_flag' ], check_names = False ) # noqa: E501
200
+ assert_series_equal (dni_out , expected ['dni_extreme_limit_flag' ], check_names = False ) # noqa: E501
201
+
202
+
165
203
def test_check_irradiance_consistency_qcrad (irradiance_qcrad ):
166
204
"""Test that QCRad identifies consistent irradiance measurements.
167
205
0 commit comments