
    1i                     \    S r SSKrSSKJrJrJrJrJrJr  \\\S\\\4S jr	\\4S jr
S rg)	z(Various elevation-related calculations

    N   )standard_pressurestandard_temperatureearth_temperature_lapse_rateair_gas_constantearth_gravityearth_atmosphere_molar_massg        c                 j    U S:  a  [         R                  " S5        XX#X-
  -  -   -  Xg-  XS-  -  -  -  $ )aU  This function returns an estimate of the pressure in pascals as a function of
 elevation above sea level.
NOTES:
  * This equation is only accurate up to 11,000 meters
  * results might be odd for elevations below 0 (sea level), like Dead Sea.
h=elevation relative to sea level (m)
Ps= static pressure (pascals)
Ts= temperature (kelvin)
Tl= temperature lapse rate (kelvin/meter)
Hb= height at the bottom of the layer
R= universal gas constant for air
g= gravitational acceleration
M= Molar mass of atmosphere
P = Ps * (Ts / ((Ts + Tl) * (h - Hb))) ^ ((g * M)/(R * Tl))
returns pressure in pascals
g     |@zUElevation used exceeds the recommended maximum elevation for this function (11,000m)
)warningswarn)hPsTsTlHbRgMs           T/var/www/html/motor_solar_iot/venv/lib/python3.13/site-packages/pysolar/elevation.pyget_pressure_with_elevationr      sD      	7{d	 	Bqv&'ae-?@@A    c                     XU-  -   $ )a4  This function returns an estimate of temperature as a function above sea level.
NOTES:
  * This equation is only accurate up to 11,000 meters
  * results might be odd for elevations below 0 (sea level), like Dead Sea.
Ts= temperature (kelvin)
Tl= temperature lapse rate (kelvin/meter)
returns temp in kelvin
 )r   r   r   s      r   get_temperature_with_elevationr   8   s     	U
r   c                      [        S5        Sn [        S5       H.  n[        U 5      n[        U 5      n[        SXU4-  5        U S-  n M0     g )Nz(Elevation(m) Pressure(Pa) Temperature(K)r      z%i %i %ii  )printranger   r   )r   _PTs       r   elevation_testr"   D   sL    	
45	A2Y'**1-jA!9$%	T		 r   )__doc__r   	constantsr   r   r   r   r   r	   r   r   r"   r   r   r   <module>r%      sT   $     '8<PUqvy  ~N  R_  c~ A4 *>B^ 	r   