def tb2radiance(self, tb_, **kwargs):
        """Get the radiance from the brightness temperature (Tb) given the
        band name.

        Input:
          tb_: Brightness temperature of the band (self.band)

        Optional arguments:
          lut: If not none, this is a Look Up Table with tb and radiance values
            which will be used for the conversion. Default is None.

          normalized: If True, the derived radiance values are the spectral radiances for the band.
            If False the radiance is the band integrated radiance. Default is True.

        """
        lut = kwargs.get('lut', None)
        normalized = kwargs.get('normalized', True)

        if self.wavespace == WAVE_NUMBER:
            if normalized:
                unit = 'W/m^2 sr^-1 (m^-1)^-1'
            else:
                unit = 'W/m^2 sr^-1'
            scale = 1.0
        else:
            if normalized:
                unit = 'W/m^2 sr^-1 m^-1'
            else:
                unit = 'W/m^2 sr^-1'
            scale = 1.0

        if lut:
            ntb = (tb_ * self.tb_scale).astype('int16')
            start = int(lut['tb'][0] * self.tb_scale)
            retv = {}
            bounds = 0, lut['radiance'].shape[0] - 1
            index = np.clip(ntb - start, bounds[0], bounds[1])
            retv['radiance'] = lut['radiance'][index]
            if retv['radiance'].ravel().shape[0] == 1:
                retv['radiance'] = retv['radiance'][0]
            retv['unit'] = unit
            retv['scale'] = scale
            return retv

        planck = self.blackbody_function(self.wavelength_or_wavenumber, tb_) * self.response
        if normalized:
            radiance = integrate.trapz(planck, self.wavelength_or_wavenumber) / self.rsr_integral
        else:
            radiance = integrate.trapz(planck, self.wavelength_or_wavenumber)

        return {'radiance': radiance,
                'unit': unit,
                'scale': scale}
def tb2radiance ( self , tb_ , ** kwargs ) : lut = kwargs . get ( 'lut' , None ) normalized = kwargs . get ( 'normalized' , True ) if self . wavespace == WAVE_NUMBER : if normalized : unit = 'W/m^2 sr^-1 (m^-1)^-1' else : unit = 'W/m^2 sr^-1' scale = 1.0 else : if normalized : unit = 'W/m^2 sr^-1 m^-1' else : unit = 'W/m^2 sr^-1' scale = 1.0 if lut : ntb = ( tb_ * self . tb_scale ) . astype ( 'int16' ) start = int ( lut [ 'tb' ] [ 0 ] * self . tb_scale ) retv = { } bounds = 0 , lut [ 'radiance' ] . shape [ 0 ] - 1 index = np . clip ( ntb - start , bounds [ 0 ] , bounds [ 1 ] ) retv [ 'radiance' ] = lut [ 'radiance' ] [ index ] if retv [ 'radiance' ] . ravel ( ) . shape [ 0 ] == 1 : retv [ 'radiance' ] = retv [ 'radiance' ] [ 0 ] retv [ 'unit' ] = unit retv [ 'scale' ] = scale return retv planck = self . blackbody_function ( self . wavelength_or_wavenumber , tb_ ) * self . response if normalized : radiance = integrate . trapz ( planck , self . wavelength_or_wavenumber ) / self . rsr_integral else : radiance = integrate . trapz ( planck , self . wavelength_or_wavenumber ) return { 'radiance' : radiance , 'unit' : unit , 'scale' : scale }
Get the radiance from the brightness temperature (Tb) given the
        band name.

        Input:
          tb_: Brightness temperature of the band (self.band)

        Optional arguments:
          lut: If not none, this is a Look Up Table with tb and radiance values
            which will be used for the conversion. Default is None.

          normalized: If True, the derived radiance values are the spectral radiances for the band.
            If False the radiance is the band integrated radiance. Default is True.