# The `pyspectral` API

## Blackbody radiation

Planck radiation equation.

pyspectral.blackbody.blackbody(wavel, temp)

  Derive the Planck radiation as a function of wavelength.

  SI units. blackbody(wavelength, temperature) wavel = Wavelength or a sequence of wavelengths (m) temp = Temperature (scalar) or a sequence of temperatures (K)

  Output: The spectral radiance per meter (not micron!)

    Unit = W/m^2 sr^-1 m^-1

pyspectral.blackbody.blackbody_rad2temp(wavelength, radiance)

  Derive brightness temperatures from radiance using the Planck function.

  Wavelength space. Assumes SI units as input and returns temperature in Kelvin

pyspectral.blackbody.blackbody_wn(wavenumber, temp)

  Derive the Planck radiation as a function of wavenumber.

  SI units. blackbody_wn(wavnum, temperature) wavenumber = A wavenumber (scalar) or a sequence of wave numbers (m-1) temp = A temperatfure (scalar) or a sequence of temperatures (K)

  Output: The spectral radiance in Watts per square meter per steradian

    per m-1: Unit = W/m^2 sr^-1 (m^-1)^-1 = W/m sr^-1

    Converting from SI units to mW/m^2 sr^-1 (cm^-1)^-1: 1.0 W/m^2 sr^-1 (m^-1)^-1 = 0.1 mW/m^2 sr^-1 (cm^-1)^-1

pyspectral.blackbody.blackbody_wn_rad2temp(wavenumber, radiance)

  Derive brightness temperatures from radiance using the Planck function.

  Wavenumber space

pyspectral.blackbody.planck(wave, temperature, wavelength=True)

  Derive the Planck radiation as a function of wavelength or wavenumber.

  SI units. _planck(wave, temperature, wavelength=True) wave = Wavelength/wavenumber or a sequence of wavelengths/wavenumbers (m or m^-1) temp = Temperature (scalar) or a sequence of temperatures (K)

  Output: Wavelength space: The spectral radiance per meter (not micron!)

    Unit = W/m^2 sr^-1 m^-1

    Wavenumber space: The spectral radiance in Watts per square meter per steradian per m-1: Unit = W/m^2 sr^-1 (m^-1)^-1 = W/m sr^-1

    Converting from SI units to mW/m^2 sr^-1 (cm^-1)^-1: 1.0 W/m^2 sr^-1 (m^-1)^-1 = 1.0e5 mW/m^2 sr^-1 (cm^-1)^-1

## Spectral responses

Base class for reading raw instrument spectral responses.

class pyspectral.raw_reader.InstrumentRSR(bandname, platform_name, bandnames=None)

  Bases: `object`

  Base class for the raw (agency dependent) instrument response functions.

## Solar irradiance

Read solar irradiances and calculate solar flux.

Module to read solar irradiance spectra and calculate the solar flux over various instrument bands given their relative spectral response functions

class pyspectral.solar.SolarIrradianceSpectrum(filename, **options)

  Bases: `object`

  Total Top of Atmosphere (TOA) Solar Irradiance Spectrum.

  Wavelength is in units of microns (10^-6 m). The spectral Irradiance in the file TOTAL_IRRADIANCE_SPECTRUM_2000ASTM is in units of W/m^2/micron

  convert2wavenumber()

    Convert from wavelengths to wavenumber.

    Units:

      Wavelength: micro meters (1e-6 m) Wavenumber: cm-1

  inband_solarflux(rsr, scale=1.0, **options)

    Get the in band solar flux.

    Derive the inband solar flux for a given instrument relative spectral response valid for an earth-sun distance of one AU.

  inband_solarirradiance(rsr, scale=1.0, **options)

    Get the in band solar irradiance.

    Derive the inband solar irradiance for a given instrument relative spectral response valid for an earth-sun distance of one AU.

    (Same as the in band solar flux).

  interpolate(**options)

    Interpolate Irradiance to a specified evenly spaced resolution/grid.

    This is necessary to make integration and folding (with a channel relative spectral response) straightforward.

    dlambda = wavelength interval in microns start = Start of the wavelength interval (left/lower) end = End of the wavelength interval (right/upper end) options: dlambda: Delta wavelength used when interpolating/resampling ival_wavelength: Tuple. The start and end interval in wavelength space, defining where to integrate/convolute the spectral response curve on the spectral irradiance data.

  plot(plotname=None, **options)

    Plot the data.

  solar_constant()

    Calculate the solar constant.

## Near-Infrared reflectance

## Rayleigh scattering

## Utils