Example #1
0
def active_microwave_rt(state, geom):
    """
    Function that simulates SAR backscattering, given surface biogeophysical variables and viewing geometries
    :param state: instance of StateVector class
    :type state: object
    :param geom: instance of SensorGeometry class
    :type geom: object
    :return: instance of BackScatter class
    """
    backscat = bs.BackScatter()
    backscat.date_sat_ob = []
    backscat.date_land_ob = []
    backscat.soil_moisture = []
    backscat.lai = []
    backscat.can_height = []
    backscat.hh = []
    backscat.hv = []
    backscat.vv = []
    for date_utc in enumerate(geom.date_utc):
        idx, timedelt = sv.find_nearest_date_idx(state.date_utc, date_utc[1])
        SAR = run_sense(state.soil_moisture[idx], state.lai[idx], state.can_height[idx], geom.vza[date_utc[0]])
        backscat.date_sat_ob.append(date_utc[1])
        backscat.date_land_ob.append(state.date_utc[idx])
        backscat.soil_moisture.append(state.soil_moisture[idx])
        backscat.lai.append(state.lai[idx])
        backscat.can_height.append(state.can_height[idx])
        backscat.hh.append(10 * np.log10(SAR.__dict__['stot']['hh']))
        backscat.hv.append(10 * np.log10(SAR.__dict__['stot']['hv']))
        backscat.vv.append(10 * np.log10(SAR.__dict__['stot']['vv']))
    return backscat
def passive_optical_rt(state,
                       geom,
                       mode='fast',
                       rsl1=0.2,
                       sm_coeff=0.5,
                       cab=75.0,
                       cw=0.01):
    """Function that simulates reflectances given surface biogeophysical variables and viewing geometries.

    :param state: Instance of the StateVector class.
    :type state: instance
    :param geom: Instance of the SensorGeometry class.
    :type geom: instance
    :param mode: Run semiDiscrete in either fast ('fast') or slow ('slow') mode [optional].
    :type resln: str
    :param rsl1: weight of the first soil vector
    :type rsl1: float
    :param sm_coeff: weighting of soil moisture impact, bound between (0,1)
    :type sm_coeff: float
    :param cab: leaf chlorophyl concentration
    :type cab: float
    :param cw: equivelant leaf water thickness
    :type cw: float
    :return: Instance of the spectra class.
    :rtype: instance
    """
    spect = sp.spectra()
    spect.date_sat_ob = []
    spect.date_land_ob = []
    spect.soil_moisture = []
    spect.lai = []
    spect.can_height = []
    spect.refl = []

    for date_utc in enumerate(geom.date_utc):
        idx, timedelt = sv.find_nearest_date_idx(state.date_utc, date_utc[1])
        reflectance = run_semidiscrete(state.soil_moisture[idx],
                                       state.lai[idx],
                                       state.can_height[idx],
                                       geom.vza[date_utc[0]],
                                       geom.vaa[date_utc[0]],
                                       geom.sza[date_utc[0]],
                                       geom.saa[date_utc[0]],
                                       mode=mode,
                                       rsl1=rsl1,
                                       sm_coeff=sm_coeff,
                                       cab=cab,
                                       cw=cw)
        spect.date_sat_ob.append(date_utc[1])
        spect.date_land_ob.append(state.date_utc[idx])
        spect.soil_moisture.append(state.soil_moisture[idx])
        spect.lai.append(state.lai[idx])
        spect.can_height.append(state.can_height[idx])
        spect.refl.append(reflectance)
    return spect
def passive_optical_rt(state, geom):
    """A python wrapper to the SemiDiscrete optical
    canopy RT model of Nadine Gobron. Runs the
    model for the the whole of its valid spectra
    range at a resolution set by resln.

    :param state: Instance of the StateVector class.
    :type state: instance
    :param geom: Instance of the SensorGeometry class.
    :type geom: instance
    :param mode: Run semiDiscrete in either fast ('fast') or slow ('slow') mode [optional].
    :type resln: str
    :return: Instance of the spectra class.
    :rtype: instance
    """
    spect = sp.spectra()
    spect.date_sat_ob = []
    spect.date_land_ob = []
    spect.soil_moisture = []
    spect.lai = []
    spect.can_height = []
    spect.refl = []

    for date_utc in enumerate(geom.date_utc):
        idx, timedelt = sv.find_nearest_date_idx(state.date_utc, date_utc[1])
        reflectance = run_semidiscrete(state.soil_moisture[idx],
                                       state.lai[idx], state.can_height[idx],
                                       geom.vza[date_utc[0]],
                                       geom.vaa[date_utc[0]],
                                       geom.sza[date_utc[0]],
                                       geom.saa[date_utc[0]])
        spect.date_sat_ob.append(date_utc[1])
        spect.date_land_ob.append(state.date_utc[idx])
        spect.soil_moisture.append(state.soil_moisture[idx])
        spect.lai.append(state.lai[idx])
        spect.can_height.append(state.can_height[idx])
        spect.refl.append(reflectance)
    return spect
def active_microwave_rt(state,
                        geom,
                        freq=5.405,
                        s=0.015,
                        lai_coeff=0.1,
                        omega=0.1,
                        clay=0.23,
                        sand=0.27,
                        bulk=1.65):
    """
    Function that simulates SAR backscattering, given surface biogeophysical variables and viewing geometries
    :param state: instance of StateVector class
    :type state: object
    :param geom: instance of SensorGeometry class
    :type geom: object
    :param freq: frequency (GHz)
    :type freq: float
    :param s: surface rms height (m)
    :type s: float
    :param lai_coeff: coefficient of lai for which to calculate extinction and volume scattering coefficients
    :type lai_coeff: float
    :param omega: coefficient for calculation of volume scattering coefficients
    :type omega: float
    :param clay: soil texture clay fraction
    :type clay: float
    :param sand: soil texture sand fraction
    :type sand: float
    :param bulk: soil bulk density (g cm-3)
    :type bulk: float
    :return: instance of BackScatter class
    """
    backscat = bs.BackScatter()
    backscat.date_sat_ob = []
    backscat.date_land_ob = []
    backscat.soil_moisture = []
    backscat.lai = []
    backscat.can_height = []
    backscat.hh = []
    backscat.hv = []
    backscat.vv = []
    for date_utc in enumerate(geom.date_utc):
        idx, timedelt = sv.find_nearest_date_idx(state.date_utc, date_utc[1])
        SAR = run_sense(state.soil_moisture[idx],
                        state.lai[idx],
                        state.can_height[idx],
                        geom.vza[date_utc[0]],
                        freq=freq,
                        s=s,
                        lai_coeff=lai_coeff,
                        omega=omega,
                        clay=clay,
                        sand=sand,
                        bulk=bulk)
        backscat.date_sat_ob.append(date_utc[1])
        backscat.date_land_ob.append(state.date_utc[idx])
        backscat.soil_moisture.append(state.soil_moisture[idx])
        backscat.lai.append(state.lai[idx])
        backscat.can_height.append(state.can_height[idx])
        backscat.hh.append(10 * np.log10(SAR.__dict__['stot']['hh']))
        backscat.hv.append(10 * np.log10(SAR.__dict__['stot']['hv']))
        backscat.vv.append(10 * np.log10(SAR.__dict__['stot']['vv']))
    return backscat