Balloon Measurement Simulation

Simulation of a measurement from a balloon.

from ali.instrument.simulator import ImagingSimulator
from ali.instrument.sensor import ALISensor
import sasktran as sk
import numpy as np
from ali.diagnostics.diagnostics import plot_sampling
from ali.util.geometry import optical_axis_from_geometry


def balloon_measurement_simulation():
    """
    Basic simulation of an ALI measurement from a balloon platform.
    """

    # define balloon geometry
    time = '2014-12-07T17:30'
    latitude = 40.0
    longitude = -120.0
    solar_scattering_angle = 60.0
    solar_zenith_angle = 70.0
    azimuth_angle = 60.0
    balloon_altitude = 30.0
    boresight_tangent_altitude = 12.5

    mjd = (np.datetime64(time) - np.datetime64('1858-11-17')) / np.timedelta64(1, 'D')
    optical_geometry = []
    sensors = []
    wavelengths = [np.array([1100.0])]
    exposure_time = 1.0

    options = dict()
    options['grid_spacing'] = 500.0
    options['polarization'] = True

    atmosphere = sk.Atmosphere()
    atmosphere['ozone'] = sk.Species(sk.O3DBM(), sk.Labow())
    atmosphere['air'] = sk.Species(sk.Rayleigh(), sk.MSIS90())
    atmosphere['aerosol'] = sk.SpeciesAerosolGloSSAC()
    atmosphere.brdf = sk.Lambertian(0.5)

    ncols = 50
    nrows = 50

    for lat, wavel in zip([45.0], wavelengths):

        geom = sk.VerticalImage()
        geom.from_sza_ssa(sza=solar_zenith_angle, ssa=solar_scattering_angle, lat=latitude, lon=longitude,
                          tanalts_km=(boresight_tangent_altitude,), mjd=mjd, locallook=azimuth_angle,
                          satalt_km=balloon_altitude, refalt_km=boresight_tangent_altitude)
        optical_geometry.append(optical_axis_from_geometry(geom))
        ali = ALISensor(wavelength_nm=wavel, num_columns=ncols, num_rows=nrows, image_vert_fov=5.0, image_horiz_fov=5.0)
        ali.ccd = 'raptorowl640n'
        ali.ccd_temperature = 273.0
        ali.add_dark_current = True
        ali.add_noise = True
        ali.add_adc = True
        ali.exposure_time = exposure_time
        sensors.append(ali)
        sensors[0].turn_rotator_on()

    sim = ImagingSimulator(sensors=sensors, optical_axis=optical_geometry,
                           atmosphere=atmosphere, options=options)
    sim.random_seed = 0
    sim.save_diagnostics = True
    data = sim.calculate_radiance()

    sensor = sim.sensors[0]
    plot_sampling(sensor, sensor.diagnostics, sim.diagnostics['sensor']['samples'][0], wavels=[1100.0])


if __name__ == '__main__':
    balloon_measurement_simulation()
../../_images/simulated_image.png