Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b69e68b04b
|
|||
|
cfdf9083ef
|
|||
|
8c6c0e6aa2
|
|||
|
8440ba4cf8
|
|||
|
28f91eeecb
|
|||
|
61652d1e85
|
|||
|
4218f8b5bf
|
|||
|
1aae89ed08
|
|||
|
dae670f2b5
|
|||
|
413a4746cd
|
|||
|
11cb80cf7c
|
|||
|
f984f6d47c
|
|||
|
d2f4907fcd
|
|||
|
c1ec450c33
|
|||
|
85dd3a58fd
|
|||
|
83b3357e7b
|
|||
|
6cc63614ea
|
|||
|
befa954635
|
|||
|
ebbae56efa
|
|||
|
8e7053d756
|
|||
|
ec2f1eb4b5
|
|||
|
d751f6da0e
|
|||
|
9438f93a19
|
|||
|
149d5f2404
|
|||
|
c7cc6279e6
|
|||
|
ef6d8241e8
|
|||
|
d73624514c
|
|||
|
bebc4a61a0
|
|||
|
14e5a402a1
|
|||
| 840fcdd8ff | |||
| c5b30aa0db |
@@ -43,6 +43,22 @@ most countries.
|
||||
|
||||
`access_log` uses marginal data by default.
|
||||
|
||||
### Update the data
|
||||
|
||||
1. Go to the `data/output` directory on [co2.js
|
||||
repository](https://github.com/thegreenwebfoundation/co2.js/tree/v0.16.2/data/output)
|
||||
for the latest version released (in this example 0.16.2)
|
||||
|
||||
2. Download the `average-intensities.json` file.
|
||||
|
||||
3. Run `src/average_intensities_by_country.cr` with this file as stdin.
|
||||
|
||||
```
|
||||
crystal run src/average_intensities_by_country.cr < average-intensities.json >> src/swd/average_intensity.cr
|
||||
```
|
||||
|
||||
4. Modify `src/swd/average_intensity.cr` to fix the data.
|
||||
|
||||
## Create database
|
||||
|
||||
```bash
|
||||
@@ -179,6 +195,18 @@ Then run the program with the required flags enabled:
|
||||
access_log --swd --device-country
|
||||
```
|
||||
|
||||
## ASN database
|
||||
|
||||
If you want to keep track of ASN for each visitor, for instance for
|
||||
grouping possible attacks or IA crawls, create a database based on
|
||||
<https://iptoasn.com/>:
|
||||
|
||||
```bash
|
||||
./contrib/asn_database.sh
|
||||
```
|
||||
|
||||
And start the server with the `--asn-database=` flag.
|
||||
|
||||
## Crawler user agents
|
||||
|
||||
Download the [crawler user agents
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
db="${1:-$PWD/asn.sqlite3}"
|
||||
sqlite3 "$db" "CREATE TABLE IF NOT EXISTS asn (range_start INTEGER, range_end INTEGER, id INTEGER, country STRING, description TEXT);"
|
||||
sqlite3 "$db" "DELETE from asn;"
|
||||
wget https://iptoasn.com/data/ip2asn-v4-u32.tsv.gz -O - | gunzip | sqlite3 -tabs "$db" ".import '|cat -' asn"
|
||||
|
||||
echo "ASN database created/updated at $db"
|
||||
+3
-1
@@ -53,7 +53,9 @@ CREATE TABLE IF NOT EXISTS "access_logs" (
|
||||
"network_co2" float DEFAULT NULL,
|
||||
"consumer_device_co2" float DEFAULT NULL,
|
||||
"production_co2" float DEFAULT NULL,
|
||||
"total_co2" float DEFAULT NULL
|
||||
"total_co2" float DEFAULT NULL,
|
||||
"node" varchar DEFAULT NULL,
|
||||
"asn" integer DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "index_access_logs_on_host" ON "access_logs" ("host");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: "access_log"
|
||||
version: "0.5.3"
|
||||
version: "0.6.0"
|
||||
authors:
|
||||
- "f <f@sutty.nl>"
|
||||
targets:
|
||||
|
||||
+5
-5
@@ -111,31 +111,31 @@ describe SWD do
|
||||
|
||||
describe "#consumer_device_co2" do
|
||||
it "should extract the consumer device co2 emissions" do
|
||||
swd.consumer_device_co2.should(eq 0.6406335995061729)
|
||||
swd.consumer_device_co2.should(eq 0.6854924454444445)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#production_co2" do
|
||||
it "should extract the production co2 emissions" do
|
||||
swd.production_co2.should(eq 0.23407766135802469)
|
||||
swd.production_co2.should(eq 0.2504683935277778)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#network_co2" do
|
||||
it "should extract the network co2 emissions" do
|
||||
swd.network_co2.should(eq 0.17247827679012348)
|
||||
swd.network_co2.should(eq 0.1845556583888889)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#datacenter_co2" do
|
||||
it "should extract the datacenter co2 emissions" do
|
||||
swd.datacenter_co2.should(eq 0.1847981537037037)
|
||||
swd.datacenter_co2.should(eq 0.19773820541666665)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#total_co2" do
|
||||
it "should extract the total co2 emissions" do
|
||||
swd.total_co2.should(eq 1.2319876913580248)
|
||||
swd.total_co2.should(eq 1.3182547027777778)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+38
-12
@@ -10,8 +10,9 @@ require "system"
|
||||
require "./models/access_log"
|
||||
require "./models/crawler"
|
||||
require "./swd"
|
||||
require "./asn"
|
||||
|
||||
VERSION = "0.5.4"
|
||||
VERSION = "0.6.0"
|
||||
|
||||
Log.setup_from_env
|
||||
|
||||
@@ -19,13 +20,15 @@ Log.setup_from_env
|
||||
socket = "/tmp/access_log.socket"
|
||||
# The default database URI
|
||||
database = "sqlite3://./development.sqlite3"
|
||||
# ASN database
|
||||
asn_database = ""
|
||||
# Detect web crawlers
|
||||
crawler = false
|
||||
# Parse the crawlers repository
|
||||
crawlers = [] of Crawler
|
||||
# Fields in database
|
||||
# TODO: Obtain them from AccessLog
|
||||
fields = %w[id remote_user host msec server_protocol request_method request_completion uri request_uri query_string status sent_http_content_type sent_http_content_encoding sent_http_etag sent_http_last_modified http_accept http_accept_encoding http_accept_language http_pragma http_cache_control http_if_none_match http_dnt http_user_agent http_origin http_referer request_time bytes_sent body_bytes_sent request_length http_connection pipe connection_requests geoip2_data_country_name geoip2_data_city_name ssl_server_name ssl_protocol ssl_early_data ssl_session_reused ssl_curves ssl_ciphers ssl_cipher sent_http_x_xss_protection sent_http_x_frame_options sent_http_x_content_type_options sent_http_strict_transport_security nginx_version pid crawler datacenter_co2 network_co2 consumer_device_co2 production_co2 total_co2 node]
|
||||
fields = %w[id remote_user host msec server_protocol request_method request_completion uri request_uri query_string status sent_http_content_type sent_http_content_encoding sent_http_etag sent_http_last_modified http_accept http_accept_encoding http_accept_language http_pragma http_cache_control http_if_none_match http_dnt http_user_agent http_origin http_referer request_time bytes_sent body_bytes_sent request_length http_connection pipe connection_requests geoip2_data_country_name geoip2_data_city_name ssl_server_name ssl_protocol ssl_early_data ssl_session_reused ssl_curves ssl_ciphers ssl_cipher sent_http_x_xss_protection sent_http_x_frame_options sent_http_x_content_type_options sent_http_strict_transport_security nginx_version pid crawler datacenter_co2 network_co2 consumer_device_co2 production_co2 total_co2 node asn]
|
||||
# Params for the query
|
||||
params = [] of String
|
||||
# SWD
|
||||
@@ -56,6 +59,10 @@ OptionParser.parse do |p|
|
||||
database = d
|
||||
end
|
||||
|
||||
p.on "-I DATABASE", "--asn-database=DATABASE", "ASN Database URI" do |d|
|
||||
asn_database = d
|
||||
end
|
||||
|
||||
p.on "-c crawler-user-agents.json", "--crawlers crawler-user-agents.json", "Crawlers repository" do |c|
|
||||
crawler = true
|
||||
crawlers = Array(Crawler).from_json File.read(c)
|
||||
@@ -110,32 +117,50 @@ if crawler
|
||||
crawler_re = Regex.union(crawlers.map { |c| c.pattern })
|
||||
end
|
||||
|
||||
def remove_socket!(socket)
|
||||
FileUtils.rm(socket) if File.exists? socket
|
||||
end
|
||||
|
||||
remove_socket!(socket)
|
||||
|
||||
asn = ASN.new(asn_database) unless asn_database.empty?
|
||||
server = Socket.unix(Socket::Type::DGRAM)
|
||||
server.bind Socket::UNIXAddress.new(socket)
|
||||
|
||||
def close_server!(server, asn)
|
||||
server.try(&.close)
|
||||
asn.try(&.close)
|
||||
end
|
||||
|
||||
Signal::INT.trap do
|
||||
server.close
|
||||
FileUtils.rm(socket) if File.exists? socket
|
||||
remove_socket!(socket)
|
||||
close_server!(server, asn)
|
||||
exit
|
||||
end
|
||||
|
||||
Signal::KILL.trap do
|
||||
server.close
|
||||
FileUtils.rm(socket) if File.exists? socket
|
||||
remove_socket!(socket)
|
||||
close_server!(server, asn)
|
||||
exit
|
||||
end
|
||||
|
||||
MAX_SIZE = 1024 * 64 # 64K
|
||||
|
||||
# Open the database and wait for JSONL input.
|
||||
db = DB.open database do |db|
|
||||
DB.open database do |db|
|
||||
while true
|
||||
begin
|
||||
msg, _ = server.receive(1024 * 64) # 64K
|
||||
_, _, _, _, json = msg.split(" ", 5)
|
||||
msg, _ = server.receive(MAX_SIZE)
|
||||
# TODO: is this the best method?
|
||||
_, json = msg.split("{", 2)
|
||||
json = "{#{json}"
|
||||
|
||||
# Parse input
|
||||
access_log = AccessLog.from_json(json || "{}")
|
||||
d = device_country ? access_log.geoip2_data_country_iso_code : nil
|
||||
s = SWD.new(access_log.bytes_sent, renewable, datacenter, d, intensity) if swd
|
||||
i = access_log.remote_addr
|
||||
a = asn.try(&.query(i)) if i
|
||||
|
||||
# Execute query, detect crawler if enabled.
|
||||
# TODO: Does Crystal support splats? It does but we need to cast
|
||||
@@ -194,14 +219,15 @@ db = DB.open database do |db|
|
||||
(swd ? s.try(&.consumer_device_co2) : nil),
|
||||
(swd ? s.try(&.production_co2) : nil),
|
||||
(swd ? s.try(&.total_co2) : nil),
|
||||
(node ? System.hostname : nil)
|
||||
(node ? System.hostname : nil),
|
||||
a.try(&.id)
|
||||
|
||||
# Ignore parsing errors
|
||||
rescue e : JSON::ParseException
|
||||
Log.warn &.emit("Parse exception", error: e.message)
|
||||
rescue IO::Error
|
||||
server.close
|
||||
FileUtils.rm(socket) if File.exists? socket
|
||||
remove_socket!(socket)
|
||||
close_server!(server, asn)
|
||||
exit
|
||||
end
|
||||
end
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
require "db"
|
||||
require "sqlite3"
|
||||
|
||||
class AsnResult
|
||||
include DB::Serializable
|
||||
|
||||
property id : Int64?
|
||||
property country : String?
|
||||
property description : String?
|
||||
end
|
||||
|
||||
class ASN
|
||||
QUERY = "select id, country, description from asn where ? between range_start and range_end limit 1;"
|
||||
|
||||
property db : DB::Database
|
||||
|
||||
def initialize(database : String)
|
||||
@db = DB.open(database)
|
||||
@cache = Hash(UInt32, AsnResult).new
|
||||
end
|
||||
|
||||
# Binary representation of an IPv4 address
|
||||
def to_binary(address : String) : UInt32
|
||||
(address.split(".").map(&.to_u32).reduce(0.to_u32) { |t, v| (t << 8) + v })
|
||||
end
|
||||
|
||||
# Lookups an address and returns the ASN for it
|
||||
def query(address : String)
|
||||
query(to_binary(address))
|
||||
end
|
||||
|
||||
def query(binary_address : UInt32) : AsnResult?
|
||||
@cache[binary_address] ||= @db.query_one(QUERY, binary_address.to_i64, &.read(AsnResult))
|
||||
rescue DB::NoResultsError
|
||||
nil
|
||||
end
|
||||
|
||||
def close
|
||||
@db.close
|
||||
end
|
||||
end
|
||||
@@ -1,14 +1,34 @@
|
||||
require "json"
|
||||
require "csv"
|
||||
|
||||
average_intensities = Hash(String, Float32).new
|
||||
csv = CSV.new(File.open("./countries_codes_and_coordinates.csv"), headers: true)
|
||||
countries = Hash(String, String).new
|
||||
|
||||
while csv.next
|
||||
countries[csv["Alpha-3 code"]] = csv["Alpha-2 code"]
|
||||
end
|
||||
|
||||
average_intensities = Hash(String, Float64).new
|
||||
|
||||
JSON.parse(ARGF.gets_to_end).as_h.each do |country, data|
|
||||
if data["country_code_iso_2"].as_s.empty?
|
||||
if data["country_code"].as_s.empty?
|
||||
STDERR.puts "not ok - Skipping #{country} because of missing ISO code"
|
||||
next
|
||||
end
|
||||
|
||||
average_intensities[data["country_code_iso_2"].as_s] = data["emissions_intensity_gco2_per_kwh"].as_s.to_f32
|
||||
unless countries.has_key? data["country_code"].as_s
|
||||
STDERR.puts "not ok - Skipping #{country} because of missing ISO2 code"
|
||||
next
|
||||
end
|
||||
|
||||
STDERR.puts "ok - #{country}"
|
||||
|
||||
average_intensities[countries[data["country_code"].as_s]] =
|
||||
begin
|
||||
data["emissions_intensity_gco2_per_kwh"].as_f
|
||||
rescue TypeCastError
|
||||
data["emissions_intensity_gco2_per_kwh"].as_i.to_f
|
||||
end
|
||||
end
|
||||
|
||||
puts average_intensities.to_json
|
||||
|
||||
@@ -58,4 +58,5 @@ class AccessLog
|
||||
property sent_http_strict_transport_security : String
|
||||
property nginx_version : String
|
||||
property pid : String
|
||||
property remote_addr : String?
|
||||
end
|
||||
|
||||
+2
-1
@@ -20,13 +20,14 @@ class SWD
|
||||
getter consumer_device_iso_code : String?
|
||||
getter intensity_calculator : Symbol
|
||||
|
||||
# @see {co2.js/blob/main/src/constants/index.js}
|
||||
GIGABYTE = 1000.0 * 1000.0 * 1000.0
|
||||
KWH_PER_GB = 0.81
|
||||
END_USER_DEVICE_ENERGY = 0.52
|
||||
NETWORK_ENERGY = 0.14
|
||||
DATACENTER_ENERGY = 0.15
|
||||
PRODUCTION_ENERGY = 0.19
|
||||
GLOBAL_GRID_INTENSITY = 442.0
|
||||
GLOBAL_GRID_INTENSITY = 472.95
|
||||
RENEWABLES_GRID_INTENSITY = 50.0
|
||||
|
||||
@transfered_bytes_to_gb : Float32? | Float64? = nil
|
||||
|
||||
+212
-2
@@ -1,7 +1,217 @@
|
||||
class SWD
|
||||
module IntensityData
|
||||
# @see {co2.js/data/output/average-intensities-2021.json}
|
||||
AVERAGE_INTENSITY_BY_ISO_CODE = {"AR": 365.292, "AM": 206.522, "AU": 526.876, "AT": 145.083, "AZ": 536.585, "BD": 559.606, "BY": 472.727, "BE": 156.063, "BO": 311.475, "BA": 470.982, "BR": 144.677, "BG": 364.136, "BI": 275.862, "CA": 123.859, "CL": 395.565, "CN": 549.288, "CR": 30.903, "HR": 212.161, "CY": 601.19, "CZ": 401.272, "DK": 240.419, "EC": 132.964, "EG": 470.879, "SV": 180.87, "EE": 488.529, "FI": 152.651, "FR": 67.781, "GE": 105.685, "DE": 363.982, "GR": 363.388, "HU": 236.271, "IN": 632.656, "IE": 361.274, "IT": 340.937, "JP": 460.647, "KZ": 656.097, "KE": 104.0, "LV": 226.351, "LT": 247.475, "LU": 183.824, "MT": 452.055, "MX": 391.582, "MD": 642.512, "MN": 725.26, "ME": 335.958, "NL": 386.189, "MK": 444.191, "NO": 26.131, "PK": 363.065, "PE": 241.492, "PH": 579.689, "PL": 657.138, "PT": 222.632, "RO": 255.718, "RU": 355.431, "SA": 568.967, "SN": 540.098, "RS": 549.083, "SG": 488.21, "SK": 173.854, "SI": 241.956, "ZA": 706.991, "KR": 442.389, "ES": 193.737, "SE": 43.9, "CH": 58.952, "TW": 565.629, "TJ": 72.823, "TH": 503.034, "TN": 470.848, "TR": 432.293, "UA": 240.28, "GB": 268.255, "US": 378.625, "VN": 491.192}
|
||||
# @see {co2.js/data/output/average-intensities.json}
|
||||
AVERAGE_INTENSITY_BY_ISO_CODE = {
|
||||
"AE": 467.51,
|
||||
"AF": 123.71,
|
||||
"AG": 611.11,
|
||||
"AL": 24.42,
|
||||
"AM": 243.52,
|
||||
"AO": 167.22,
|
||||
"AR": 344.83,
|
||||
"AS": 647.06,
|
||||
"AT": 102.62,
|
||||
"AU": 553.76,
|
||||
"AW": 550.0,
|
||||
"AZ": 632.89,
|
||||
"BA": 638.05,
|
||||
"BB": 600.0,
|
||||
"BD": 694.63,
|
||||
"BE": 117.58,
|
||||
"BF": 554.91,
|
||||
"BG": 264.21,
|
||||
"BH": 902.41,
|
||||
"BI": 230.77,
|
||||
"BJ": 590.0,
|
||||
"BN": 892.67,
|
||||
"BO": 468.02,
|
||||
"BR": 106.06,
|
||||
"BS": 653.66,
|
||||
"BT": 24.19,
|
||||
"BW": 849.42,
|
||||
"BY": 323.63,
|
||||
"BZ": 155.56,
|
||||
"CA": 184.99,
|
||||
"CD": 27.04,
|
||||
"CF": 0.0,
|
||||
"CG": 713.73,
|
||||
"CH": 36.72,
|
||||
"CI": 393.53,
|
||||
"CK": 250.0,
|
||||
"CL": 265.52,
|
||||
"CM": 285.71,
|
||||
"CN": 557.5,
|
||||
"CO": 285.8,
|
||||
"CR": 63.01,
|
||||
"CU": 638.98,
|
||||
"CV": 480.0,
|
||||
"CY": 512.24,
|
||||
"CZ": 413.86,
|
||||
"DE": 342.06,
|
||||
"DJ": 450.0,
|
||||
"DK": 143.3,
|
||||
"DM": 600.0,
|
||||
"DO": 565.97,
|
||||
"DZ": 633.65,
|
||||
"EC": 209.7,
|
||||
"EE": 341.02,
|
||||
"EG": 574.5,
|
||||
"ER": 590.91,
|
||||
"ES": 146.15,
|
||||
"ET": 23.55,
|
||||
"FI": 72.25,
|
||||
"FJ": 278.26,
|
||||
"FK": 1000.0,
|
||||
"FO": 354.17,
|
||||
"FR": 44.18,
|
||||
"GA": 429.47,
|
||||
"GB": 215.79,
|
||||
"GD": 666.67,
|
||||
"GE": 143.06,
|
||||
"GF": 204.08,
|
||||
"GH": 452.86,
|
||||
"GL": 111.11,
|
||||
"GM": 666.67,
|
||||
"GN": 182.72,
|
||||
"GP": 493.9,
|
||||
"GQ": 605.1,
|
||||
"GR": 319.76,
|
||||
"GT": 272.66,
|
||||
"GU": 611.11,
|
||||
"GW": 625.0,
|
||||
"GY": 634.33,
|
||||
"HK": 681.99,
|
||||
"HN": 289.5,
|
||||
"HR": 174.48,
|
||||
"HT": 534.65,
|
||||
"HU": 182.82,
|
||||
"ID": 682.43,
|
||||
"IE": 279.79,
|
||||
"IL": 567.26,
|
||||
"IN": 708.96,
|
||||
"IQ": 689.4,
|
||||
"IR": 648.68,
|
||||
"IS": 28.33,
|
||||
"IT": 287.75,
|
||||
"JM": 561.25,
|
||||
"JO": 539.21,
|
||||
"JP": 483.73,
|
||||
"KE": 84.83,
|
||||
"KG": 152.65,
|
||||
"KH": 497.46,
|
||||
"KI": 500.0,
|
||||
"KM": 642.86,
|
||||
"KN": 636.36,
|
||||
"KP": 344.26,
|
||||
"KR": 415.65,
|
||||
"KW": 637.24,
|
||||
"KY": 642.86,
|
||||
"KZ": 801.79,
|
||||
"LA": 232.12,
|
||||
"LB": 369.47,
|
||||
"LC": 650.0,
|
||||
"LK": 509.78,
|
||||
"LR": 435.9,
|
||||
"LS": 20.83,
|
||||
"LT": 139.34,
|
||||
"LU": 134.62,
|
||||
"LV": 136.22,
|
||||
"LY": 830.53,
|
||||
"MA": 577.65,
|
||||
"MD": 629.56,
|
||||
"ME": 413.51,
|
||||
"MG": 477.27,
|
||||
"MK": 568.97,
|
||||
"ML": 394.5,
|
||||
"MM": 569.69,
|
||||
"MN": 784.01,
|
||||
"MO": 448.98,
|
||||
"MQ": 516.78,
|
||||
"MR": 481.71,
|
||||
"MS": 1000.0,
|
||||
"MT": 484.16,
|
||||
"MU": 633.03,
|
||||
"MV": 611.77,
|
||||
"MW": 54.65,
|
||||
"MX": 483.14,
|
||||
"MY": 604.43,
|
||||
"MZ": 127.81,
|
||||
"NA": 47.62,
|
||||
"NC": 585.76,
|
||||
"NE": 687.5,
|
||||
"NG": 507.85,
|
||||
"NI": 288.33,
|
||||
"NL": 252.7,
|
||||
"NO": 30.75,
|
||||
"NP": 23.36,
|
||||
"NR": 750.0,
|
||||
"NZ": 120.11,
|
||||
"OM": 545.33,
|
||||
"PA": 258.74,
|
||||
"PE": 263.27,
|
||||
"PF": 436.62,
|
||||
"PG": 513.74,
|
||||
"PH": 613.38,
|
||||
"PK": 398.61,
|
||||
"PL": 614.98,
|
||||
"PM": 600.0,
|
||||
"PR": 664.53,
|
||||
"PS": 460.78,
|
||||
"PT": 112.29,
|
||||
"PY": 24.86,
|
||||
"QA": 602.83,
|
||||
"RE": 525.22,
|
||||
"RO": 245.55,
|
||||
"RS": 670.8,
|
||||
"RU": 446.17,
|
||||
"RW": 301.89,
|
||||
"SA": 691.95,
|
||||
"SB": 636.36,
|
||||
"SC": 571.43,
|
||||
"SD": 214.33,
|
||||
"SE": 35.82,
|
||||
"SG": 498.74,
|
||||
"SI": 227.65,
|
||||
"SK": 96.49,
|
||||
"SL": 47.62,
|
||||
"SN": 535.4,
|
||||
"SO": 523.81,
|
||||
"SR": 383.18,
|
||||
"SS": 610.17,
|
||||
"ST": 555.56,
|
||||
"SV": 99.29,
|
||||
"SY": 682.27,
|
||||
"SZ": 142.86,
|
||||
"TC": 653.85,
|
||||
"TD": 615.39,
|
||||
"TG": 478.26,
|
||||
"TH": 555.43,
|
||||
"TJ": 98.7,
|
||||
"TM": 1306.3,
|
||||
"TN": 560.25,
|
||||
"TO": 571.43,
|
||||
"TR": 469.7,
|
||||
"TT": 682.11,
|
||||
"TW": 635.15,
|
||||
"TZ": 371.59,
|
||||
"UA": 250.47,
|
||||
"UG": 57.39,
|
||||
"US": 383.55,
|
||||
"UY": 96.7,
|
||||
"UZ": 1121.18,
|
||||
"VC": 600.0,
|
||||
"VE": 180.25,
|
||||
"VG": 647.06,
|
||||
"VI": 641.79,
|
||||
"VN": 486.13,
|
||||
"VU": 500.0,
|
||||
"WS": 400.0,
|
||||
"XK": 958.72,
|
||||
"YE": 586.32,
|
||||
"ZA": 713.48,
|
||||
"ZM": 111.0,
|
||||
"ZW": 298.44
|
||||
}
|
||||
|
||||
# @see {co2.js/data/output/marginal-intensities-2021.json}
|
||||
MARGINAL_INTENSITY_BY_ISO_CODE = {"AF": 414.0, "AL": 0.0, "DZ": 528.0, "AS": 753.0, "AD": 188.0, "AO": 1476.0, "AI": 753.0, "AG": 753.0, "AR": 478.0, "AM": 390.0, "AW": 753.0, "AU": 808.0, "AT": 242.0, "AZ": 534.0, "BS": 753.0, "BH": 726.0, "BD": 528.0, "BB": 749.0, "BY": 400.0, "BE": 252.0, "BZ": 403.0, "BJ": 745.0, "BM": 753.0, "BT": 0.0, "BO": 604.0, "BQ": 753.0, "BA": 1197.0, "BW": 1486.0, "BR": 284.0, "VG": 753.0, "BN": 681.0, "BG": 911.0, "BF": 753.0, "BI": 414.0, "KH": 1046.0, "CM": 659.0, "CA": 372.0, "KY": 753.0, "CV": 753.0, "CY": 751.0, "CF": 188.0, "TD": 753.0, "CL": 657.0, "CN": 899.0, "CO": 410.0, "KM": 753.0, "CD": 0.0, "CG": 659.0, "CK": 753.0, "CR": 108.0, "CI": 466.0, "HR": 294.0, "CU": 559.0, "CW": 876.0, "CZ": 902.0, "DK": 362.0, "DJ": 753.0, "DM": 753.0, "DO": 601.0, "EC": 560.0, "EG": 554.0, "SV": 547.0, "GQ": 632.0, "ER": 915.0, "EE": 1057.0, "SZ": 0.0, "ET": 0.0, "FK": 753.0, "FO": 753.0, "FJ": 640.0, "FI": 267.0, "FR": 158.0, "GF": 423.0, "PF": 753.0, "GA": 946.0, "GM": 753.0, "GE": 289.0, "DE": 650.0, "GH": 495.0, "GI": 779.0, "GR": 507.0, "GL": 264.0, "GD": 753.0, "GP": 753.0, "GU": 753.0, "GT": 798.0, "GN": 753.0, "GW": 753.0, "GY": 847.0, "HT": 1048.0, "HN": 662.0, "HU": 296.0, "IS": 0.0, "IN": 951.0, "ID": 783.0, "IR": 592.0, "IQ": 1080.0, "IE": 380.0, "IM": 436.0, "IL": 394.0, "IT": 414.0, "JM": 711.0, "JP": 471.0, "JO": 529.0, "KZ": 797.0, "KE": 574.0, "KI": 753.0, "KP": 754.0, "KR": 555.0, "XK": 1145.0, "KW": 675.0, "KG": 217.0, "LA": 1069.0, "LV": 240.0, "LB": 794.0, "LS": 0.0, "LR": 677.0, "LY": 668.0, "LI": 151.0, "LT": 211.0, "LU": 220.0, "MG": 876.0, "MW": 489.0, "MY": 551.0, "MV": 753.0, "ML": 1076.0, "MT": 520.0, "MH": 753.0, "MQ": 753.0, "MR": 753.0, "MU": 700.0, "YT": 753.0, "MX": 531.0, "FM": 753.0, "MD": 541.0, "MC": 158.0, "MN": 1366.0, "ME": 899.0, "MS": 753.0, "MA": 729.0, "MZ": 234.0, "MM": 719.0, "NA": 355.0, "NR": 753.0, "NP": 0.0, "NL": 326.0, "NC": 779.0, "NZ": 246.0, "NI": 675.0, "NE": 772.0, "NG": 526.0, "NU": 753.0, "MK": 851.0, "MP": 753.0, "NO": 47.0, "OM": 479.0, "PK": 592.0, "PW": 753.0, "PS": 719.0, "PA": 477.0, "PG": 597.0, "PY": 0.0, "PE": 473.0, "PH": 672.0, "PL": 828.0, "PT": 389.0, "PR": 596.0, "QA": 503.0, "RE": 772.0, "RO": 489.0, "RU": 476.0, "RW": 712.0, "SH": 753.0, "KN": 753.0, "LC": 753.0, "MF": 753.0, "PM": 753.0, "VC": 753.0, "WS": 753.0, "SM": 414.0, "ST": 753.0, "SA": 592.0, "SN": 870.0, "RS": 1086.0, "SC": 753.0, "SL": 489.0, "SG": 379.0, "SX": 753.0, "SK": 332.0, "SI": 620.0, "SB": 753.0, "SO": 753.0, "ZA": 1070.0, "SS": 890.0, "ES": 402.0, "LK": 731.0, "SD": 736.0, "SR": 1029.0, "SE": 68.0, "CH": 48.0, "SY": 713.0, "TW": 484.0, "TJ": 255.0, "TZ": 531.0, "TH": 450.0, "TL": 753.0, "TG": 859.0, "TO": 753.0, "TT": 559.0, "TN": 468.0, "TR": 376.0, "TM": 927.0, "TC": 753.0, "TV": 753.0, "UG": 279.0, "UA": 768.0, "AE": 556.0, "GB": 380.0, "US": 416.0, "UY": 174.0, "UZ": 612.0, "VU": 753.0, "VE": 711.0, "VN": 560.0, "VI": 650.0, "YE": 807.0, "ZM": 416.0, "ZW": 1575.0}
|
||||
|
||||
Reference in New Issue
Block a user