# Path: geonum/atmosphere.py
# NA = 6.022140857e+23
# T0_STD = 288.15
# M_AIR_AVG = 28.9645
# R_STD = 8.31432
# L_STD_ATM = -6.5e-3
# L_DRY_AIR = -9.8e-3
#     F = F_AIR(lbda_mu, co2_ppm)
#     T1 = 273
#     T2 = 253
# def _g0(phi=0.0):
# def _g_acc(phi, alt):
# def g(lat=45.0, alt=0.0):
# def g0(lat=45.0):
# def temperature(alt=0.0, ref_temp=T0_STD, ref_alt=0.0, lapse_rate=L_STD_ATM):
# def beta_exp(mol_mass=M_AIR_AVG, lapse_rate=L_STD_ATM, lat=45.0):
# def pressure(alt=0.0, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#              lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def pressure_hPa(alt=0.0, *args, **kwargs):
# def pressure2altitude(p, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#                       lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def air_density(alt=0.0, temp=None, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#             lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def air_number_density(alt=0.0, temp=None, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#                    lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def refr_idx_300ppm_co2(lbda_mu=0.300):
# def refr_idx(lbda_mu=0.300, co2_ppm=400.0):
# def _F_N2(lbda_mu=0.300):
# def _F_O2(lbda_mu=0.300):
# def F_AIR(lbda_mu=0.300, co2_ppm=400.0):
# def sigma_rayleigh(lbda_mu=0.300, co2_ppm=400.0):
# def rayleigh_vol_sc_coeff(alt=0.0, lbda_mu=0.300, co2_ppm=400.0, **kwargs):
# def density(*args,**kwargs):
# def number_density(*args,**kwargs):


import pytest
import numpy.testing as npt
    import sys
from geonum import atmosphere as atm

    (atm.p0, atm.p0, 273.15,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,0),
    (50000, atm.p0, 273.15,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,5284.482982),
    (50000, atm.p0, 300,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,5803.935181),

    (atm.p0, atm.p0, atm.T0_STD,100,atm.L_STD_ATM,atm.M_AIR_AVG,45,100),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_DRY_AIR,atm.M_AIR_AVG,45,0),
    (50000, atm.p0, atm.T0_STD,0,atm.L_DRY_AIR,atm.M_AIR_AVG,45,5392.870582),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,20,45,0),
    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,20,45,7840.324557),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,0),
    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,0,0),
    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,90,0),

    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,0,5588.419043),
    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,90,5560.946563),

    ])
def test_pressure2altitude(p, ref_p, ref_temp, ref_alt, lapse_rate, mol_mass, lat, should_be):
    val = atm.pressure2altitude(p, ref_p, ref_temp, ref_alt, lapse_rate,
                                mol_mass, lat)
    npt.assert_allclose(val, should_be, rtol=1e-7)

@pytest.mark.parametrize('alt,temp,ref_p,ref_temp,ref_alt,lapse_rate,mol_mass,lat,should_be', [

    (0,None,atm.p0,atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,1225.0033852145957),
    (100,None,atm.p0,atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,1213.286799),

# Path: geonum/atmosphere.py
# NA = 6.022140857e+23
# T0_STD = 288.15
# M_AIR_AVG = 28.9645
# R_STD = 8.31432
# L_STD_ATM = -6.5e-3
# L_DRY_AIR = -9.8e-3
#     F = F_AIR(lbda_mu, co2_ppm)
#     T1 = 273
#     T2 = 253
# def _g0(phi=0.0):
# def _g_acc(phi, alt):
# def g(lat=45.0, alt=0.0):
# def g0(lat=45.0):
# def temperature(alt=0.0, ref_temp=T0_STD, ref_alt=0.0, lapse_rate=L_STD_ATM):
# def beta_exp(mol_mass=M_AIR_AVG, lapse_rate=L_STD_ATM, lat=45.0):
# def pressure(alt=0.0, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#              lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def pressure_hPa(alt=0.0, *args, **kwargs):
# def pressure2altitude(p, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#                       lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def air_density(alt=0.0, temp=None, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#             lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def air_number_density(alt=0.0, temp=None, ref_p=p0, ref_temp=T0_STD, ref_alt=0.0,
#                    lapse_rate=L_STD_ATM, mol_mass=M_AIR_AVG, lat=45.0):
# def refr_idx_300ppm_co2(lbda_mu=0.300):
# def refr_idx(lbda_mu=0.300, co2_ppm=400.0):
# def _F_N2(lbda_mu=0.300):
# def _F_O2(lbda_mu=0.300):
# def F_AIR(lbda_mu=0.300, co2_ppm=400.0):
# def sigma_rayleigh(lbda_mu=0.300, co2_ppm=400.0):
# def rayleigh_vol_sc_coeff(alt=0.0, lbda_mu=0.300, co2_ppm=400.0, **kwargs):
# def density(*args,**kwargs):
# def number_density(*args,**kwargs):


# Path: geonum/test/test_atmosphere.py
import pytest
import numpy.testing as npt
    import sys
from geonum import atmosphere as atm


    (atm.p0, atm.p0, 273.15,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,0),
    (50000, atm.p0, 273.15,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,5284.482982),
    (50000, atm.p0, 300,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,5803.935181),

    (atm.p0, atm.p0, atm.T0_STD,100,atm.L_STD_ATM,atm.M_AIR_AVG,45,100),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_DRY_AIR,atm.M_AIR_AVG,45,0),
    (50000, atm.p0, atm.T0_STD,0,atm.L_DRY_AIR,atm.M_AIR_AVG,45,5392.870582),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,20,45,0),
    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,20,45,7840.324557),

    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,0),
    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,0,0),
    (atm.p0, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,90,0),

    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,0,5588.419043),
    (50000, atm.p0, atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,90,5560.946563),

    ])
def test_pressure2altitude(p, ref_p, ref_temp, ref_alt, lapse_rate, mol_mass, lat, should_be):
    val = atm.pressure2altitude(p, ref_p, ref_temp, ref_alt, lapse_rate,
                                mol_mass, lat)
    npt.assert_allclose(val, should_be, rtol=1e-7)

@pytest.mark.parametrize('alt,temp,ref_p,ref_temp,ref_alt,lapse_rate,mol_mass,lat,should_be', [

    (0,None,atm.p0,atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,1225.0033852145957),
    (100,None,atm.p0,atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,1213.286799),

    (1000,None,atm.p0,atm.T0_STD,0,atm.L_STD_ATM,atm.M_AIR_AVG,45,1111.65185),