Ejemplo n.º 1
0
def main():
    p = ArgumentParser(description='Lowtran 7 interface')
    p.add_argument(
        'ptfn',
        help=
        'csv file with time,relative humidity [%],ambient temperature [K], total pressure (millibar)',
        nargs='?')
    p.add_argument('-z',
                   '--obsalt',
                   help='altitude of observer [km]',
                   type=float,
                   default=0.05)
    p.add_argument('-s',
                   '--short',
                   help='shortest wavelength nm ',
                   type=float,
                   default=200)
    p.add_argument('-l',
                   '--long',
                   help='longest wavelength nm ',
                   type=float,
                   default=30000)
    p.add_argument('-step',
                   help='wavelength step size cm^-1',
                   type=float,
                   default=20)
    p.add_argument('-o', '--outfn', help='HDF5 file to write')
    P = p.parse_args()

    # %% low-level Lowtran configuration for this scenario, don't change
    c1 = {
        'range_km': P.obsalt,
        'zmdl': P.obsalt,
        'h1': P.obsalt,
        'wlshort': P.short,
        'wllong': P.long,
        'wlstep': P.step,
    }

    TR = lowtran.horizrad(P.ptfn, P.outfn, c1)

    # %% write to HDF5
    if P.outfn:
        outfn = Path(P.outfn).expanduser()
        print('writing', outfn)
        TR.to_netcdf(outfn)

    plotradtime(TR, c1)

    show()
Ejemplo n.º 2
0
                   type=float,
                   default=0.05)
    p.add_argument('-w',
                   '--wavelen',
                   help='wavelength range nm (start,stop)',
                   type=float,
                   nargs=2,
                   default=(200, 30000))
    p.add_argument('-o', '--outfn', help='HDF5 file to write')
    p = p.parse_args()

    # %% low-level Lowtran configuration for this scenario, don't change
    c1 = {
        'range_km': p.obsalt,
        'zmdl': p.obsalt,
        'h1': p.obsalt,
        'wlnmlim': p.wavelen,
    }

    TR = lowtran.horizrad(p.ptfn, p.outfn, c1)

    # %% write to HDF5
    if p.outfn:
        outfn = Path(p.outfn).expanduser()
        print('writing', outfn)
        TR.to_netcdf(outfn)

    plotradtime(TR, c1)

    show()
        TR.to_pandas().to_hdf(str(outfn),TR.name)
 
    return TR

if __name__=='__main__':

    from argparse import ArgumentParser
    p = ArgumentParser(description='Lowtran 7 interface')
    p.add_argument('ptfn',help='csv file with time,relative humidity [%],ambient temperature [K], total pressure (millibar)',nargs='?')
    p.add_argument('-z','--obsalt',help='altitude of observer [km]',type=float,default=0.05)
    p.add_argument('-a','--zenang',help='zenith angle [deg]  can be single value or list of values',type=float,default=0.)
    p.add_argument('-w','--wavelen',help='wavelength range nm (start,stop)',type=float,nargs=2,default=(200,30000))
    p.add_argument('-o','--outfn',help='NetCDF4 file to write')
    p=p.parse_args()
    
    #%% low-level Lowtran configuration for this scenario, don't change
    c1={'model':0, # 0: user meterological data
        'itype':1, # 1: horizontal path
        'iemsct':1, # 1: radiance model
        'im': 1, # 1: for horizontal path (see Lowtran manual p.42)
        'ird1': 1, # 1: use card 2C2
        'range_km':p.obsalt,
        'zmdl':p.obsalt,
        }
    
    TR = horizrad(p.ptfn,p.outfn,p.obsalt,p.zenang,p.wavelen,c1)  
    
    plotradtime(TR, p.zenang, c1)

    show()