electricitymaps / bloom-contrib

Making carbon footprint data available to everyone.
https://www.bloomclimate.com
MIT License
436 stars 104 forks source link

Creation of a hotel model based on countries #266

Closed Magalii closed 4 years ago

Magalii commented 4 years ago

This new hotel model can be found in the new file "hotel.js" so it isn't in conflict with the already existing hotel model based on hotel class. It works with the country variables defined in the definition.js file. A new field 'country' has been added to the Lodging activity formatting in the README to make it compatible with this new model.

All the information used to create this model can be found here: https://docs.google.com/spreadsheets/d/1f1j9EeVn9czOZBJKLXvgPwnmldakxuJ7/edit#gid=1584958883

A possible improvement of this model would be to take into consideration the number of people sharing the same hotel room since the values given are per room and not per person.

Magalii commented 4 years ago

Hello! I am sorry I haven't reacted earlier. I have had many things going on, but I should be more responsive from now on. I created a json object with some example countries that you can find here: https://github.com/Magalii/tmrowapp-contrib/blob/hotelModel/co2eq/countries.json I tried to make it general so it can be used for other purposes in the futur if needed. Does it correspond to what you were asking? Also, we don't have values of the hotel footprint for all the countries. Should I give them a default value, for example the median of the other hotel footprint values? Or should I raise an error when those countries are encoutered? If you want to check that too, you can also find the new version of the hotel model per country here: https://github.com/Magalii/tmrowapp-contrib/blob/hotelModel/co2eq/hotelpercountry.js I pass the activity in argument and not just the countryCodeISO2 to the carbonIntensity function so it will be easier to change the model to add more precision to it, for example by adding a more precise area than the country or the number of people sharing a room.

Magalii commented 4 years ago

I went ahead and completed the model. It is now in the hotelpercountry.js file and works with the file countries.json in which are all the existing ISO2 country codes, the area they correspond to and the hotel footprint value when available. If the specific data for the area is known, it is returned. Otherwise, a default value corresponding to the median of all the different values available is returned. The countries.json file can easily be used for other purposes too if other informations per countries become usefull for this model or another.

martincollignon commented 4 years ago

@corradio can you check here?