https://sealevel.info/CO2_Residence_Times/calc_est_co2_removal_rates_v02.pl

#!/usr/bin/perl

# estimate CO2 removal rate in ppmv/yr as a function of CO2 level in ppmv, per Dr. Roy Spencer's "simple model"
# ref: http://www.drroyspencer.com/2019/04/a-simple-model-of-the-atmospheric-co2-budget/
sub removal_rate {
  local($co2level) = shift;
  local($removalrate) = 0;
  local($co2elevation) = $co2level - 295.1;
  local($ratio) = 47.73;
  if ($co2level <= 295.1) {
    $removalrate = 0;
  } else {
    $removalrate = $co2elevation * 0.0233;
  }
  return $removalrate;
}

# DEBUG PRINT
# print "Removal rates as a function of CO2 level:\n";
# for ($i=270; $i<=500; $i++) {
#   $removalrate = &removal_rate($i);
#   printf("$i %2.4f\n", $removalrate);
# }
# print "\n";


# SIMULATE DECLINE IN CO2 LEVEL IF EMISSIONS SUDDENLY WENT TO ZERO
$co2level = 410;
$year = 2019;
print "Simulated CO2 level decline, with level starting at $co2level ppmv in $year, and zero emissions:\n";
while ($co2level > 300) {
   printf("$year %5.1f\n", $co2level);
   $year += 1;
   $removalrate = &removal_rate( $co2level );
   $co2level -= $removalrate;
}