-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathseq_rate_sat_years_analysis.py
85 lines (73 loc) · 3.11 KB
/
seq_rate_sat_years_analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import pandas as pd
import numpy as np
from constants import *
from simmod_controller import run_simmod
INIT_YEAR = 2016 #Initial year of reductions (inclusive)
END_YEAR = 2100 #End year of reductions (inclusive)
run_start_year = 1765. #Run start year
run_end_year = 2100. #Inclusive of end year
dt = 1 #/ 100. #years
rcp = '2.6' #RCP scenario
carbon_model = 'pulse response' #'pulse response', 'box diffusion', or 'BEAM'
normalize_2000_conc = True #Normalize concentrations to historical year-2000 values
c_sens = 1.25 #Climate sensativity (T = F / LAMBDA)
def test_co2_reduction(run_start_year, run_end_year, dt, rcp, c_sens):
base_run = run_simmod(run_start_year, run_end_year, dt, rcp, c_sens)
results = base_run[['year']].copy()
for co2_reduc in range(0,205,5):
co2_reduc = co2_reduc / 100.
for end_year in range (2016, 2101, 1):
print co2_reduc,
print end_year
diffs = (
run_simmod(run_start_year, run_end_year, dt, rcp, c_sens,
INIT_YEAR, end_year, co2_reduc, 0, 0)[['year', 't_s']]
)
diffs['t_s'] = diffs['t_s'] - base_run['t_s']
#diffs.rename(columns={'t_s': 't_s'+str(co2_reduc)}, inplace=True)
results.ix[(end_year - 1765), 't_s'+str(co2_reduc)] = diffs['t_s'][END_YEAR - 1765]
results.to_csv('Results/co2_sat_target_year_'+rcp+'.csv')
test_co2_reduction(run_start_year, run_end_year, dt, '2.6', c_sens)
test_co2_reduction(run_start_year, run_end_year, dt, '4.5', c_sens)
test_co2_reduction(run_start_year, run_end_year, dt, '6.0', c_sens)
test_co2_reduction(run_start_year, run_end_year, dt, '8.5', c_sens)
#def worker():
# """worker function"""
# print 'Worker'
# return
#
#if __name__ == '__main__':
# jobs = []
# for i in range(5):
# p = multiprocessing.Process(target=test_co2_reduction)
# jobs.append(p)
# p.start()
#results = run_simmod(run_start_year, run_end_year, dt, rcp, add_type = 'continuous', add_year = 2000, c_add = 100)
#results.to_csv('results/simmod_run_'+rcp+' '+carbon_model+'.csv')
#print results[['year', 'co2_pg']][1990-1765:999999]
#run_start_year = 1765. #Run start year
#run_end_year = 2100. #Inclusive of end year
#dt = 1 #/ 100. #years
#rcp = '8.5' #RCP scenario
#carbon_model = 'pulse response' #'pulse response', 'box diffusion', or 'BEAM'
#normalize_2000_conc = True #Normalize concentrations to historical year-2000 values
#c_sens = 0.825
##1.25 for 3 C
##0.825 for 4.5 C
##2.473 for 1.5 C
#
#base_run = run_simmod(run_start_year, run_end_year, dt, rcp, c_sens)
#results = base_run[['year']].copy()
#
#co2_reduc = 91 / 100.
#
#diffs = (
# run_simmod(run_start_year, run_end_year, dt, rcp, c_sens,
# INIT_YEAR, END_YEAR, co2_reduc, 0, 0)[['year', 't_s']]
# )
#diffs['t_s'] = diffs['t_s'] - base_run['t_s']
#
##print diffs[['year', 't_s']][285:]
#print diffs[['year', 't_s']][285:286]
#print diffs[['year', 't_s']][310:311]
#print diffs[['year', 't_s']][335:]