@@ -83,7 +83,7 @@ def to_int_dP_ATMOSPHERE_1976(Z, dT):
83
83
return atm .g * atm .rho
84
84
85
85
class ATMOSPHERE_1976 :
86
- r''' US Standard Atmosphere 1976 class, which calculates `T`, `P`,
86
+ r""" US Standard Atmosphere 1976 class, which calculates `T`, `P`,
87
87
`rho`, `v_sonic`, `mu`, `k`, and `g` as a function of altitude above
88
88
sea level. Designed to provide reasonable results up to an elevation
89
89
of 86,000 m (0.4 Pa). The model is also valid under sea level, to
@@ -140,7 +140,7 @@ class ATMOSPHERE_1976:
140
140
.. [3] Yager, Robert J. "Calculating Atmospheric Conditions (Temperature,
141
141
Pressure, Air Density, and Speed of Sound) Using C++," June 2013.
142
142
http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA588839
143
- '''
143
+ """
144
144
145
145
def __init__ (self , Z , dT = 0.0 ):
146
146
self .Z = Z
@@ -174,10 +174,10 @@ def __init__(self, Z, dT=0.0):
174
174
175
175
@staticmethod
176
176
def _get_ind_from_H (H ):
177
- r''' Method defined in the US Standard Atmosphere 1976 for determining
177
+ r""" Method defined in the US Standard Atmosphere 1976 for determining
178
178
the index of the layer a specified elevation is above. Levels are
179
179
0, 11E3, 20E3, 32E3, 47E3, 51E3, 71E3, 84852 meters respectively.
180
- '''
180
+ """
181
181
if H <= 0.0 :
182
182
return 0
183
183
for ind , Hi in enumerate (H_std ):
@@ -187,7 +187,7 @@ def _get_ind_from_H(H):
187
187
188
188
@staticmethod
189
189
def thermal_conductivity (T ):
190
- r''' Method defined in the US Standard Atmosphere 1976 for calculating
190
+ r""" Method defined in the US Standard Atmosphere 1976 for calculating
191
191
thermal conductivity of air as a function of `T` only.
192
192
193
193
.. math::
@@ -203,13 +203,13 @@ def thermal_conductivity(T):
203
203
-------
204
204
kg : float
205
205
Thermal conductivity, [W/m/K]
206
- '''
206
+ """
207
207
# 10**(-12./T) = exp(-12*log(10)/T) = -27.63102111...
208
208
return 2.64638E-3 * T * sqrt (T )/ (T + 245.4 * exp (- 27.63102111592855 / T ))
209
209
210
210
@staticmethod
211
211
def viscosity (T ):
212
- r''' Method defined in the US Standard Atmosphere 1976 for calculating
212
+ r""" Method defined in the US Standard Atmosphere 1976 for calculating
213
213
viscosity of air as a function of `T` only.
214
214
215
215
.. math::
@@ -224,12 +224,12 @@ def viscosity(T):
224
224
-------
225
225
mug : float
226
226
Viscosity, [Pa*s]
227
- '''
227
+ """
228
228
return 1.458E-6 * T * sqrt (T )/ (T + 110.4 )
229
229
230
230
@staticmethod
231
231
def density (T , P ):
232
- r''' Method defined in the US Standard Atmosphere 1976 for calculating
232
+ r""" Method defined in the US Standard Atmosphere 1976 for calculating
233
233
density of air as a function of `T` and `P`. MW is defined as 28.9644
234
234
g/mol, and R as 8314.32 J/kmol/K
235
235
@@ -247,13 +247,13 @@ def density(T, P):
247
247
-------
248
248
rho : float
249
249
Mass density, [kg/m^3]
250
- '''
250
+ """
251
251
# 0.00348367635597379 = M0/R
252
252
return P * 0.00348367635597379 / T
253
253
254
254
@staticmethod
255
255
def sonic_velocity (T ):
256
- r''' Method defined in the US Standard Atmosphere 1976 for calculating
256
+ r""" Method defined in the US Standard Atmosphere 1976 for calculating
257
257
the speed of sound in air as a function of `T` only.
258
258
259
259
.. math::
@@ -268,13 +268,13 @@ def sonic_velocity(T):
268
268
-------
269
269
c : float
270
270
Speed of sound, [m/s]
271
- '''
271
+ """
272
272
# 401.87... = gamma*R/MO
273
273
return sqrt (401.87430086589046 * T )
274
274
275
275
@staticmethod
276
276
def gravity (Z ):
277
- r''' Method defined in the US Standard Atmosphere 1976 for calculating
277
+ r""" Method defined in the US Standard Atmosphere 1976 for calculating
278
278
the gravitational acceleration above earth as a function of elevation
279
279
only.
280
280
@@ -290,13 +290,13 @@ def gravity(Z):
290
290
-------
291
291
g : float
292
292
Acceleration due to gravity, [m/s^2]
293
- '''
293
+ """
294
294
x0 = (r0 / (r0 + Z ))
295
295
return g0 * x0 * x0
296
296
297
297
@staticmethod
298
298
def pressure_integral (T1 , P1 , dH ):
299
- r''' Method to compute an integral of the pressure differential of an
299
+ r""" Method to compute an integral of the pressure differential of an
300
300
elevation difference with a base elevation defined by temperature `T1`
301
301
and pressure `P1`. This is
302
302
similar to subtracting the pressures at two different elevations,
@@ -319,7 +319,7 @@ def pressure_integral(T1, P1, dH):
319
319
-------
320
320
delta_P : float
321
321
Pressure difference between the elevations, [Pa]
322
- '''
322
+ """
323
323
# Compute the elevation to obtain the pressure specified
324
324
H_ref = secant (H_for_P_ATMOSPHERE_1976_err , x0 = 10.0 , low = - 610.0 , high = 86000.0 , bisection = True , args = (P1 ,))
325
325
@@ -331,7 +331,7 @@ def pressure_integral(T1, P1, dH):
331
331
332
332
333
333
class ATMOSPHERE_NRLMSISE00 :
334
- r''' NRLMSISE 00 model for calculating temperature and density of gases in
334
+ r""" NRLMSISE 00 model for calculating temperature and density of gases in
335
335
the atmosphere, from ground level to 1000 km, as a function of time of year,
336
336
longitude and latitude, solar activity and earth's geomagnetic disturbance.
337
337
@@ -443,7 +443,7 @@ class ATMOSPHERE_NRLMSISE00:
443
443
11, no. 7 (July 1, 2013): 394-406. doi:10.1002/swe.20064.
444
444
.. [3] Natalia Papitashvili. "NRLMSISE-00 Atmosphere Model." Accessed
445
445
November 27, 2016. http://ccmc.gsfc.nasa.gov/modelweb/models/nrlmsise00.php.
446
- '''
446
+ """
447
447
448
448
components = ['N2' , 'O2' , 'Ar' , 'He' , 'O' , 'H' , 'N' ]
449
449
atrrs = ['N2_density' , 'O2_density' , 'Ar_density' , 'He_density' ,
@@ -518,7 +518,7 @@ def to_int_airmass(Z, c1, c2, angle_term, R_planet_inv, func):
518
518
return rho * t3
519
519
520
520
def airmass (func , angle , H_max = 86400.0 , R_planet = 6.371229E6 , RI = 1.000276 ):
521
- r''' Calculates mass of air per square meter in the atmosphere using a
521
+ r""" Calculates mass of air per square meter in the atmosphere using a
522
522
provided atmospheric model. The lowest air mass is calculated straight up;
523
523
as the angle is lowered to nearer and nearer the horizon, the air mass
524
524
increases, and can approach 40x or more the minimum airmass.
@@ -565,7 +565,7 @@ def airmass(func, angle, H_max=86400.0, R_planet=6.371229E6, RI=1.000276):
565
565
.. [1] Kasten, Fritz, and Andrew T. Young. "Revised Optical Air Mass Tables
566
566
and Approximation Formula." Applied Optics 28, no. 22 (November 15,
567
567
1989): 4735-38. https://doi.org/10.1364/AO.28.004735.
568
- '''
568
+ """
569
569
delta0 = RI - 1.0
570
570
rho0_inv = 1.0 / func (0.0 )
571
571
angle_term = cos (radians (angle ))
@@ -582,7 +582,7 @@ def airmass(func, angle, H_max=86400.0, R_planet=6.371229E6, RI=1.000276):
582
582
583
583
584
584
def earthsun_distance (moment ):
585
- r''' Calculates the distance between the earth and the sun as a function
585
+ r""" Calculates the distance between the earth and the sun as a function
586
586
of date and time. Uses the Reda and Andreas (2004) model described in [1]_,
587
587
originally incorporated into the excellent
588
588
`pvlib library <https://github.com/pvlib/pvlib-python>`_
@@ -644,7 +644,7 @@ def earthsun_distance(moment):
644
644
.. [1] Reda, Ibrahim, and Afshin Andreas. "Solar Position Algorithm for
645
645
Solar Radiation Applications." Solar Energy 76, no. 5 (January 1, 2004):
646
646
577-89. https://doi.org/10.1016/j.solener.2003.12.003.
647
- '''
647
+ """
648
648
from fluids .optional import spa
649
649
delta_t = spa .calculate_deltat (moment .year , moment .month )
650
650
import calendar
@@ -655,7 +655,7 @@ def earthsun_distance(moment):
655
655
656
656
def solar_position (moment , latitude , longitude , Z = 0.0 , T = 298.15 , P = 101325.0 ,
657
657
atmos_refract = 0.5667 ):
658
- r''' Calculate the position of the sun in the sky. It is defined in terms of
658
+ r""" Calculate the position of the sun in the sky. It is defined in terms of
659
659
two angles - the zenith and the azimith. The azimuth tells where a sundial
660
660
would see the sun as coming from; the zenith tells how high in the sky it
661
661
is. The solar elevation angle is returned for convenience; it is the
@@ -766,7 +766,7 @@ def solar_position(moment, latitude, longitude, Z=0.0, T=298.15, P=101325.0,
766
766
.. [2] "Navigation - What Azimuth Description Systems Are in Use? -
767
767
Astronomy Stack Exchange."
768
768
https://astronomy.stackexchange.com/questions/237/what-azimuth-description-systems-are-in-use?rq=1.
769
- '''
769
+ """
770
770
import calendar
771
771
772
772
from fluids .optional import spa
@@ -788,7 +788,7 @@ def solar_position(moment, latitude, longitude, Z=0.0, T=298.15, P=101325.0,
788
788
789
789
790
790
def sunrise_sunset (moment , latitude , longitude ):
791
- r''' Calculates the times at which the sun is at sunset; sunrise; and
791
+ r""" Calculates the times at which the sun is at sunset; sunrise; and
792
792
halfway between sunrise and sunset (transit).
793
793
794
794
Uses the Reda and Andreas (2004) model described in [1]_,
@@ -849,7 +849,7 @@ def sunrise_sunset(moment, latitude, longitude):
849
849
.. [1] Reda, Ibrahim, and Afshin Andreas. "Solar Position Algorithm for
850
850
Solar Radiation Applications." Solar Energy 76, no. 5 (January 1, 2004):
851
851
577-89. https://doi.org/10.1016/j.solener.2003.12.003.
852
- '''
852
+ """
853
853
import calendar
854
854
855
855
from fluids .optional import spa
@@ -909,7 +909,7 @@ def solar_irradiation(latitude, longitude, Z, moment, surface_tilt,
909
909
extraradiation_method = 'spencer' ,
910
910
airmass_model = 'kastenyoung1989' ,
911
911
cache = None ):
912
- r''' Calculates the amount of solar radiation and radiation reflected back
912
+ r""" Calculates the amount of solar radiation and radiation reflected back
913
913
the atmosphere which hits a surface at a specified tilt, and facing a
914
914
specified azimuth.
915
915
@@ -1031,7 +1031,7 @@ def solar_irradiation(latitude, longitude, Z, moment, surface_tilt,
1031
1031
.. [1] Will Holmgren, Calama-Consulting, Tony Lorenzo, Uwe Krien, bmu,
1032
1032
DaCoEx, mayudong, et al. Pvlib/Pvlib-Python: 0.5.1. Zenodo, 2017.
1033
1033
https://doi.org/10.5281/zenodo.1016425.
1034
- '''
1034
+ """
1035
1035
# Atmospheric refraction at sunrise/sunset (0.5667 deg is an often used value)
1036
1036
from fluids .optional .irradiance import get_absolute_airmass , get_relative_airmass , get_total_irradiance , ineichen
1037
1037
0 commit comments