pbogre / jetlog

Personal flight tracker and viewer
https://github.com/pbogre/jetlog
GNU General Public License v2.0
206 stars 10 forks source link

Add CO2 emission to the table #53

Open joshuawe opened 2 weeks ago

joshuawe commented 2 weeks ago

Including the CO2 consumption per flight (and perhaps later as a statistic over months or years) would be a great feature.

There are websites/APIs that calculate the consumption:

pbogre commented 2 weeks ago

Thanks for this issue. It's not the first time someone expresses interest in this feature.

At first I put it off because of the complexity of estimating CO2 emission. I have looked at the APIs you have linked and they look quite interesting, but if possible I would like to implement the calculation myself, rather than calling an external API.

One of the APIs you mention has a paper about how their estimation works (link), so once I get started on this feature i'll definitely look into that.

Thanks

joshuawe commented 2 weeks ago

It would be ideal, if it could be done without any API calls. If doing the calculations independently it would be a very rudimentary estimate as airplane type, number of passengers, cargo, etc. influence the calculations and these would needed to be retrieved via some API call.

One solution if robustness to API availability could be to calculate CO2 emissions with an API call but have a fallback estimate for when the API calls fail.

The document that you linked to unfortunately only provides a high-level explanation but no formulas.

pbogre commented 2 weeks ago

You are right that the estimation would be rudimentary, however looking at the request parameters for the APIs you linked shows that they simply take origin and destination airports as parameters (as well as cabin class), and derive an estimate from that. Does this mean that their calculations are also only dependent on the distance flown?

About using an API and local as fallback, if I had to use time to implement a CO2 estimation, I would rather work on make it accurate enough that it can substitute the API calls. Otherwise I would rather use the APIs 100% of the time instead of having some flights where the estimation has a large error.