Skip to main content

nanodisort

pypi ci docs

Python bindings for CDISORT, a C implementation of the DISORT (Discrete Ordinates Radiative Transfer) solver.

Overview

DISORT is a widely-used radiative transfer solver for plane-parallel atmospheres. It uses the discrete ordinates method to solve the radiative transfer equation with support for:

  • Multiple scattering
  • Absorption and emission
  • Thermal emission (Planck function)
  • Various boundary conditions
  • Pseudo-spherical geometry for direct beam

The CDISORT library offers improved performance over the original Fortran version through dynamic memory allocation and full double precision arithmetic.

Installation

pip install nanodisort

Prerequisites:

  • Supported platforms: Linux, macOS
  • Python 3.10 and later
  • NumPy 1.20 or later
  • nanobind-backend (installed automatically)

Quickstart

Single Rayleigh-scattering layer illuminated by a solar beam at 60° zenith:

import numpy as np
import nanodisort as nd
from nanodisort.utils import phase_functions as pf

# Configure dimensions and allocate
ds = nd.DisortState()
ds.nstr = 16     # number of streams
ds.nlyr = 1      # number of layers
ds.nmom = 16     # phase function moments (>= nstr)
ds.ntau = 2      # output optical depth levels
ds.numu = 6      # output polar angles
ds.nphi = 1      # output azimuthal angles
ds.nphase = 100  # phase-angle grid points for the Buras-Emde correction
ds.allocate()

# Flags
ds.usrtau = True                     # user-specified output levels
ds.usrang = True                     # user-specified viewing angles
ds.lamber = True                     # Lambertian lower boundary
ds.quiet = True                      # suppress C-level output
ds.intensity_correction = True       # enable intensity correction
ds.old_intensity_correction = False  # use the Buras-Emde algorithm (default)

# Optical properties
ds.dtauc = np.array([0.1])          # extinction optical thickness
ds.ssalb = np.array([1.0])          # single-scattering albedo (pure scattering)
ds.pmom = pf.rayleigh(ds.nmom).reshape(-1, 1)  # Rayleigh phase function moments

# Buras-Emde correction: tabulate the phase function on a scattering-angle grid.
# mu_phase holds the scattering-angle cosines, shape (nphase,); phase holds the
# phase function values per layer, shape (nlyr, nphase). Here we use the analytic
# Rayleigh phase function P(mu) = 0.75 * (1 + mu**2).
mu_phase = np.linspace(-1.0, 1.0, ds.nphase)
ds.mu_phase = mu_phase
ds.phase = (0.75 * (1.0 + mu_phase**2)).reshape(1, -1)

# Output levels and viewing angles
ds.utau = np.array([0.0, 0.1])                    # TOA and surface
ds.umu = np.array([-1.0, -0.5, -0.1, 0.1, 0.5, 1.0])  # cosines of polar angles
ds.phi = np.array([0.0])                           # azimuthal angle [degrees]

# Boundary conditions
ds.fbeam = np.pi  # solar irradiance [W/m²]
ds.umu0 = 0.5     # cosine of solar zenith angle (60°)
ds.phi0 = 0.0     # solar azimuth [degrees]
ds.albedo = 0.0   # black surface
ds.fisot = 0.0    # no diffuse illumination from above

# Solve
ds.solve()

# Fluxes at each output level: shape (ntau,)
print(ds.rfldir)  # direct-beam downward irradiance
print(ds.rfldn)   # diffuse downward irradiance
print(ds.flup)    # diffuse upward irradiance

# Radiance field: shape (numu, ntau, nphi)
print(ds.uu.shape)

License

This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later), consistent with the CDISORT library it wraps.

Acknowledgements

nanodisort authors are grateful to the developers of the many implementations of DISORT, and, in particular, to

  • Timothy E. Dowling (original CDISORT C translation);
  • Robert Buras (phase function extensions);
  • Arve Kylling (pseudo-spherical approximation, testing);
  • the original DISORT Fortran authors (Knuth Stamnes, Si-Chee Tsay, Warren Wiscombe and Kolf Jayaweera).

Citation

If you use nanodisort in your research, please cite the CDISORT paper and the nanodisort repository:

@software{Leroy_nanodisort,
    author = {Leroy, Vincent and Emde, Claudia},
    license = {GPL-3.0-or-later},
    title = {{nanodisort}},
    url = {https://github.com/eradiate/nanodisort},
    version = {0.2.0}
}

Metadata

Release files for nanodisort 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanodisort 0.3.0
File Size Uploaded Provenance Actions
nanodisort-0.3.0.tar.gz 362.5 kB With provenance Details for nanodisort-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nanodisort 0.3.0
File Interpreter ABI Platform Actions
nanodisort-0.3.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for nanodisort-0.3.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
nanodisort-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for nanodisort-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
nanodisort-0.3.0-cp310-abi3-macosx_10_13_x86_64.whl CPython 3.10 abi3 macOS 10.13+ x86-64 Details for nanodisort-0.3.0-cp310-abi3-macosx_10_13_x86_64.whl

Total release size: 900.2 kB

Release files / nanodisort-0.3.0.tar.gz

Download URL nanodisort-0.3.0.tar.gz
Size 362.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83125cdcc0543e6ddcfee6fe14b58cd929d6e94771ee0d110fe746e4d7df119c
BLAKE2b-256 checksum
How to use checksums
103271dad01eee4124b342f5aeadf619c482d9364d6a5a473a263898d1fae5f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / nanodisort-0.3.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nanodisort-0.3.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 177.1 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
8342614ccd092a334eb2c5078ab39644429a7458f1d450a8cb24429d48ccc0f1
BLAKE2b-256 checksum
How to use checksums
3db10037a81d59155c33d826fdd040b1a56a74ec195bede52bbf73eb54ae3256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / nanodisort-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL nanodisort-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 174.4 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fce6b2cab09d67e17fb8f45b3e3622d0dc2ea222cf4f11cd50941cf0912f2abe
BLAKE2b-256 checksum
How to use checksums
10dab9a119b0148732a96d04cf601a60ec0575da06930f0dbd9e9a3ea3dbc097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / nanodisort-0.3.0-cp310-abi3-macosx_10_13_x86_64.whl

Download URL nanodisort-0.3.0-cp310-abi3-macosx_10_13_x86_64.whl
Size 186.1 kB
Tags CPython 3.10 abi3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
670c83ba7322f90657e733972f198d7673376b036144bd4108768e2dad5f8447
BLAKE2b-256 checksum
How to use checksums
b3fc1a95cf3295e46196d22847b22e91c810c70b11b49edd4d067a2a1f4453cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Security for nanodisort 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for nanodisort-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page