Basic Radiative Transfer CalculationΒΆ

An example of how to do a simple radiative transfer calculation utilizing an atmosphere that has been setup in the example Basic Atmospheric Setup

from radtran.sasktran import SasktranGeneric
from radtran.scan import Scan
from radtran.options import GenericOptions

from atmosphere_ex_1 import setup_atmosphere
import matplotlib.pyplot as plt
import numpy as np

def radtran_calculation():

    #use setup atmosphere example generate an atmosphere
    atmo = setup_atmosphere()

    #setup a simple limb geometry
    scan = Scan()
    altitudes = np.arange(10,90,2)
    scan.make_scan_saa(sza=70, saa=0, lat=0, lon=0, tanalts_km=altitudes, mjd=54372.5, locallook=0)

    #setup some radiative transfer options
    hr_options = GenericOptions()
    hr_options.add_option('setsun', scan.sun)

    #create the engine, add the atmosphere and the options
    hr_engine = SasktranGeneric(atmo, 'HR', hr_options)

    #add the instrument lines of sight
    for obs, los, mjd in zip(scan.obs, scan.look, scan.mjd):
        hr_engine.add_line_of_sight(obs, los, mjd)

    #set the wavelengths and calculate radiance
    wavelengths = np.array([340])
    rad = hr_engine.calculate_radiance()[0]

    plt.plot(rad[:,0], altitudes)

    return hr_engine