moons 0.0.2

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ExosphereSpecies {
    pub name: &'static str,
    pub abundance_fraction: f64,
    pub scale_height_km: f64,
}

pub fn reference_composition() -> Vec<ExosphereSpecies> {
    vec![
        ExosphereSpecies {
            name: "He",
            abundance_fraction: 0.28,
            scale_height_km: 130.0,
        },
        ExosphereSpecies {
            name: "Ar",
            abundance_fraction: 0.22,
            scale_height_km: 48.0,
        },
        ExosphereSpecies {
            name: "Na",
            abundance_fraction: 0.16,
            scale_height_km: 95.0,
        },
        ExosphereSpecies {
            name: "K",
            abundance_fraction: 0.09,
            scale_height_km: 82.0,
        },
        ExosphereSpecies {
            name: "Ne",
            abundance_fraction: 0.12,
            scale_height_km: 150.0,
        },
        ExosphereSpecies {
            name: "H2",
            abundance_fraction: 0.13,
            scale_height_km: 240.0,
        },
    ]
}

pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
    species
        .iter()
        .copied()
        .max_by(|left, right| left.abundance_fraction.total_cmp(&right.abundance_fraction))
}