Add a user defined profileΒΆ

An example of how to setup a simple 1 dimensional (varies only in height) atmosphere that includes a user defined profile that can be changed later

from radtran.atmosphere import Atmosphere
from radtran.climatologies import background, ozone, no2, aerosol
import numpy as np

def setup_atmosphere():
    #create an atmosphere - we will add species to this, then give it to the
    #radiative transfer model
    atmo = Atmosphere()

    #create a background climatology from msis90 and add it to the atmosphere
    clim, optprop, guid = background.msis()
    atmo.add_species( clim, optprop, guid )

    #set this at the background climatology, other species may use the pressure
    #and temperature from the background to determine cross sections
    atmo.backgroundclim = clim

    #create an unrealistic ozone profile
    profile = np.ones(101)*1e10            #cm^-3
    altitudes = np.arange(0.0,100500,1000) #m

    #create an ozone optical property using the DBM ozone cross section
    #this is a convenient way to get the optprop and guid, but we won't use
    #use our own climatology
    clim, optprop, guid = ozone.labow('O3_DBM')

    #add our user created profile, the optical properties and guid
    #give it the name 'limb_ozone' which we can use to modify it later
    atmo.add_user_defined(guid,optprop,altitudes,profile,ident='limb_ozone')

    #modify the ozone profile, then check it has changed
    profile *= 2
    atmo.modify_user_defined('limb_ozone',profile)
    altitudes, profile = atmo.get_user_defined('limb_ozone')

    return atmo