Ejemplo n.º 1
0
    def get_optical_scatterer(self, wavelength):
        """
        Get the optical scatterer out of the microphysics and Mie scattering model for a given wavelength.

        Parameters
        ----------
        wavelength: float of list of floats
            Wavelength in microns.

        Returns
        -------
        scatterer: shdom.OpticalScatterer or shdom.MultispectralScatterer
            An OpticalScatterer object is returned for an input float and a MultispectralScatterer for a list.

        Notes
        -----
        A Mie scattering model must be defined at the input wavelength by use of the add_mie method.
        The input wavelength is rounded to three decimals.
        """
        if isinstance(wavelength, list):
            scatterer_list = [
                shdom.OpticalScatterer(wl, self.get_extinction(wl),
                                       self.get_albedo(wl), self.get_phase(wl))
                for wl in wavelength
            ]
            scatterer = shdom.MultispectralScatterer(scatterer_list)
        else:
            scatterer = shdom.OpticalScatterer(wavelength,
                                               self.get_extinction(wavelength),
                                               self.get_albedo(wavelength),
                                               self.get_phase(wavelength))
        return scatterer
Ejemplo n.º 2
0
    def get_scatterer(self):
        """
        Retrieve a Scatterer from the medium.
    
        Returns
        -------
        scatterer: shdom.Scatterer
            A Scatterer object containing the Rayleigh optical properties on a 1D grid.

        Notes
        -----
        For a single band a shdom.OpticalScatterer is returned and for multiple wavelengths a shdom.MultispectralScatterer object.
        """
        if self.num_wavelengths == 1:
            scatterer = shdom.OpticalScatterer(self.wavelength,
                                               self.extinction, self.albedo,
                                               self.phase)
        else:
            scatterer_list = [
                shdom.OpticalScatterer(wavelength, extinction, albedo, phase) for \
                wavelength, extinction, albedo, phase in zip(self._wavelength, self._extinction, self._albedo, self._phase)
            ]
            scatterer = shdom.MultispectralScatterer(scatterer_list)
        return scatterer
Ejemplo n.º 3
0
    def resample(self, grid):
        """
        The resample method resamples the OpticalScatterer (extinction, albedo, phase).

        Parameters
        ----------
        grid: shdom.Grid
            The new grid to which the data will be resampled

        Returns
        -------
        scatterer: shdom.OpticalScatterer
            An optical scatterer resampled onto the input grid
        """
        extinction = self.extinction.resample(grid)
        albedo = self.albedo.resample(grid)
        phase = self.phase.resample(grid)
        return shdom.OpticalScatterer(self.wavelength, extinction, albedo,
                                      phase)