Track and reduce your carbon footprint, right now!

Jan Tschada
Green Spatial Engineering
5 min readAug 3, 2023

Spatial data science computing has become an integral part of modern society, driving innovation and progress across many fields. However, the growth of computing has also resulted in a significant increase in carbon dioxide (CO2) emissions. The CO2 emissions from data centers, computing equipment, and the energy required to power them contribute to climate change and pose a threat to our environment. Therefore, it is crucial that we track and reduce CO2 emissions from our spatial data science computing to mitigate their impact on the environment.

By implementing sustainable practices and technologies, we can ensure that our computing processes are more environmentally friendly and contribute to a healthier planet. In this way, tracking and reducing CO2 emissions from our spatial data science computing is not only a responsibility but also an opportunity to contribute to the global effort to combat climate change.

Photo by Jeremy Bishop on Unsplash

Measuring using code carbon

Using lightweight software Python module named code carbon to measure the carbon footprint of spatial data science workflows is a straightforward process. It seamless integrates in your favorite spatial data science pipelines.

Install code carbon

Code carbon is a Python package that can be installed via pip or conda. Use the following command to install the latest version:

pip install codecarbon
conda install -c conda-forge codecarbon

If you are not used to the shell, you could also install a fully fledged Anaconda environment. Anaconda Navigator is a graphical user interface that simplifies the installation and management of Conda packages. You can open it by searching for Anaconda Navigator in your computer’s search bar or by launching it from the Anaconda prompt.

Click on the Environments tab in the Anaconda Navigator and then click on the Create button to create a new environment. Give the environment a name and select the desired Python version.

In the new environment, click on the Channels tab and add the Conda-Forge channel to the list of channels. In the new environment, click on the Home tab, and search for codecarbon in the search bar. Code carbon should appear in the search results. Click on the code carbon package and then click on the Apply button to install it. Conda will download and install all the required dependencies automatically. After the installation is complete, you can verify that code carbon is installed by opening a Python interpreter or Jupyter Notebook in the new environment.

Import code carbon

Import the code carbon package at the beginning of your Python script or Jupyter Notebook using the following code:

from codecarbon import EmissionsTracker

Initialize code carbon

Create an instance of the EmissionsTracker class, passing in the required arguments, including the project name, experiment name, and the type of computing resources used. Here’s an example:

tracker = EmissionsTracker(

In this example, we’re tracking the carbon emissions of a spatial data science project called my-spatial-data-science-project running on cloud resources in the US-West-1 region. We’re also using the CO2 signal API to estimate the carbon emissions of the electricity used to power the cloud resources.

Start the tracker

Start the emissions tracker by calling the start method on the tracker instance. This will start measuring the carbon emissions of your spatial data science workflows.


Run your spatial data science workflows: Now you can run your spatial data science workflows as usual. Code carbon will measure the carbon emissions produced by the computing resources used to execute your code.

Stop the tracker

After the execution of the spatial data science workflow, call the stop method on the tracker instance to stop the emissions tracker and get the total estimated carbon emissions produced by your workflows.

emissions = tracker.stop()

The stop method returns a dictionary containing the total carbon emissions produced during the execution of your workflows.

By following these steps, you can easily measure the carbon footprint of your spatial data science workflows using code carbon. This will enable you to make informed decisions about the environmental impact of your computing resources and take steps to reduce your carbon footprint.

You can also use an offline emission tracker when you do not want to share your measurements or executing in an offline environment.


Reducing the carbon footprint of spatial data science workflows is a critical step towards mitigating the environmental impact of computing resources.

Climate Change

Climate change is one of the most pressing environmental issues facing our planet. The burning of fossil fuels to power computing resources, including data centers and personal computers, is a significant contributor to greenhouse gas emissions, leading to global warming and its effects, such as extreme weather events, sea-level rise, and habitat destruction.


As individuals, businesses, and societies, we have a responsibility to reduce our impact on the environment. We must take steps to minimize the carbon footprint of our spatial data science workflows to ensure that we’re not contributing to environmental degradation and climate change.

Regulatory Compliance

As governments around the world become increasingly concerned about climate change, they’re implementing regulations to limit carbon emissions. Failure to comply with these regulations could lead to significant financial penalties, legal consequences, and reputational damage for businesses and individuals.

Cost Savings

Reducing the carbon footprint of computing resources can also result in cost savings. By optimizing workflows, reducing energy consumption, and adopting sustainable practices, businesses and individuals can save on energy bills and computing costs while simultaneously reducing their carbon footprint.

Competitive Advantage

Consumers and investors are increasingly prioritizing environmentally responsible businesses and products. Adopting sustainable practices in spatial data science workflows can create a competitive advantage and attract more environmentally conscious customers and investors.

In conclusion, reducing the carbon footprint of spatial data science workflows is not only a moral imperative but also an opportunity to save costs, comply with regulations, and gain a competitive advantage. Therefore, it’s essential to start taking care of reducing the carbon footprint of spatial data science workflows right now.

We should take care of reducing our carbon footprint, starting right now!

Which spatial data science workflows would you like to measure and discussed in more depth?


[1] Code Carbon
Track and reduce CO2 emissions from your computing

[2] Spatial Data Science Fundamentals
Get to know the modern spatial analysis and data science capability.

[3] Green Spatial Engineering
We introduce some common practices doing spatial data science in a carbon effective way.