Metadata-Version: 2.4
Name: pytrunc
Version: 1.0.1
Summary: Scattering phase matrix truncation Python tool for radiative transfer applications.
Author-email: Mustapha Moulana <mm@hygeos.com>
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.TXT
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: netcdf4
Requires-Dist: xarray
Provides-Extra: extra
Requires-Dist: matplotlib; extra == "extra"
Requires-Dist: notebook; extra == "extra"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: pydata-sphinx-theme; extra == "docs"
Requires-Dist: myst-parser; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: numpydoc; extra == "docs"
Requires-Dist: jupytext; extra == "docs"
Requires-Dist: pandoc; extra == "docs"
Dynamic: license-file

# pytrunc

[![image](https://img.shields.io/pypi/v/pytrunc.svg)](https://pypi.python.org/pypi/pytrunc)
[![image](https://img.shields.io/github/v/tag/hygeos/pytrunc?label=github&color=blue)](https://github.com/hygeos/pytrunc)


Scattering phase matrix truncation Python tool for radiative transfer applications.


Mustapha Moulana  
[HYGEOS website](https://hygeos.com/en/)  
[Documentation](https://hygeos.github.io/pytrunc/)


-----------------------------------------------

## Installation

For an installation via pip, you can use the following command:

```bash
pip install git+https://github.com/hygeos/pytrunc.git
```

## Examples

Example using the Delta-m method:

<details>
<summary>Voir l'image</summary>

```python
>>> ...
>>> from pytrunc.truncation import delta_m_phase_approx
>>> m_max = 20 # stream / term number
>>> # phase_exact -> P11 of a liquid cloud at 500nm and an effective radius of 8 mirometers
>>> # theta -> the phase angles in degrees
>>> ds = delta_m_phase_approx(phase_exact, theta, m_max) # return an xarray dataset
>>> ...
```

<img src="pytrunc/img/truncated_phase_dm.png" width="800">

</details>

Example using the Geometric Truncation:

<details>
<summary>Voir l'image</summary>

```python
>>> ...
>>> from pytrunc.truncation import gt_phase_approx
>>> from pytrunc.phase import calc_moments
>>> m_max = 20 # stream / term number
>>> # phase_exact -> P11 of a liquid cloud at 500nm and an effective radius of 8 mirometers
>>> # theta -> the phase angles in degrees
>>> chi = calc_moments(phase_exact, theta, m_max=m_max, normalize=True) # the phase moments
>>> f = chi[m_max] # The truncation factor
>>> ds = gt_phase_approx(phase_exact, theta, f) # return an xarray dataset
>>> ...
```

<img src="pytrunc/img/truncated_phase_gt.png" width="800">

</details>
