11"""
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.
54"""
65
76from __future__ import division
@@ -48,14 +47,12 @@ def pres2alt(pressure):
4847
4948 "A Quick Derivation relating altitude to air pressure" from Portland
5049 State Aerospace Society, Version 1.03, 12/22/2004.
51-
5250 '''
5351
5452 alt = 44331.5 - 4946.62 * pressure ** (0.190263 )
5553 return alt
5654
5755
58-
5956def alt2pres (altitude ):
6057 '''
6158 Determine site pressure from altitude.
@@ -97,17 +94,16 @@ def alt2pres(altitude):
9794 return press
9895
9996
100-
10197def absoluteairmass (airmass_relative , pressure = 101325. ):
10298 '''
10399 Determine absolute (pressure corrected) airmass from relative
104100 airmass and pressure
105101
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
111107
112108 .. math::
113109 absolute airmass = (relative airmass)*pressure/101325
@@ -129,8 +125,8 @@ def absoluteairmass(airmass_relative, pressure=101325.):
129125 References
130126 ----------
131127 [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.
134130
135131 '''
136132
@@ -143,35 +139,38 @@ def relativeairmass(zenith, model='kastenyoung1989'):
143139 '''
144140 Gives the relative (not pressure-corrected) airmass.
145141
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'.
151146
152147 Parameters
153148 ----------
154149
155150 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.
163156
164157 model : String
165158 Available models include the following:
166159
167160 * 'simple' - secant(apparent zenith angle) -
168161 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
175174
176175 Returns
177176 -------
@@ -183,27 +182,27 @@ def relativeairmass(zenith, model='kastenyoung1989'):
183182 ----------
184183
185184 [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.
188187
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.
192191
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
195194
196195 [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.
199198
200199 [5] A. T. Young, "AIR-MASS AND REFRACTION," Applied Optics, vol. 33,
201200 pp. 1108-1110, Feb 1994.
202201
203202 [6] Keith A. Pickering. "The Ancient Star Catalog". DIO 12:1, 20,
204203
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"
207206 Sandia Report, (2012).
208207 '''
209208
@@ -213,33 +212,33 @@ def relativeairmass(zenith, model='kastenyoung1989'):
213212 model = model .lower ()
214213
215214 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 ))))
218217 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 ))
220219 elif 'simple' == model :
221- AM = 1.0 / np .cos (zenith_rad )
220+ am = 1.0 / np .cos (zenith_rad )
222221 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 )))))
225224 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 ))
228227 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 ))
234233 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 )))
237236 else :
238237 raise ValueError ('%s is not a valid model for relativeairmass' , model )
239238
240239 try :
241- AM [z > 90 ] = np .nan
240+ am [z > 90 ] = np .nan
242241 except TypeError :
243- AM = np .nan if z > 90 else AM
242+ am = np .nan if z > 90 else am
244243
245- return AM
244+ return am
0 commit comments