Skip to content

482solutions/hk-carbon-footprint-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hk_carbon_footprint_calculator

Description

There are 3 classes in the file that calculates CO2 emission based on distance, location or time & energy. No additional libraries are used.

Quickstart

To run and test all of the functions.

python3 estimates.py

Estimate based on distance

It uses an api from climatiq to estimate CO2 emission based on the distance and type of vehicle. Since they do not have a data in regards to autonomous robots, we're using an electric vehicle as the base.

To use that portion, simply uncomment this portion and run. Parameters used are: distance, distance unit

if __name__ == "__main__":
    #Testing distance estimation
    a = distance_estimate()
    a.add_parameters(20,'km')
    print(a.calculate())

Estimate based on location

It uses an api from co2signal to estimate CO2 emission intensity based on the location (lon, lat).

To test that portion, simply uncomment this portion and run Parameters used are: longtitude, latitude

if __name__ == "__main__":
    #Testing location CO2 intensity
    a = location_intensity()
    a.add_parameters(6.8770394, 45.9162776)
    print(a.calculate())

Estimate based on time and energy

If a user have the information of the amount of carbon emitted in kwh, this function will take that as a based and calculate carbon emission.

To test that portion, simply uncomment this portion and run. The code below is based of an example of a truck that emitted 10 kwh for 60 minutes.

if __name__ == "__main__":
    #Testing enery estimation based on time and energy
    a = energy_estimate()
    print(a.calculate(10, 60))

About

Carbon footprint calculator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages