#!/usr/bin/env python3

# Atmospheric CO2
co2_now_ppm = 428.60          # NOAA global monthly mean, March 2026
co2_preindustrial_ppm = 280.0 # common round pre-industrial baseline

# Atmosphere / Earth
atmosphere_mass_kg = 5.15e18
molar_mass_dry_air_kg_mol = 28.9647e-3
molar_mass_carbon_kg_mol = 12.011e-3
molar_mass_co2_kg_mol = 44.0095e-3
earth_area_m2 = 510.1e12

# Wool
wool_carbon_fraction = 0.50
wool_fibre_density_kg_m3 = 1310
bulk_wool_density_low = 50
bulk_wool_density_high = 300

# CO2 inventory
moles_air = atmosphere_mass_kg / molar_mass_dry_air_kg_mol
excess_co2_moles = moles_air * (co2_now_ppm - co2_preindustrial_ppm) * 1e-6
excess_carbon_kg = excess_co2_moles * molar_mass_carbon_kg_mol
excess_co2_kg = excess_co2_moles * molar_mass_co2_kg_mol

# Convert the carbon atoms into wool mass.
wool_mass_kg = excess_carbon_kg / wool_carbon_fraction
wool_solid_volume_m3 = wool_mass_kg / wool_fibre_density_kg_m3
solid_thickness_m = wool_solid_volume_m3 / earth_area_m2
bulk_thickness_low_m = wool_mass_kg / bulk_wool_density_high / earth_area_m2
bulk_thickness_high_m = wool_mass_kg / bulk_wool_density_low / earth_area_m2

print(f"excess carbon: {excess_carbon_kg / 1e12:.0f} GtC")
print(f"excess CO2: {excess_co2_kg / 1e12:.0f} GtCO2")
print(f"wool mass: {wool_mass_kg / 1e12:.0f} Gt")
print(f"wool fibre-material volume: {wool_solid_volume_m3 / 1e9:.0f} km³")
print(f"solid global thickness: {solid_thickness_m * 1000:.2f} mm")
print(
    "bulk global thickness: "
    f"{bulk_thickness_low_m * 1000:.1f}–{bulk_thickness_high_m * 1000:.1f} mm"
)
