コード例 #1
0
ファイル: tests.py プロジェクト: morganrae/leakage
Metric = namedtuple("Metric", "impact form gas tau")
metrics_2050 = pickle.load(open("metrics_2050", "rb"))
metrics_2100 = pickle.load(open("metrics_2100", "rb"))

ici_key = Metric("rf", "ici", "CH4", 2050 - 2005)
cci_key = Metric("rf", "cci", "CH4", 2050 - 2005)
swp_key = Metric("rf", "int", "CH4", 2050 - 2005)
gwp_key = Metric("rf", "int", "CH4", 2100 - 2005)

ici_metric = metrics_2050[ici_key][0]
cci_metric = metrics_2050[cci_key][0]
gwp_metric = metrics_2100[gwp_key][0]
swp_metric = metrics_2050[swp_key][0]

ici_output = run_all(ici_metric)
cci_output = run_all(cci_metric)
gwp_output = run_all(gwp_metric)
swp_output = run_all(swp_metric)
# Metric = namedtuple('Metric', 'impact form gas tau')
# metrics_35 = pickle.load(open('metrics_2050', 'rb'))

# Metric = namedtuple('Metric', 'impact form gas tau')
# ici_results = pickle.load(open('tests/ici_test', 'rb'))
# metrics_35 = pickle.load(open('metrics_2050', 'rb'))
# key_test = Metric('rf', 'ici', 'CH4', 2050 - 2005)
# mu_test = metrics_35[key_test][0]
# ici_test = run_all(mu_test)

# class LeakageTests(TestCase):
#    def test_ici(self):
コード例 #2
0
ファイル: main.py プロジェクト: morganrae/leakage
# metrics_85 = pickle.load(open('metrics_85', 'rb'))

# Define plotting variables:
gen_ymax = 7e9
cap_ymax = 4e5
ems_ymax1 = 3e12
ems_ymax2 = 10e9
rft_ymax1 = 8
rft_ymax2 = 5
set_label = "85_"

# Run simluation for all metrics:
# Simulation = namedtuple('Simulation', 'impact form gas tau')

for key, value in metrics_35.items():
    metrics_35[key].append(run_all(value[0]))

# Plot results:
for key, value in metrics_35.items():
    # Identify label:
    if (key.impact == "rf") and (
        (key.form == "ins") or (key.form == "ici") or (key.form == "dii") or (key.form == "iid")
    ):
        plot_label = "1"
    if (key.impact == "temp") and (
        (key.form == "ins") or (key.form == "ici") or (key.form == "dii") or (key.form == "iid")
    ):
        plot_label = "2"
    if (key.impact == "rf") and (
        (key.form == "int") or (key.form == "cci") or (key.form == "dci") or (key.form == "cid")
    ):