/// The surface temperature passed in is in units of Kelvin.
/// The cloud adjustment is the fraction of cloud cover obscuring each of the three major components of albedo that lie below the clouds.
The surface temperature passed in is in units of Kelvin.
The cloud adjustment is the fraction of cloud cover obscuring each of the three major components of albedo that lie below the clouds.
The surface temperature passed in is in units of Kelvin . The cloud adjustment is the fraction of cloud cover obscuring each of the three major components of albedo that lie below the clouds .
pub fn planet_albedo(
    water_fraction: &f64,
    cloud_fraction: &f64,
    ice_fraction: &f64,
    surface_pressure_bar: &f64,
    rng: &mut dyn RngCore,
) -> f64 {
    let mut rock_fraction = 1.0 - *water_fraction - *ice_fraction;
    let mut components = 0.0;
    if *water_fraction > 0.0 {
        components += 1.0;
    }
    if *ice_fraction > 0.0 {
        components += 1.0;
    }
    if rock_fraction > 0.0 {
        components += 1.0;
    }
    let cloud_adjustment = *cloud_fraction / components as f64;
    if rock_fraction >= cloud_adjustment {
        rock_fraction -= cloud_adjustment;
    } else {
        rock_fraction = 0.0;
    }
    let water_fraction = match *water_fraction > cloud_adjustment {
        true => *water_fraction - cloud_adjustment,
        false => 0.0,
    };
    let ice_fraction = match *ice_fraction > cloud_adjustment {
        true => *ice_fraction - cloud_adjustment,
        false => 0.0,
    };
    let cloud_contribution = *cloud_fraction * about(CLOUD_ALBEDO, 0.2, rng);
    let water_contribution = water_fraction * about(WATER_ALBEDO, 0.2, rng);
    let (rock_contribution, ice_contribution) = match *surface_pressure_bar == 0.0 {
        true => (
            rock_fraction * about(AIRLESS_ROCKY_ALBEDO, 0.3, rng),
            ice_fraction * about(AIRLESS_ICE_ALBEDO, 0.4, rng),
        ),
        false => (
            rock_fraction * about(ROCKY_ALBEDO, 0.1, rng),
            ice_fraction * about(ICE_ALBEDO, 0.1, rng),
        ),
    };
    cloud_contribution + rock_contribution + water_contribution + ice_contribution
}
pub fn planet_albedo ( water_fraction : & f64 , cloud_fraction : & f64 , ice_fraction : & f64 , surface_pressure_bar : & f64 , rng : & mut dyn RngCore , ) -> f64 { let mut rock_fraction = 1.0 - * water_fraction - * ice_fraction ; let mut components = 0.0 ; if * water_fraction > 0.0 { components += 1.0 ; } if * ice_fraction > 0.0 { components += 1.0 ; } if rock_fraction > 0.0 { components += 1.0 ; } let cloud_adjustment = * cloud_fraction / components as f64 ; if rock_fraction >= cloud_adjustment { rock_fraction -= cloud_adjustment ; } else { rock_fraction = 0.0 ; } let water_fraction = match * water_fraction > cloud_adjustment { true => * water_fraction - cloud_adjustment , false => 0.0 , } ; let ice_fraction = match * ice_fraction > cloud_adjustment { true => * ice_fraction - cloud_adjustment , false => 0.0 , } ; let cloud_contribution = * cloud_fraction * about ( CLOUD_ALBEDO , 0.2 , rng ) ; let water_contribution = water_fraction * about ( WATER_ALBEDO , 0.2 , rng ) ; let ( rock_contribution , ice_contribution ) = match * surface_pressure_bar == 0.0 { true => ( rock_fraction * about ( AIRLESS_ROCKY_ALBEDO , 0.3 , rng ) , ice_fraction * about ( AIRLESS_ICE_ALBEDO , 0.4 , rng ) , ) , false => ( rock_fraction * about ( ROCKY_ALBEDO , 0.1 , rng ) , ice_fraction * about ( ICE_ALBEDO , 0.1 , rng ) , ) , } ; cloud_contribution + rock_contribution + water_contribution + ice_contribution }
The surface temperature passed in is in units of Kelvin.
The surface temperature passed in is in units of Kelvin .
water_fraction
&f64
cloud_fraction
&f64
ice_fraction
&f64
surface_pressure_bar
&f64
rng
&mut dyn RngCore