Skip to content

Commit 5759231

Browse files
committed
.
1 parent d825c55 commit 5759231

32 files changed

+1154
-1154
lines changed

fluids/atmosphere.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def to_int_dP_ATMOSPHERE_1976(Z, dT):
8383
return atm.g*atm.rho
8484

8585
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`,
8787
`rho`, `v_sonic`, `mu`, `k`, and `g` as a function of altitude above
8888
sea level. Designed to provide reasonable results up to an elevation
8989
of 86,000 m (0.4 Pa). The model is also valid under sea level, to
@@ -140,7 +140,7 @@ class ATMOSPHERE_1976:
140140
.. [3] Yager, Robert J. "Calculating Atmospheric Conditions (Temperature,
141141
Pressure, Air Density, and Speed of Sound) Using C++," June 2013.
142142
http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA588839
143-
'''
143+
"""
144144

145145
def __init__(self, Z, dT=0.0):
146146
self.Z = Z
@@ -174,10 +174,10 @@ def __init__(self, Z, dT=0.0):
174174

175175
@staticmethod
176176
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
178178
the index of the layer a specified elevation is above. Levels are
179179
0, 11E3, 20E3, 32E3, 47E3, 51E3, 71E3, 84852 meters respectively.
180-
'''
180+
"""
181181
if H <= 0.0:
182182
return 0
183183
for ind, Hi in enumerate(H_std):
@@ -187,7 +187,7 @@ def _get_ind_from_H(H):
187187

188188
@staticmethod
189189
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
191191
thermal conductivity of air as a function of `T` only.
192192
193193
.. math::
@@ -203,13 +203,13 @@ def thermal_conductivity(T):
203203
-------
204204
kg : float
205205
Thermal conductivity, [W/m/K]
206-
'''
206+
"""
207207
# 10**(-12./T) = exp(-12*log(10)/T) = -27.63102111...
208208
return 2.64638E-3*T*sqrt(T)/(T + 245.4*exp(-27.63102111592855/T))
209209

210210
@staticmethod
211211
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
213213
viscosity of air as a function of `T` only.
214214
215215
.. math::
@@ -224,12 +224,12 @@ def viscosity(T):
224224
-------
225225
mug : float
226226
Viscosity, [Pa*s]
227-
'''
227+
"""
228228
return 1.458E-6*T*sqrt(T)/(T + 110.4)
229229

230230
@staticmethod
231231
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
233233
density of air as a function of `T` and `P`. MW is defined as 28.9644
234234
g/mol, and R as 8314.32 J/kmol/K
235235
@@ -247,13 +247,13 @@ def density(T, P):
247247
-------
248248
rho : float
249249
Mass density, [kg/m^3]
250-
'''
250+
"""
251251
# 0.00348367635597379 = M0/R
252252
return P*0.00348367635597379/T
253253

254254
@staticmethod
255255
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
257257
the speed of sound in air as a function of `T` only.
258258
259259
.. math::
@@ -268,13 +268,13 @@ def sonic_velocity(T):
268268
-------
269269
c : float
270270
Speed of sound, [m/s]
271-
'''
271+
"""
272272
# 401.87... = gamma*R/MO
273273
return sqrt(401.87430086589046*T)
274274

275275
@staticmethod
276276
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
278278
the gravitational acceleration above earth as a function of elevation
279279
only.
280280
@@ -290,13 +290,13 @@ def gravity(Z):
290290
-------
291291
g : float
292292
Acceleration due to gravity, [m/s^2]
293-
'''
293+
"""
294294
x0 = (r0/(r0+Z))
295295
return g0*x0*x0
296296

297297
@staticmethod
298298
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
300300
elevation difference with a base elevation defined by temperature `T1`
301301
and pressure `P1`. This is
302302
similar to subtracting the pressures at two different elevations,
@@ -319,7 +319,7 @@ def pressure_integral(T1, P1, dH):
319319
-------
320320
delta_P : float
321321
Pressure difference between the elevations, [Pa]
322-
'''
322+
"""
323323
# Compute the elevation to obtain the pressure specified
324324
H_ref = secant(H_for_P_ATMOSPHERE_1976_err, x0=10.0, low=-610.0, high=86000.0, bisection=True, args=(P1,))
325325

@@ -331,7 +331,7 @@ def pressure_integral(T1, P1, dH):
331331

332332

333333
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
335335
the atmosphere, from ground level to 1000 km, as a function of time of year,
336336
longitude and latitude, solar activity and earth's geomagnetic disturbance.
337337
@@ -443,7 +443,7 @@ class ATMOSPHERE_NRLMSISE00:
443443
11, no. 7 (July 1, 2013): 394-406. doi:10.1002/swe.20064.
444444
.. [3] Natalia Papitashvili. "NRLMSISE-00 Atmosphere Model." Accessed
445445
November 27, 2016. http://ccmc.gsfc.nasa.gov/modelweb/models/nrlmsise00.php.
446-
'''
446+
"""
447447

448448
components = ['N2', 'O2', 'Ar', 'He', 'O', 'H', 'N']
449449
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):
518518
return rho*t3
519519

520520
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
522522
provided atmospheric model. The lowest air mass is calculated straight up;
523523
as the angle is lowered to nearer and nearer the horizon, the air mass
524524
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):
565565
.. [1] Kasten, Fritz, and Andrew T. Young. "Revised Optical Air Mass Tables
566566
and Approximation Formula." Applied Optics 28, no. 22 (November 15,
567567
1989): 4735-38. https://doi.org/10.1364/AO.28.004735.
568-
'''
568+
"""
569569
delta0 = RI - 1.0
570570
rho0_inv = 1.0/func(0.0)
571571
angle_term = cos(radians(angle))
@@ -582,7 +582,7 @@ def airmass(func, angle, H_max=86400.0, R_planet=6.371229E6, RI=1.000276):
582582

583583

584584
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
586586
of date and time. Uses the Reda and Andreas (2004) model described in [1]_,
587587
originally incorporated into the excellent
588588
`pvlib library <https://github.com/pvlib/pvlib-python>`_
@@ -644,7 +644,7 @@ def earthsun_distance(moment):
644644
.. [1] Reda, Ibrahim, and Afshin Andreas. "Solar Position Algorithm for
645645
Solar Radiation Applications." Solar Energy 76, no. 5 (January 1, 2004):
646646
577-89. https://doi.org/10.1016/j.solener.2003.12.003.
647-
'''
647+
"""
648648
from fluids.optional import spa
649649
delta_t = spa.calculate_deltat(moment.year, moment.month)
650650
import calendar
@@ -655,7 +655,7 @@ def earthsun_distance(moment):
655655

656656
def solar_position(moment, latitude, longitude, Z=0.0, T=298.15, P=101325.0,
657657
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
659659
two angles - the zenith and the azimith. The azimuth tells where a sundial
660660
would see the sun as coming from; the zenith tells how high in the sky it
661661
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,
766766
.. [2] "Navigation - What Azimuth Description Systems Are in Use? -
767767
Astronomy Stack Exchange."
768768
https://astronomy.stackexchange.com/questions/237/what-azimuth-description-systems-are-in-use?rq=1.
769-
'''
769+
"""
770770
import calendar
771771

772772
from fluids.optional import spa
@@ -788,7 +788,7 @@ def solar_position(moment, latitude, longitude, Z=0.0, T=298.15, P=101325.0,
788788

789789

790790
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
792792
halfway between sunrise and sunset (transit).
793793
794794
Uses the Reda and Andreas (2004) model described in [1]_,
@@ -849,7 +849,7 @@ def sunrise_sunset(moment, latitude, longitude):
849849
.. [1] Reda, Ibrahim, and Afshin Andreas. "Solar Position Algorithm for
850850
Solar Radiation Applications." Solar Energy 76, no. 5 (January 1, 2004):
851851
577-89. https://doi.org/10.1016/j.solener.2003.12.003.
852-
'''
852+
"""
853853
import calendar
854854

855855
from fluids.optional import spa
@@ -909,7 +909,7 @@ def solar_irradiation(latitude, longitude, Z, moment, surface_tilt,
909909
extraradiation_method='spencer',
910910
airmass_model='kastenyoung1989',
911911
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
913913
the atmosphere which hits a surface at a specified tilt, and facing a
914914
specified azimuth.
915915
@@ -1031,7 +1031,7 @@ def solar_irradiation(latitude, longitude, Z, moment, surface_tilt,
10311031
.. [1] Will Holmgren, Calama-Consulting, Tony Lorenzo, Uwe Krien, bmu,
10321032
DaCoEx, mayudong, et al. Pvlib/Pvlib-Python: 0.5.1. Zenodo, 2017.
10331033
https://doi.org/10.5281/zenodo.1016425.
1034-
'''
1034+
"""
10351035
# Atmospheric refraction at sunrise/sunset (0.5667 deg is an often used value)
10361036
from fluids.optional.irradiance import get_absolute_airmass, get_relative_airmass, get_total_irradiance, ineichen
10371037

0 commit comments

Comments
 (0)