pytrunc.truncation module#

pytrunc.truncation.delta_m_phase_approx(phase, theta, m_max, theta_unit='deg', phase_moments=None, method='trapezoid', ds_output=True)[source]#

Caculate the aproximation of the exact phase matrix using the delta-m method

Parameters:
phase1-D ndarray

The exact phase matrix

theta1-D ndarray

The phase matrix angles

m_maxint

The maximum term number

theta_unitstr, optional

The unit for theta angles: - ‘deg’ (default value) - ‘rad’

phase_moments1-D ndarray

The moments of the phase matrix. the size of phase_moments must be >= m_max+1. If this parameter is not None circumvent the calculation of phase matrix moments. This parameter can be useful in case we have the exact moment values like for H-G phase function

methodstr, optional

The method parameter of function calc_moments. Default use ‘trapezoid’. Also the integral method for the dirac normalization.

ds_outputBool, optional

If True the output is a dataset, else return a tuple.

Returns:
outxr.Dataset | tuple

Look-up table with truncation information if ds_output is True, else return a tuple. Form of the tuple:

  • phase_approx1-D ndarray

    -> The approximation of the exact phase matrix

  • ffloat

    -> The truncation factor

  • phase_star1-D ndarray

    -> The truncated scattering phase matrix

References

  • [1] Wiscombe, W. J. (1977). The delta-M method: Rapid yet accurate radiative flux calculations

    for strongly asymmetric phase functions. Journal of Atmospheric Sciences, 34(9), 1408-1422.

pytrunc.truncation.gt_phase_approx(phase, theta, trunc_frac, theta_unit='deg', method='trapezoid', phase_moments_1=None, th_tol=None, th_f=None, lobatto_optimization=False, ds_output=True)[source]#

Compute the aproximation of the exact phase matrix using the Iwabuchi GT method

Parameters:
phase1-D ndarray

The exact phase matrix

theta1-D ndarray

The phase matrix angles

trunc_fractfloat

The truncature fraction

theta_unitstr, optional

The unit for theta angles: - ‘deg’ (default value) - ‘rad’

methodstr, optional

The method parameter of function calc_moments. Default use ‘trapezoid’. Also the integral method for the dirac normalization.

phase_moments_1None | 1-D ndarray, optional

The value of the first moment of the phase matrix.

th_tolNone | float, optional

While finding matching moments for Pf we look between 0 and th_tol. The unit is depending on the parameter theta_unit. Default th_tol = π/2

th_fNone | float, optional

Impose the truncation angle. The unit is depending on the parameter theta_unit.

lobatto_optimizationbool, optional

Whether to use lobatto optimization for integration. Default is False.

ds_outputBool, optional

If True the output is a dataset, else return a tuple.

Returns:
outxr.Dataset | tuple

Look-up table with truncation information if ds_output is True, else return a tuple. Form of the tuple:

  • phase_approx1-D ndarray

    -> The approximation of the exact phase matrix

  • ffloat

    -> The truncation factor

  • phase_star1-D ndarray

    -> The truncated scattering phase matrix