Пример #1
0
def main():
    p = ArgumentParser(description='Lowtran 7 interface')
    p.add_argument('-z',
                   '--obsalt',
                   help='altitude of observer [km]',
                   type=float,
                   default=0.)
    p.add_argument('-a',
                   '--zenang',
                   help='Observer zenith angle [deg] ',
                   nargs='+',
                   type=float,
                   default=[0., 60, 80])
    p.add_argument('-s',
                   '--short',
                   help='shortest wavelength nm ',
                   type=float,
                   default=400)
    p.add_argument('-l',
                   '--long',
                   help='longest wavelength nm ',
                   type=float,
                   default=700)
    p.add_argument('-step',
                   help='wavelength step size cm^-1',
                   type=float,
                   default=20)
    p.add_argument('-o', '--outfn', help='NetCDF4 file to write')
    p.add_argument('--model',
                   help='0-6, see Card1 "model" reference. 5=subarctic winter',
                   type=int,
                   default=5)

    P = p.parse_args()

    c1 = {
        'model': P.model,
        'h1': P.obsalt,  # of observer
        'angle': P.zenang,  # of observer
        'wlshort': P.short,
        'wllong': P.long,
        'wlstep': P.step,
    }
    # %%
    TR = lowtran.scatter(c1)
    # %%
    if P.outfn:
        outfn = Path(P.outfn).expanduser()
        print('writing', outfn)
        TR.to_netcdf(outfn)


# %%
    plotscatter(TR, c1)

    show()
Пример #2
0
def test_scatter():
    angles = 60

    c1 = {'model': 5,
          'h1': 0,  # of observer
          'angle': angles,  # of observer
          'wlshort': 400,
          'wllong':  700,
          'wlstep': 20,
          }
# %%
    TR = lowtran.scatter(c1)

    assert TR.wavelength_nm[[0, -1]].values == approx((700.035, 400.), rel=0.001)
    assert TR['transmission'][0, [0, -1], 0].values == approx([0.876713, 0.488109], rel=1e-4)
    assert TR['pathscatter'][0, [-10, -1], 0].values == approx([0.005474, 0.00518], rel=1e-4)
Пример #3
0
def test_scatter():
    vlim = (400, 700)
    angles = 60

    c1 = {'model': 5,
          'h1': 0,  # of observer
          'angle': angles,  # of observer
          'wlnmlim': vlim,
          }
# %%
    TR = lowtran.scatter(c1)

    assert_allclose(TR.wavelength_nm[[0, -1]], (700.035, 400.), rtol=1e-6)
    assert_allclose(TR['transmission'][0, [0, -1], 0],
                    [0.876713, 0.4884], rtol=1e-6)
    assert_allclose(TR['pathscatter'][0, [-10, -1], 0],
                    [0.005259, 0.005171], rtol=1e-4)
Пример #4
0
               help='0-6, see Card1 "model" reference. 5=subarctic winter',
               type=int,
               default=3)

P = p.parse_args()

c1 = {
    'model': P.model,
    'h1': P.obsalt,  # of observer
    'angle': P.zenang,  # of observer
    'wlshort': P.short,
    'wllong': P.long,
    'wlstep': P.step,
}

TR = lowtran.scatter(c1)
if P.outfn:
    outfn = Path(P.outfn).expanduser()
    print('writing', outfn)
    TR.to_netcdf(outfn)

plotscatter(TR, c1)
show()

#%%
"""
For Irradiance, the zenith angle is locked to the zenith angle of the sun.
Implicitly, your sensor is looking at the sun and that's the only choice per
Lowtran manual p. 36 s3.2.3.1
"""
from matplotlib.pyplot import show