From ee7134da7d6d90def3e8352c7efd4291a1dc0376 Mon Sep 17 00:00:00 2001 From: yosata Date: Wed, 6 Jul 2022 12:19:31 +0200 Subject: [PATCH] Fixed Owens (1967) model --- AstroAtmosphere/refractivityModels.py | 38 ++++++++++++++++++++------- setup.py | 4 +-- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/AstroAtmosphere/refractivityModels.py b/AstroAtmosphere/refractivityModels.py index 76996d1..0a0933f 100644 --- a/AstroAtmosphere/refractivityModels.py +++ b/AstroAtmosphere/refractivityModels.py @@ -174,9 +174,10 @@ def Edlen1966(l, T=288.15, p=101325, RH=0, CO2=300, f=None): def Owens(l, T=288.15, p=101325, RH=0): ''' From Owens, 1967 - Equation 32 - Note that the pressure P and H are in torricelli (Torr), - however, this is almost precisely 1 Torr = 1 mmHg + Equations 29 to 31 + + Code heavily based on ScopeSIM (https://scopesim.readthedocs.io/) + and http://www.caha.es/newsletter/news03b/pedraz/newslet.html Parameters ---------- @@ -194,10 +195,27 @@ def Owens(l, T=288.15, p=101325, RH=0): n : float Refractive index of atmospheric air at the given conditions ''' - P = hPa2mmHg(p/100) - T = K2C(T) - s = 1 / l - R = 8342.13 + 2406030 / (130 - s**2) + 15997 / (38.9 - s**2) * (P/720.775) * ((1 + P * (0.817 - 0.0133) * 1e-6)/(1 + 0.0036610*T)) - RH * (5.722 - 0.0457*s**2) + # Calculation from ScopeSIM.effects.atmospheric_refraction() + pres = p / 100 # from mbar to Pa + Ps = -10474. + 116.43 * T - 0.43284 * T**2 + 0.0005384 * T**3 + Pw = Ps * RH / 100. + Pa = pres - Pw + + # Wavenumber s + s = 1. / l + + # Density factor of dry air, eq. 30 + Da = (Pa / T) * (1. + Pa * (57.9E-8 - 0.0009325 / T + 0.25844 / T**2)) + + # Density factor of moist air, eq. 31 + Dw = (Pw / T) * (1. + Pw * (1. + 3.7E-4 * Pw) * + (-2.37321E-3 + 2.23366 / T - 710.792 / T**2 + + 77514.1 / T**3)) + + # Combining the two into eq. 29 + na = Da * (2371.34 + 683939.7 / (130. - s**2) + 4547.3 / (38.9 - s**2)) + nw = Dw * (6487.31 + 58.058 * s**2 - 0.7115 * s**4 + 0.08851 * s**6) + R = na + nw n = R/1e8 + 1 return n @@ -409,10 +427,10 @@ def slalib(l, T=288.15, p=101325, RH=0, h=0, lat=-24, tlr=0.0065, eps=1e-10): conditions. ''' try: - from pyslalib import slalib + from pyslalib import slalib except ImportError as e: - print('pySLALIB package not found! Try installing it first.\nReturning n=1.') - return 1 + print('pySLALIB package not found! Try installing it first.\nReturning n=1.') + return 1 zObs = np.deg2rad(45.06563) p = p/100 diff --git a/setup.py b/setup.py index 63d7f0b..8d27621 100644 --- a/setup.py +++ b/setup.py @@ -21,14 +21,14 @@ def setup_package(): # write_version_py() setup(name='AstroAtmosphere', - version='1.4.1', + version='1.5', description='Collection of equations for refractive index, refraction and dispersion calculations of atmospheric air.', long_description=__readme__, long_description_content_type='text/markdown', author='Joost van den Born', author_email='born@astron.nl', url='https://gitlab.astro-wise.org/micado/atmosphericmodel', - download_url='https://gitlab.astro-wise.org/micado/atmosphericmodel/-/archive/v1.4.1/atmosphericmodel-v1.4.1.tar.gz', + download_url='https://gitlab.astro-wise.org/micado/atmosphericmodel/-/archive/v1.5/atmosphericmodel-v1.5.tar.gz', license='GNU General Public License v3', data_files = [('',['LICENSE.txt'])], package_dir={'AstroAtmosphere': 'AstroAtmosphere'},