@@ -22,8 +22,8 @@ def pres2alt(pressure):
22
22
23
23
Parameters
24
24
----------
25
- Pressure : scalar or Series
26
- Atomspheric pressure (Pascals)
25
+ pressure : scalar or Series
26
+ Atmospheric pressure (Pascals)
27
27
28
28
Returns
29
29
-------
@@ -100,7 +100,7 @@ def alt2pres(altitude):
100
100
101
101
102
102
103
- def absoluteairmass (AMrelative , pressure = 101325. ):
103
+ def absoluteairmass (airmass_relative , pressure = 101325. ):
104
104
'''
105
105
Determine absolute (pressure corrected) airmass from relative
106
106
airmass and pressure
@@ -117,7 +117,7 @@ def absoluteairmass(AMrelative, pressure=101325.):
117
117
Parameters
118
118
----------
119
119
120
- AMrelative : scalar or Series
120
+ airmass_relative : scalar or Series
121
121
The airmass at sea-level.
122
122
123
123
pressure : scalar or Series
@@ -136,13 +136,12 @@ def absoluteairmass(AMrelative, pressure=101325.):
136
136
137
137
'''
138
138
139
- AMa = AMrelative * pressure / 101325.
140
-
141
- return AMa
139
+ airmass_absolute = airmass_relative * pressure / 101325.
142
140
141
+ return airmass_absolute
143
142
144
143
145
- def relativeairmass (z , model = 'kastenyoung1989' ):
144
+ def relativeairmass (zenith , model = 'kastenyoung1989' ):
146
145
'''
147
146
Gives the relative (not pressure-corrected) airmass
148
147
@@ -155,17 +154,20 @@ def relativeairmass(z, model='kastenyoung1989'):
155
154
Parameters
156
155
----------
157
156
158
- z : float or DataFrame
157
+ zenith : float or Series
159
158
Zenith angle of the sun in degrees.
160
159
Note that some models use the apparent (refraction corrected)
161
- zenith angle, and some models use the true (not refraction-corrected)
162
- zenith angle. See model descriptions to determine which type of zenith
163
- angle is required. Apparent zenith angles must be calculated at sea level.
160
+ zenith angle, and some models use the true
161
+ (not refraction-corrected) zenith angle.
162
+ See model descriptions to determine which type of zenith
163
+ angle is required.
164
+ Apparent zenith angles must be calculated at sea level.
164
165
165
166
model : String
166
167
Available models include the following:
167
168
168
- * 'simple' - secant(apparent zenith angle) - Note that this gives -inf at zenith=90
169
+ * 'simple' - secant(apparent zenith angle) -
170
+ Note that this gives -inf at zenith=90
169
171
* 'kasten1966' - See reference [1] - requires apparent sun zenith
170
172
* 'youngirvine1967' - See reference [2] - requires true sun zenith
171
173
* 'kastenyoung1989' - See reference [3] - requires apparent sun zenith
@@ -175,7 +177,7 @@ def relativeairmass(z, model='kastenyoung1989'):
175
177
176
178
Returns
177
179
-------
178
- AM : float or DataFrame
180
+ airmass_relative : float or Series
179
181
Relative airmass at sea level. Will return NaN values for any
180
182
zenith angle greater than 90 degrees.
181
183
@@ -207,27 +209,38 @@ def relativeairmass(z, model='kastenyoung1989'):
207
209
Sandia Report, (2012).
208
210
'''
209
211
212
+ z = zenith
210
213
zenith_rad = np .radians (z )
211
214
212
215
model = model .lower ()
213
216
214
217
if 'kastenyoung1989' == model :
215
- AM = 1.0 / (np .cos (zenith_rad ) + 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 )))
218
+ AM = ( 1.0 / (np .cos (zenith_rad ) +
219
+ 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 ))) )
216
220
elif 'kasten1966' == model :
217
221
AM = 1.0 / (np .cos (zenith_rad ) + 0.15 * ((93.885 - z ) ** - 1.253 ))
218
222
elif 'simple' == model :
219
223
AM = 1.0 / np .cos (zenith_rad )
220
224
elif 'pickering2002' == model :
221
- AM = 1.0 / (np .sin (np .radians (90 - z + 244.0 / (165 + 47.0 * (90 - z ) ** 1.1 ))))
225
+ AM = ( 1.0 / (np .sin (np .radians (90 - z +
226
+ 244.0 / (165 + 47.0 * (90 - z ) ** 1.1 )))) )
222
227
elif 'youngirvine1967' == model :
223
- AM = (1.0 / np .cos (zenith_rad )) * (1 - 0.0012 * ( (1.0 / np .cos (zenith_rad )) ** 2 ) - 1 )
228
+ AM = ( (1.0 / np .cos (zenith_rad )) *
229
+ (1 - 0.0012 * ( (1.0 / np .cos (zenith_rad )) ** 2 ) - 1 ) )
224
230
elif 'young1994' == model :
225
- AM = (1.002432 * ((np .cos (zenith_rad )) ** 2 ) + 0.148386 * (np .cos (zenith_rad )) + 0.0096467 ) / (np .cos (zenith_rad ) ** 3 + 0.149864 * (np .cos (zenith_rad ) ** 2 ) + 0.0102963 * (np .cos (zenith_rad )) + 0.000303978 )
231
+ AM = ( (1.002432 * ((np .cos (zenith_rad )) ** 2 ) +
232
+ 0.148386 * (np .cos (zenith_rad )) + 0.0096467 ) /
233
+ (np .cos (zenith_rad ) ** 3 +
234
+ 0.149864 * (np .cos (zenith_rad ) ** 2 ) +
235
+ 0.0102963 * (np .cos (zenith_rad )) + 0.000303978 ) )
226
236
elif 'gueymard1993' == model :
227
- AM = 1.0 / (np .cos (zenith_rad ) + 0.00176759 * (z )* ((94.37515 - z ) ** - 1.21563 ))
237
+ AM = ( 1.0 / (np .cos (zenith_rad ) +
238
+ 0.00176759 * (z )* ((94.37515 - z ) ** - 1.21563 )) )
228
239
else :
229
- pvl_logger .warning ("{} is not a valid model type for relative airmass. The 'kastenyoung1989' model was used." .format (model ))
230
- AM = 1.0 / (np .cos (zenith_rad ) + 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 )))
240
+ pvl_logger .warning ("{} is not a valid model type for relative airmass. The 'kastenyoung1989' model was used."
241
+ .format (model ))
242
+ AM = ( 1.0 / (np .cos (zenith_rad ) +
243
+ 0.50572 * (((6.07995 + (90 - z )) ** - 1.6364 ))) )
231
244
232
245
try :
233
246
AM [z > 90 ] = np .nan
0 commit comments