Skip to Content

AIRMASS

Overview

The AIRMASS function calculates the mass of air per square meter in the atmosphere along a given angle above the horizon, using a specified atmospheric density model. This is useful in meteorology, astronomy, and environmental science for determining the air mass encountered by light or particles traveling through the atmosphere at different angles. The calculation is based on numerical integration of the atmospheric density profile, accounting for the curvature of the Earth and the refractive index of air:

m(γ)=0Hmaxρ{1[1+2(RI1)(1ρ/ρ0)][cosγ(1+H/R)]2}1/2dHm(\gamma) = \int_0^{H_{max}} \rho \left\{1 - \left[1 + 2(RI-1)(1-\rho/\rho_0)\right][\cos\gamma(1+H/R)]^2\right\}^{-1/2} dH

where γ\gamma is the angle above the horizon, ρ\rho is the atmospheric density at height HH, RR is the planet radius, and RIRI is the refractive index. For more details, see the fluids GitHub repository and the official documentation.

This example function is provided as-is without any representation of accuracy.

Usage

To use the function in Excel:

=AIRMASS(density_profile, angle, [H_max], [R_planet], [RI])
  • density_profile (2D list, required): Table of two columns, where the first column is elevation (m) and the second is density (kg/m^3). Must have at least two rows.
  • angle (float, required): Angle above the horizon in degrees (0-90).
  • H_max (float, optional, default=86400.0): Maximum height to integrate to, in meters.
  • R_planet (float, optional, default=6371229.0): Radius of the planet in meters.
  • RI (float, optional, default=1.000276): Refractive index of the atmosphere.

The function returns a single value (float): the mass of air per square meter along the specified path, or an error message (string) if the input is invalid.

Examples

Example 1: Zenith Air Mass (Straight Up)

In Excel:

=AIRMASS({0,1.225;1000,1.112}, 90)

Expected output:

Result (kg/m^2)
10356.12

Example 2: 45 Degree Angle

In Excel:

=AIRMASS({0,1.225;1000,1.112}, 45)

Expected output:

Result (kg/m^2)
14641.13

Example 3: Custom Planet Radius

In Excel:

=AIRMASS({0,1.225;1000,1.112}, 90, 86400, 7000000)

Expected output:

Result (kg/m^2)
10356.12

Example 4: Custom Refractive Index

In Excel:

=AIRMASS({0,1.225;1000,1.112}, 90, 86400, 6371229, 1.0003)

Expected output:

Result (kg/m^2)
10356.12

This means, for example, the air mass straight up through the standard atmosphere is approximately 10356.12 kg/m^2.

Python Code

import micropip await micropip.install('fluids') from fluids.atmosphere import airmass as fluids_airmass def airmass(density_profile, angle, H_max=86400.0, R_planet=6371229.0, RI=1.000276): """ Calculate the mass of air per square meter in the atmosphere along a given angle using a density profile. Args: density_profile: 2D list, each row is [elevation (m), density (kg/m^3)]. angle: Angle above the horizon in degrees (0-90). H_max: Maximum height to integrate to, in meters (default: 86400.0). R_planet: Radius of the planet in meters (default: 6371229.0). RI: Refractive index of the atmosphere (default: 1.000276). Returns: The mass of air per square meter (float), or an error message (str) if input is invalid. This example function is provided as-is without any representation of accuracy. """ # Validate density_profile if not isinstance(density_profile, list) or len(density_profile) < 2: return "Invalid input: density_profile must be a 2D list with at least two rows." try: heights = [float(row[0]) for row in density_profile] densities = [float(row[1]) for row in density_profile] except Exception: return "Invalid input: density_profile must contain numeric values." if any(h2 <= h1 for h1, h2 in zip(heights, heights[1:])): return "Invalid input: heights in density_profile must be strictly increasing." try: gamma = float(angle) except Exception: return "Invalid input: angle must be a number." if not (0 <= gamma <= 90): return "Invalid input: angle must be between 0 and 90 degrees." # Linear interpolation function for density def density_func(H): if H <= heights[0]: return densities[0] if H >= heights[-1]: return densities[-1] for i in range(1, len(heights)): if H < heights[i]: h0, h1 = heights[i-1], heights[i] d0, d1 = densities[i-1], densities[i] return d0 + (d1 - d0) * (H - h0) / (h1 - h0) return densities[-1] try: result = fluids_airmass( density_func, gamma, H_max, R_planet, RI ) except Exception as e: return f"fluids.airmass error: {e}" return round(result, 2)

Live Notebook

Edit this function in a live notebook.

Live Demo

Last updated on