Instrument Measurement CalculationΒΆ

An example of how to use an instrument to setup a radiative transfer model, and generate a measurement.

from instrument_ex_1 import imaging_instrument
from atmosphere_ex_1 import setup_atmosphere
from radtran.sasktran import SasktranGeneric
from radtran.options import GenericOptions
import numpy as np
import matplotlib.pyplot as plt

def use_instrument_to_generate_level_1():

    #create the instrument
    ali = imaging_instrument()

    #see radtran_examples.py for details on setting up a radiative transfer engine
    atmo = setup_atmosphere()
    hr_engine = SasktranGeneric(atmo, 'HR', None)
    hr_options = GenericOptions()
    hr_options.add_option('NumOrdersOfScatter',1)

    #get the radiative transfer geometry and wavelengths from the instrument
    los, obs, mjd = ali.radtran_geometry()
    wavel         = ali.radtran_wavelengths()

    #add the instrument lines of sight
    for o, l, m in zip(obs, los, mjd):
        hr_engine.add_line_of_sight(o, l, m[0])

    #set the wavelengths (as an array) and calculate radiance
    hr_engine.set_wavelengths(wavel)
    rad = hr_engine.calculate_radiance()[0]
    l1 = ali.convert_radiance_to_l1(rad)

    #do a rough conversion to rgb and plot results
    n = 200
    m = 100
    plt.pcolor(np.flipud(np.reshape(l1[0][:,0],(n,m))))
    plt.set_cmap('gray')
    plt.show()