def get_relative_airmass(altitude, model='<STR_LIT>'):
if altitude < <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>alt_rad = math.radians(altitude)<EOL>model = model.lower()<EOL>if '<STR_LIT>' == model:<EOL><INDENT>am = (<NUM_LIT:1.0> / (math.sin(alt_rad) +<EOL><NUM_LIT>*(((<NUM_LIT> + altitude) ** - <NUM_LIT>))))<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>am = <NUM_LIT:1.0> / (math.sin(alt_rad) + <NUM_LIT>*((<NUM_LIT> + altitude) ** - <NUM_LIT>))<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>am = <NUM_LIT:1.0> / math.sin(altitude)<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>am = (<NUM_LIT:1.0> / (math.sin(math.radians(altitude +<EOL><NUM_LIT> / (<NUM_LIT> + <NUM_LIT> * altitude ** <NUM_LIT>)))))<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>sec_zen = <NUM_LIT:1.0> / math.sin(alt_rad)<EOL>am = sec_zen * (<NUM_LIT:1> - <NUM_LIT> * (sec_zen * sec_zen - <NUM_LIT:1>))<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>am = ((<NUM_LIT>*((math.sin(alt_rad)) ** <NUM_LIT:2>) +<EOL><NUM_LIT>*(math.sin(alt_rad)) + <NUM_LIT>) /<EOL>(math.sin(alt_rad) ** <NUM_LIT:3> +<EOL><NUM_LIT>*(math.sin(alt_rad) ** <NUM_LIT:2>) +<EOL><NUM_LIT>*(math.sin(alt_rad)) + <NUM_LIT>))<EOL><DEDENT>elif '<STR_LIT>' == model:<EOL><INDENT>am = (<NUM_LIT:1.0> / (math.sin(alt_rad) +<EOL><NUM_LIT>*(<NUM_LIT> - altitude)*(<EOL>(<NUM_LIT> - (<NUM_LIT> - altitude)) ** - <NUM_LIT>)))<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>', model)<EOL><DEDENT><DEDENT>return am<EOL>
Gives the relative (not pressure-corrected) airmass.

Gives the airmass at sea-level when given a sun altitude angle (in
degrees). The ``model`` variable allows selection of different
airmass models (described below). If ``model`` is not included or is
not valid, the default model is 'kastenyoung1989'.

Note:
    [1] Fritz Kasten. "A New Table and Approximation Formula for the
    Relative Optical Air Mass". Technical Report 136, Hanover, N.H.:
    U.S. Army Material Command, CRREL.
    [2] A. T. Young and W. M. Irvine, "Multicolor Photoelectric
    Photometry of the Brighter Planets," The Astronomical Journal, vol.
    72, pp. 945-950, 1967.
    [3] Fritz Kasten and Andrew Young. "Revised optical air mass tables
    and approximation formula". Applied Optics 28:4735-4738
    [4] C. Gueymard, "Critical analysis and performance assessment of
    clear sky solar irradiance models using theoretical and measured
    data," Solar Energy, vol. 51, pp. 121-138, 1993.
    [5] A. T. Young, "AIR-MASS AND REFRACTION," Applied Optics, vol. 33,
    pp. 1108-1110, Feb 1994.
    [6] Keith A. Pickering. "The Ancient Star Catalog". DIO 12:1, 20,
    [7] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, "Global
    Horizontal Irradiance Clear Sky Models: Implementation and Analysis"
    Sandia Report, (2012).

Args:
    altitude: numeric
        Altitude angle of the sun in degrees. Note that some models use
        the apparent (refraction corrected) altitude angle, and some
        models use the true (not refraction-corrected) altitude angle. See
        model descriptions to determine which type of altitude angle is
        required. Apparent altitude angles must be calculated at sea level.
    model: string, default 'kastenyoung1989'
        Available models include the following:
        * 'simple' - secant(apparent altitude angle) -
          Note that this gives -inf at altitude=0
        * 'kasten1966' - See reference [1] -
          requires apparent sun altitude
        * 'youngirvine1967' - See reference [2] -
          requires true sun altitude
        * 'kastenyoung1989' - See reference [3] -
          requires apparent sun altitude
        * 'gueymard1993' - See reference [4] -
          requires apparent sun altitude
        * 'young1994' - See reference [5] -
          requries true sun altitude
        * 'pickering2002' - See reference [6] -
          requires apparent sun altitude

Returns:
    airmass_relative: numeric
        Relative airmass at sea level. Will return None for any
        altitude angle smaller than 0 degrees.