An algorithm could help battle climate change