atmosphere

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package atmosphere models Earth’s air from its physical state: temperature, pressure, and density with height, and the scattering of light along a path. Coefficients identify their sources rather than supplying a sky colour chosen by eye. The package builds on measure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Air

type Air struct {
	// contains filtered or unexported fields
}

Air stores local temperature, pressure, and mass density.

func Standard

func Standard(height measure.Length) (*Air, error)

Standard returns the 1976 standard atmosphere from sea level to 86 km geometric height. Out-of-range input returns an error.

func (Air) Density

func (air Air) Density() Density

Density returns local mass density.

func (Air) Pressure

func (air Air) Pressure() Pressure

Pressure returns local air pressure.

func (Air) Temperature

func (air Air) Temperature() measure.Temperature

Temperature returns local air temperature.

type Column

type Column struct {
	// contains filtered or unexported fields
}

Column stores the molecular column density along a path and whether that path reaches the ground.

func Along

func Along(height measure.Length, rise measure.Angle) (*Column, error)

Along integrates air along a straight path from height at elevation rise, ending at the ground or the standard atmosphere’s top. Refraction is not modelled. Heights outside the standard return an error and no column.

func (Column) Grounded

func (column Column) Grounded() bool

Grounded reports whether the path ends at the ground rather than space.

func (Column) Molecules

func (column Column) Molecules() float64

Molecules returns the number of molecules per square metre perpendicular to the path.

type Composition

type Composition struct {
	// contains filtered or unexported fields
}

Composition describes the dry-air mixture used for Rayleigh scattering, parameterized by its carbon-dioxide fraction.

func DryAir

func DryAir(partsAMillion float64) (*Composition, error)

DryAir constructs dry-air composition from CO2 in parts per million. Values outside the fraction from zero to one million ppm return an error.

func (Composition) CrossSection

func (air Composition) CrossSection(wavelength measure.Length) (
	*measure.Area, error)

CrossSection returns molecular Rayleigh scattering area from Bodhaine et al.’s equation 22. Wavelengths outside the refractive index model’s supported interval return an error.

func (Composition) Depth

func (air Composition) Depth(column Column, wavelength measure.Length) (
	*float64, error)

Depth returns Rayleigh optical depth through a column at the given wavelength. Unsupported wavelengths return CrossSection’s error.

func (Composition) DepthAbove

func (air Composition) DepthAbove(wavelength measure.Length,
	pressure Pressure, latitude measure.Angle,
	height measure.Length) (*float64, error)

DepthAbove returns vertical Rayleigh optical depth using local pressure and Bodhaine et al.’s equation 25. Gravity is evaluated at the column’s mass-weighted height, following equation 26. Unsupported wavelengths return CrossSection’s error.

func (Composition) Skylight

func (air Composition) Skylight(height measure.Length, view, sun Way,
	wavelengths []measure.Length) ([]float64, error)

Skylight returns spectral sky radiance along a look from height, normalized per W/m² of incoming sunlight from the Sun direction. For that unit illumination, radiance is in W m^-2 sr^-1.

The single-scattering model attenuates sunlight to each path sample, applies the unpolarized Rayleigh phase function, and attenuates scattered light back toward the observer. Earth-blocked samples receive no direct sunlight.

Multiple scattering, ground reflection, haze, ozone, refraction, and depolarization are omitted. Depolarization changes the phase function by less than about 1.5%.

Unsupported heights and wavelengths return errors from the standard atmosphere or CrossSection.

func (Composition) Through

func (air Composition) Through(column Column, wavelength measure.Length) (
	*float64, error)

Through returns Beer–Lambert transmission through the column, exp(-optical depth). Unsupported wavelengths return CrossSection’s error.

type Density

type Density struct {
	// contains filtered or unexported fields
}

Density represents mass per volume.

func (Density) InKilogramsPerCubicMetre

func (density Density) InKilogramsPerCubicMetre() float64

InKilogramsPerCubicMetre returns density in kg/m³.

type Pressure

type Pressure struct {
	// contains filtered or unexported fields
}

Pressure represents pressure.

func Pascals

func Pascals(amount float64) Pressure

Pascals is a pressure in pascals.

func (Pressure) InPascals

func (pressure Pressure) InPascals() float64

InPascals is the pressure in pascals.

type Way

type Way struct {
	// contains filtered or unexported fields
}

Way is a normalized viewing direction, with y up and x/z horizontal.

func NewWay

func NewWay(x, y, z float64) (*Way, error)

NewWay normalizes direction components and rejects a zero vector or nonfinite components.

Components are scaled by their largest magnitude before squaring, so overflow or underflow in their squares does not lose a valid direction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL