import * as le_json from "./electricitymap_yearly.json" assert {type: 'json'} let elec_data = le_json['default'] let fr_zone = Object.keys(elec_data.data.zones.FR) let de_zone = Object.keys(elec_data.data.zones.DE) console.log('fr_zone', fr_zone) console.log('de_zone', de_zone) let scraped_data_account_keys_fr = fr_zone let scraped_data_account_keys_de = de_zone console.log('scraped_data_account_keys_fr', scraped_data_account_keys_fr) console.log('scraped_data_account_keys_de', scraped_data_account_keys_de) let average_fr = 0 let average_de = 0 let factor = 1 let ii_fr=1; let somme_fr=0; let ii_de=1; let somme_de=0; scraped_data_account_keys_fr.forEach(elem => { console.log('fr ',elem.substring(0,4),elec_data.data.zones.FR[elem].co2intensity) somme_fr += elec_data.data.zones.FR[elem].co2intensity ii_fr++ }) average_fr = somme_fr / ii_fr; scraped_data_account_keys_de.forEach(elem => { console.log('de ',elem.substring(0,4),elec_data.data.zones.DE[elem].co2intensity) somme_de += elec_data.data.zones.DE[elem].co2intensity ii_de++ }) average_de = somme_de / ii_de; factor = ( average_de / average_fr ) console.log('la france a émis en moyenne '+ Math.round(factor,2)+' fois moins de gaz à effet de serre par habitant via son mix électrique que l\'allemagne au cours des 6 dernières années .') console.log('la france : '+Math.round(average_fr,2)+' gCO2 eq/kWh/hab.') console.log('l\'allemagne : '+Math.round(average_de,2)+' gCO2 eq/kWh/hab.') console.log(' https://ourworldindata.org/grapher/co-emissions-per-capita?tab=chart&time=1963..latest&country=OWID_EU27~FRA~DEU ') // comparer aussi les consommations d'énergie primaire via ourworldindata