@@ -22,8 +22,8 @@ def pres2alt(pressure):
2222
2323 Parameters
2424 ----------
25- Pressure : scalar or Series
26- Atomspheric pressure (Pascals)
25+ pressure : scalar or Series
26+ Atmospheric pressure (Pascals)
2727
2828 Returns
2929 -------
@@ -100,7 +100,7 @@ def alt2pres(altitude):
100100
101101
102102
103- def absoluteairmass (AMrelative , pressure = 101325. ):
103+ def absoluteairmass (airmass_relative , pressure = 101325. ):
104104 '''
105105 Determine absolute (pressure corrected) airmass from relative
106106 airmass and pressure
@@ -117,7 +117,7 @@ def absoluteairmass(AMrelative, pressure=101325.):
117117 Parameters
118118 ----------
119119
120- AMrelative : scalar or Series
120+ airmass_relative : scalar or Series
121121 The airmass at sea-level.
122122
123123 pressure : scalar or Series
@@ -136,13 +136,12 @@ def absoluteairmass(AMrelative, pressure=101325.):
136136
137137 '''
138138
139- AMa = AMrelative * pressure / 101325.
140-
141- return AMa
139+ airmass_absolute = airmass_relative * pressure / 101325.
142140
141+ return airmass_absolute
143142
144143
145- def relativeairmass (z , model = 'kastenyoung1989' ):
144+ def relativeairmass (zenith , model = 'kastenyoung1989' ):
146145 '''
147146 Gives the relative (not pressure-corrected) airmass
148147
@@ -155,17 +154,20 @@ def relativeairmass(z, model='kastenyoung1989'):
155154 Parameters
156155 ----------
157156
158- z : float or DataFrame
157+ zenith : float or Series
159158 Zenith angle of the sun in degrees.
160159 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.
164165
165166 model : String
166167 Available models include the following:
167168
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
169171 * 'kasten1966' - See reference [1] - requires apparent sun zenith
170172 * 'youngirvine1967' - See reference [2] - requires true sun zenith
171173 * 'kastenyoung1989' - See reference [3] - requires apparent sun zenith
@@ -175,7 +177,7 @@ def relativeairmass(z, model='kastenyoung1989'):
175177
176178 Returns
177179 -------
178- AM : float or DataFrame
180+ airmass_relative : float or Series
179181 Relative airmass at sea level. Will return NaN values for any
180182 zenith angle greater than 90 degrees.
181183
@@ -207,27 +209,38 @@ def relativeairmass(z, model='kastenyoung1989'):
207209 Sandia Report, (2012).
208210 '''
209211
212+ z = zenith
210213 zenith_rad = np .radians (z )
211214
212215 model = model .lower ()
213216
214217 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 ))) )
216220 elif 'kasten1966' == model :
217221 AM = 1.0 / (np .cos (zenith_rad ) + 0.15 * ((93.885 - z ) ** - 1.253 ))
218222 elif 'simple' == model :
219223 AM = 1.0 / np .cos (zenith_rad )
220224 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 )))) )
222227 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 ) )
224230 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 ) )
226236 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 )) )
228239 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 ))) )
231244
232245 try :
233246 AM [z > 90 ] = np .nan
0 commit comments