1
1
"""
2
- The ``atmosphere`` module contains methods to calculate
3
- relative and absolute airmass and to determine
4
- pressure from altitude or vice versa.
2
+ The ``atmosphere`` module contains methods to calculate relative and
3
+ absolute airmass and to determine pressure from altitude or vice versa.
5
4
"""
6
5
7
6
from __future__ import division
@@ -48,14 +47,12 @@ def pres2alt(pressure):
48
47
49
48
"A Quick Derivation relating altitude to air pressure" from Portland
50
49
State Aerospace Society, Version 1.03, 12/22/2004.
51
-
52
50
'''
53
51
54
52
alt = 44331.5 - 4946.62 * pressure ** (0.190263 )
55
53
return alt
56
54
57
55
58
-
59
56
def alt2pres (altitude ):
60
57
'''
61
58
Determine site pressure from altitude.
@@ -97,17 +94,16 @@ def alt2pres(altitude):
97
94
return press
98
95
99
96
100
-
101
97
def absoluteairmass (airmass_relative , pressure = 101325. ):
102
98
'''
103
99
Determine absolute (pressure corrected) airmass from relative
104
100
airmass and pressure
105
101
106
- Gives the airmass for locations not at sea-level (i.e. not at standard
107
- pressure). The input argument "AMrelative" is the relative airmass. The
108
- input argument "pressure" is the pressure (in Pascals) at the location
109
- of interest and must be greater than 0. The calculation for
110
- absolute airmass is
102
+ Gives the airmass for locations not at sea-level (i.e. not at
103
+ standard pressure). The input argument "AMrelative" is the relative
104
+ airmass. The input argument "pressure" is the pressure (in Pascals)
105
+ at the location of interest and must be greater than 0. The
106
+ calculation for absolute airmass is
111
107
112
108
.. math::
113
109
absolute airmass = (relative airmass)*pressure/101325
@@ -129,8 +125,8 @@ def absoluteairmass(airmass_relative, pressure=101325.):
129
125
References
130
126
----------
131
127
[1] C. Gueymard, "Critical analysis and performance assessment of
132
- clear sky solar irradiance models using theoretical and measured data,"
133
- Solar Energy, vol. 51, pp. 121-138, 1993.
128
+ clear sky solar irradiance models using theoretical and measured
129
+ data," Solar Energy, vol. 51, pp. 121-138, 1993.
134
130
135
131
'''
136
132
@@ -143,35 +139,38 @@ def relativeairmass(zenith, model='kastenyoung1989'):
143
139
'''
144
140
Gives the relative (not pressure-corrected) airmass.
145
141
146
- Gives the airmass at sea-level when given a sun zenith angle
147
- (in degrees).
148
- The ``model`` variable allows selection of different airmass models
149
- (described below). If ``model`` is not
150
- included or is not valid, the default model is 'kastenyoung1989'.
142
+ Gives the airmass at sea-level when given a sun zenith angle (in
143
+ degrees). The ``model`` variable allows selection of different
144
+ airmass models (described below). If ``model`` is not included or is
145
+ not valid, the default model is 'kastenyoung1989'.
151
146
152
147
Parameters
153
148
----------
154
149
155
150
zenith : float or Series
156
- Zenith angle of the sun in degrees.
157
- Note that some models use the apparent (refraction corrected)
158
- zenith angle, and some models use the true
159
- (not refraction-corrected) zenith angle.
160
- See model descriptions to determine which type of zenith
161
- angle is required.
162
- Apparent zenith angles must be calculated at sea level.
151
+ Zenith angle of the sun in degrees. Note that some models use
152
+ the apparent (refraction corrected) zenith angle, and some
153
+ models use the true (not refraction-corrected) zenith angle. See
154
+ model descriptions to determine which type of zenith angle is
155
+ required. Apparent zenith angles must be calculated at sea level.
163
156
164
157
model : String
165
158
Available models include the following:
166
159
167
160
* 'simple' - secant(apparent zenith angle) -
168
161
Note that this gives -inf at zenith=90
169
- * 'kasten1966' - See reference [1] - requires apparent sun zenith
170
- * 'youngirvine1967' - See reference [2] - requires true sun zenith
171
- * 'kastenyoung1989' - See reference [3] - requires apparent sun zenith
172
- * 'gueymard1993' - See reference [4] - requires apparent sun zenith
173
- * 'young1994' - See reference [5] - requries true sun zenith
174
- * 'pickering2002' - See reference [6] - requires apparent sun zenith
162
+ * 'kasten1966' - See reference [1] -
163
+ requires apparent sun zenith
164
+ * 'youngirvine1967' - See reference [2] -
165
+ requires true sun zenith
166
+ * 'kastenyoung1989' - See reference [3] -
167
+ requires apparent sun zenith
168
+ * 'gueymard1993' - See reference [4] -
169
+ requires apparent sun zenith
170
+ * 'young1994' - See reference [5] -
171
+ requries true sun zenith
172
+ * 'pickering2002' - See reference [6] -
173
+ requires apparent sun zenith
175
174
176
175
Returns
177
176
-------
@@ -183,27 +182,27 @@ def relativeairmass(zenith, model='kastenyoung1989'):
183
182
----------
184
183
185
184
[1] Fritz Kasten. "A New Table and Approximation Formula for the
186
- Relative Optical Air Mass". Technical Report 136, Hanover, N.H.: U.S.
187
- Army Material Command, CRREL.
185
+ Relative Optical Air Mass". Technical Report 136, Hanover, N.H.:
186
+ U.S. Army Material Command, CRREL.
188
187
189
- [2] A. T. Young and W. M. Irvine, "Multicolor Photoelectric Photometry
190
- of the Brighter Planets," The Astronomical Journal, vol. 72,
191
- pp. 945-950, 1967.
188
+ [2] A. T. Young and W. M. Irvine, "Multicolor Photoelectric
189
+ Photometry of the Brighter Planets," The Astronomical Journal, vol.
190
+ 72, pp. 945-950, 1967.
192
191
193
- [3] Fritz Kasten and Andrew Young. "Revised optical air mass tables and
194
- approximation formula". Applied Optics 28:4735-4738
192
+ [3] Fritz Kasten and Andrew Young. "Revised optical air mass tables
193
+ and approximation formula". Applied Optics 28:4735-4738
195
194
196
195
[4] C. Gueymard, "Critical analysis and performance assessment of
197
- clear sky solar irradiance models using theoretical and measured data,"
198
- Solar Energy, vol. 51, pp. 121-138, 1993.
196
+ clear sky solar irradiance models using theoretical and measured
197
+ data," Solar Energy, vol. 51, pp. 121-138, 1993.
199
198
200
199
[5] A. T. Young, "AIR-MASS AND REFRACTION," Applied Optics, vol. 33,
201
200
pp. 1108-1110, Feb 1994.
202
201
203
202
[6] Keith A. Pickering. "The Ancient Star Catalog". DIO 12:1, 20,
204
203
205
- [7] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein,
206
- "Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis"
204
+ [7] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
205
+ Horizontal Irradiance Clear Sky Models: Implementation and Analysis"
207
206
Sandia Report, (2012).
208
207
'''
209
208
@@ -213,33 +212,33 @@ def relativeairmass(zenith, model='kastenyoung1989'):
213
212
model = model .lower ()
214
213
215
214
if 'kastenyoung1989' == model :
216
- AM = ( 1.0 / (np .cos (zenith_rad ) +
217
- 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 ))) )
215
+ am = (1.0 / (np .cos (zenith_rad ) +
216
+ 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 ))))
218
217
elif 'kasten1966' == model :
219
- AM = 1.0 / (np .cos (zenith_rad ) + 0.15 * ((93.885 - z ) ** - 1.253 ))
218
+ am = 1.0 / (np .cos (zenith_rad ) + 0.15 * ((93.885 - z ) ** - 1.253 ))
220
219
elif 'simple' == model :
221
- AM = 1.0 / np .cos (zenith_rad )
220
+ am = 1.0 / np .cos (zenith_rad )
222
221
elif 'pickering2002' == model :
223
- AM = ( 1.0 / (np .sin (np .radians (90 - z +
224
- 244.0 / (165 + 47.0 * (90 - z ) ** 1.1 )))) )
222
+ am = (1.0 / (np .sin (np .radians (90 - z +
223
+ 244.0 / (165 + 47.0 * (90 - z ) ** 1.1 )))))
225
224
elif 'youngirvine1967' == model :
226
- AM = ( (1.0 / np .cos (zenith_rad )) *
227
- (1 - 0.0012 * ( (1.0 / np .cos (zenith_rad )) ** 2 ) - 1 ) )
225
+ am = ((1.0 / np .cos (zenith_rad )) *
226
+ (1 - 0.0012 * ((1.0 / np .cos (zenith_rad )) ** 2 ) - 1 ))
228
227
elif 'young1994' == model :
229
- AM = ( (1.002432 * ((np .cos (zenith_rad )) ** 2 ) +
230
- 0.148386 * (np .cos (zenith_rad )) + 0.0096467 ) /
231
- (np .cos (zenith_rad ) ** 3 +
232
- 0.149864 * (np .cos (zenith_rad ) ** 2 ) +
233
- 0.0102963 * (np .cos (zenith_rad )) + 0.000303978 ) )
228
+ am = ((1.002432 * ((np .cos (zenith_rad )) ** 2 ) +
229
+ 0.148386 * (np .cos (zenith_rad )) + 0.0096467 ) /
230
+ (np .cos (zenith_rad ) ** 3 +
231
+ 0.149864 * (np .cos (zenith_rad ) ** 2 ) +
232
+ 0.0102963 * (np .cos (zenith_rad )) + 0.000303978 ))
234
233
elif 'gueymard1993' == model :
235
- AM = ( 1.0 / (np .cos (zenith_rad ) +
236
- 0.00176759 * (z )* ((94.37515 - z ) ** - 1.21563 )) )
234
+ am = (1.0 / (np .cos (zenith_rad ) +
235
+ 0.00176759 * (z )* ((94.37515 - z ) ** - 1.21563 )))
237
236
else :
238
237
raise ValueError ('%s is not a valid model for relativeairmass' , model )
239
238
240
239
try :
241
- AM [z > 90 ] = np .nan
240
+ am [z > 90 ] = np .nan
242
241
except TypeError :
243
- AM = np .nan if z > 90 else AM
242
+ am = np .nan if z > 90 else am
244
243
245
- return AM
244
+ return am
0 commit comments