14
14
from pvlib import atmosphere
15
15
16
16
# setup times and location to be tested.
17
- times = pd .date_range (start = datetime .datetime (2014 ,6 , 24 ),
18
- end = datetime .datetime (2014 ,6 , 26 ), freq = '1Min' )
17
+ times = pd .date_range (start = datetime .datetime (2014 , 6 , 24 ),
18
+ end = datetime .datetime (2014 , 6 , 26 ), freq = '1Min' )
19
19
20
20
tus = Location (32.2 , - 111 , 'US/Arizona' , 700 )
21
21
36
36
37
37
def test_extraradiation ():
38
38
assert_almost_equals (1382 , irradiance .extraradiation (300 ), - 1 )
39
-
39
+
40
+
40
41
def test_extraradiation_dtindex ():
41
42
irradiance .extraradiation (times )
42
-
43
+
44
+
43
45
def test_extraradiation_doyarray ():
44
46
irradiance .extraradiation (times .dayofyear )
45
-
47
+
48
+
46
49
def test_extraradiation_asce ():
47
- assert_almost_equals (1382 , irradiance .extraradiation (300 , method = 'asce' ), - 1 )
48
-
50
+ assert_almost_equals (
51
+ 1382 , irradiance .extraradiation (300 , method = 'asce' ), - 1 )
52
+
53
+
49
54
def test_extraradiation_spencer ():
50
- assert_almost_equals (1382 , irradiance .extraradiation (300 , method = 'spencer' ), - 1 )
51
-
55
+ assert_almost_equals (
56
+ 1382 , irradiance .extraradiation (300 , method = 'spencer' ), - 1 )
57
+
58
+
52
59
def test_extraradiation_ephem_dtindex ():
53
60
irradiance .extraradiation (times , method = 'pyephem' )
54
-
61
+
62
+
55
63
def test_extraradiation_ephem_scalar ():
56
- assert_almost_equals (1382 , irradiance .extraradiation (300 , method = 'pyephem' ).values [0 ], - 1 )
57
-
64
+ assert_almost_equals (
65
+ 1382 , irradiance .extraradiation (300 , method = 'pyephem' ).values [0 ], - 1 )
66
+
67
+
58
68
def test_extraradiation_ephem_doyarray ():
59
69
irradiance .extraradiation (times .dayofyear , method = 'pyephem' )
60
70
71
+
61
72
def test_grounddiffuse_simple_float ():
62
73
irradiance .grounddiffuse (40 , 900 )
63
74
75
+
64
76
def test_grounddiffuse_simple_series ():
65
77
ground_irrad = irradiance .grounddiffuse (40 , ghi )
66
78
assert ground_irrad .name == 'diffuse_ground'
67
-
79
+
80
+
68
81
def test_grounddiffuse_albedo_0 ():
69
82
ground_irrad = irradiance .grounddiffuse (40 , ghi , albedo = 0 )
70
83
assert 0 == ground_irrad .all ()
71
84
85
+
72
86
@raises (KeyError )
73
87
def test_grounddiffuse_albedo_invalid_surface ():
74
88
irradiance .grounddiffuse (40 , ghi , surface_type = 'invalid' )
75
-
89
+
90
+
76
91
def test_grounddiffuse_albedo_surface ():
77
92
irradiance .grounddiffuse (40 , ghi , surface_type = 'sand' )
78
-
93
+
94
+
79
95
def test_isotropic_float ():
80
96
irradiance .isotropic (40 , 100 )
81
-
97
+
98
+
82
99
def test_isotropic_series ():
83
100
irradiance .isotropic (40 , irrad_data ['DHI' ])
84
101
102
+
85
103
def test_klucher_series_float ():
86
104
irradiance .klucher (40 , 180 , 100 , 900 , 20 , 180 )
87
-
105
+
106
+
88
107
def test_klucher_series ():
89
108
irradiance .klucher (40 , 180 , irrad_data ['DHI' ], irrad_data ['GHI' ],
90
- ephem_data ['apparent_zenith' ],
91
- ephem_data ['apparent_azimuth' ])
92
-
109
+ ephem_data ['apparent_zenith' ],
110
+ ephem_data ['apparent_azimuth' ])
111
+
112
+
93
113
def test_haydavies ():
94
114
irradiance .haydavies (40 , 180 , irrad_data ['DHI' ], irrad_data ['DNI' ],
95
- dni_et ,
96
- ephem_data ['apparent_zenith' ],
97
- ephem_data ['apparent_azimuth' ])
98
-
115
+ dni_et ,
116
+ ephem_data ['apparent_zenith' ],
117
+ ephem_data ['apparent_azimuth' ])
118
+
119
+
99
120
def test_reindl ():
100
121
irradiance .reindl (40 , 180 , irrad_data ['DHI' ], irrad_data ['DNI' ],
101
- irrad_data ['GHI' ], dni_et ,
102
- ephem_data ['apparent_zenith' ],
103
- ephem_data ['apparent_azimuth' ])
104
-
122
+ irrad_data ['GHI' ], dni_et ,
123
+ ephem_data ['apparent_zenith' ],
124
+ ephem_data ['apparent_azimuth' ])
125
+
126
+
105
127
def test_king ():
106
128
irradiance .king (40 , irrad_data ['DHI' ], irrad_data ['GHI' ],
107
- ephem_data ['apparent_zenith' ])
108
-
129
+ ephem_data ['apparent_zenith' ])
130
+
131
+
109
132
def test_perez ():
110
133
AM = atmosphere .relativeairmass (ephem_data ['apparent_zenith' ])
111
134
irradiance .perez (40 , 180 , irrad_data ['DHI' ], irrad_data ['DNI' ],
112
- dni_et ,
113
- ephem_data ['apparent_zenith' ],
114
- ephem_data ['apparent_azimuth' ],
115
- AM )
135
+ dni_et , ephem_data ['apparent_zenith' ],
136
+ ephem_data ['apparent_azimuth' ],AM )
0 commit comments