Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanodisort-0.3.0rc1.tar.gz (362.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nanodisort-0.3.0rc1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (177.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

nanodisort-0.3.0rc1-cp310-abi3-macosx_11_0_arm64.whl (174.4 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

nanodisort-0.3.0rc1-cp310-abi3-macosx_10_13_x86_64.whl (186.2 kB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

Details for the file nanodisort-0.3.0rc1.tar.gz.

File metadata

  • Download URL: nanodisort-0.3.0rc1.tar.gz
  • Upload date:
  • Size: 362.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nanodisort-0.3.0rc1.tar.gz
Algorithm Hash digest
SHA256 15bd28ea768985a57cbdcb627c93dc7d329ca439c2204a051f2dc6b41f6cb0ee
MD5 3a764410b10b252bcc436a4aeda3ba3d
BLAKE2b-256 241da5f313a710fb2fecfd224bd24ad52409d146051bd76f8f2b6e23f913b6bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodisort-0.3.0rc1.tar.gz:

Publisher: build.yml on eradiate/nanodisort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanodisort-0.3.0rc1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nanodisort-0.3.0rc1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8cfc1423dab18fb62c2ab0e873897cc4c50faa1d6c921e2912c66612bc48d83c
MD5 ce1d72da3dcaa4d133115dd86450ee2c
BLAKE2b-256 da8b815fd67df90ad4b36d7a5589a36b6e7283ae339ff12705ae82f635251555

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodisort-0.3.0rc1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build.yml on eradiate/nanodisort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanodisort-0.3.0rc1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nanodisort-0.3.0rc1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db42fdafc45c6e7e4165b8bf137d0d34ad7a3dfccd3f59d2243593798ebba6a1
MD5 469baab4f4628574010f4693e737cafc
BLAKE2b-256 f46a720d4968e37c1eb7774c6c14c6ad0901fe8e878c9d9a8034ae319e12e1e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodisort-0.3.0rc1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: build.yml on eradiate/nanodisort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanodisort-0.3.0rc1-cp310-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for nanodisort-0.3.0rc1-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 df213fe27714cccedd86e1910ba134ab5943a4d7ff19659d5316015a543af8bf
MD5 cbe731201ffd386bbdee1c0df2276293
BLAKE2b-256 b872325a506cbf64185fead197b6318459196bfc1621f27fba2dc8d49f845824

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodisort-0.3.0rc1-cp310-abi3-macosx_10_13_x86_64.whl:

Publisher: build.yml on eradiate/nanodisort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

4 files

This release

0.3.0rc1 This release

4 files

0.2.0

16 files

0.1.0

16 files

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