-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1_fig6.py
More file actions
215 lines (193 loc) · 9.09 KB
/
P1_fig6.py
File metadata and controls
215 lines (193 loc) · 9.09 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 24 01:18:22 2024
@author: chingchen
"""
import pandas as pd
import numpy as np
import numpy.ma as ma
from matplotlib import cm
import matplotlib as mpl
from scipy.misc import derivative
import matplotlib.pyplot as plt
from scipy.signal import find_peaks
from plot_time_vs_pow import hat_graph
labelsize = 20
bwith = 3
### PATH ###
path = '/Users/chingchen/Desktop/data/'
workpath = '/Users/chingchen/Desktop/StagYY_Works/thermal_evolution_v2/'
modelpath = '/Users/chingchen/Desktop/model/'
figpath = '/Users/chingchen/Desktop/figure/'
colors=['#282130','#849DAB','#35838D','#CD5C5C','#97795D','#414F67','#4198B9','#2F4F4F']
colors2=['#B22222','#FF8C00','#4B0082','#C71585','#D2691E']
colors=['#282130','#849DAB','#CD5C5C','#35838D',]
header_list = ['time_Gyr','Prad','Ptidal','Fcore','Pint','Hint','conv',
'melt','P','zbot','%vol','Tbot','Tm','Fbot','Ftop','dlid','T_core']
fig1 = 1
fig2 = 0
#
if fig1:
fig,(aa1,aa2) = plt.subplots(2,2,figsize=(22,14))
ax=aa1[0]
ax2=aa1[1]
ax3=aa2[0]
ax4=aa2[1]
# ---------------------------------------- figure --------------------------------
model_list = ['Europa-tidal5_period0.14Gyr_emx5%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
# 'Europa-tidal5_period0.14Gyr_emx10%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx20%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx50%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
]
label_list = ['5%','20%','50%']
min_zbot = []
max_zbot = []
amplitude_zbot=[]
for i, model in enumerate(model_list):
i = i
data = pd.read_csv(workpath+model+'_Hvar_2_thermal-evolution.dat',
header=None,names=header_list,delim_whitespace=True)[2:].reset_index(drop=True)
data = data.replace('D','e',regex=True).astype(float) # data convert to float
x = data.time_Gyr
mask_cond = data.conv
mask_conv = ~ma.array(data.zbot, mask = data.conv).mask
zbot_cond = ma.array(data.zbot, mask = mask_cond)
zbot_conv = ma.array(data.zbot, mask = mask_conv)
if i < 2:
ax.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=3)
else:
ax.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=1)
ax.plot(x,zbot_cond,color=colors[i],linestyle='dashed')
#------------------------------------------------------------------------------------------
zbot_cond = ma.array(data.dlid, mask = mask_cond)
zbot_conv = ma.array(data.dlid, mask = mask_conv)
if i < 2:
ax3.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=3)
else:
ax3.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=1)
zbot_cond = ma.array(data.Tm, mask = mask_cond)
zbot_conv = ma.array(data.Tm, mask = mask_conv)
if i < 2:
ax4.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=3)
else:
ax4.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=1)
#------------------------------------------------------------------------------------------
peaks, _ = find_peaks(zbot_conv)
mins, _ = find_peaks(zbot_conv*-1)
if len(zbot_conv[peaks])>20:
amplitude_zbot.append(np.median(zbot_conv[peaks][10:19]-zbot_conv.data[mins][10:19]))
else:
print('---- HELP ----')
mask_cond = data.conv[data.time_Gyr>3.5]
mask_conv = ~ma.array(data.zbot[data.time_Gyr>3.5], mask = data.conv[data.time_Gyr>3.5]).mask
zbot_cond = ma.array(data.zbot[data.time_Gyr>3.5], mask = mask_cond)
zbot_conv = ma.array(data.zbot[data.time_Gyr>3.5], mask = mask_conv)
pp1 = round(np.min(zbot_conv),1)
pp2 = round(np.max(zbot_conv),1)
min_zbot.append(pp1)
max_zbot.append(pp2)
playerA = np.array(max_zbot)
playerB = np.array(min_zbot)
hat_graph(ax2, label_list, [playerA, playerB], ['Player A', 'Player B'])
# ------------------------------ figure setting ------------------------------
ax.legend(fontsize=labelsize)
ax2.tick_params(labelsize=labelsize,width=3,length=10,right=False, top=True,direction='in',pad=10)
ax.set_ylim(161,0)
ax2.set_ylim(161,0)
ax3.set_ylim(20,5)
ax4.set_ylim(240,280)
ax.set_ylabel('Ice layer thickness (km)',fontsize = labelsize)
ax2.set_ylabel('Ice layer thickness (km)',fontsize = labelsize)
ax3.set_ylabel('Stagnant lid thickness (km)',fontsize = labelsize)
ax4.set_ylabel('T$_m$ (K)',fontsize = labelsize)
ax.set_xlabel('Time (Gyr)',fontsize=labelsize)
ax2.set_xlabel('Eccentricity',fontsize=labelsize)
ax3.set_xlabel('Time (Gyr)',fontsize=labelsize)
ax4.set_xlabel('Time (Gyr)',fontsize=labelsize)
for aa in [ax,ax3,ax4]:
aa.minorticks_on()
aa.tick_params(which='minor', length=5, width=2, direction='in')
aa.tick_params(labelsize=labelsize,width=3,length=10,right=True, top=True,direction='in',pad=15)
aa.set_xlim(0,4.55)
aa.grid()
for axis in ['top','bottom','left','right']:
aa.spines[axis].set_linewidth(bwith)
for aa in [ax2]:
aa.minorticks_on()
for axis in ['top','bottom','left','right']:
aa.spines[axis].set_linewidth(bwith)
aa.grid()
# fig.savefig('/Users/chingchen/Desktop/StagYY_Works/paper_europa_ice_shell/figure6_v6.pdf')
if fig2:
fig2,(aa1,aa2) = plt.subplots(1,2,figsize=(18,7))
ax=aa1
ax2=aa2
# axx=aa1[1]
# axx3=aa2[1]
# ---------------------------------------- figure --------------------------------
model_list = ['Europa-tidal5_period0.14Gyr_emx5%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
# 'Europa-tidal5_period0.14Gyr_emx10%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx20%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx50%_eta1.0d14_P1.0TW_1.5wt%_D5.0km-NH3',
]
label_list = ['5%','10%','20%','30%','50%']
label_list = ['5%','10%','20%','50%']
label_list = ['5%','20%','50%']
min_zbot = []
max_zbot = []
amplitude_zbot=[]
for i, model in enumerate(model_list):
i = i
data = pd.read_csv(workpath+model+'_Hvar_2_thermal-evolution.dat',
header=None,names=header_list,delim_whitespace=True)[2:].reset_index(drop=True)
data = data.replace('D','e',regex=True).astype(float) # data convert to float
x = data.time_Gyr
mask_cond = data.conv
mask_conv = ~ma.array(data.zbot, mask = data.conv).mask
zbot_cond = ma.array(data.zbot, mask = mask_cond)
zbot_conv = ma.array(data.zbot, mask = mask_conv)
if i < 2:
ax.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=3)
else:
ax.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=1)
ax.plot(x,zbot_cond,color=colors[i],linestyle='dashed')
# ---------------------------------------- figure 2 --------------------------------
model_list = ['Europa-tidal5_period0.14Gyr_emx5%_eta5.6d13_P1.2TW_1.5wt%_D5.0km-NH3',
# 'Europa-tidal5_period0.14Gyr_emx10%_eta5.6d13_P1.2TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx20%_eta5.6d13_P1.2TW_1.5wt%_D5.0km-NH3',
'Europa-tidal5_period0.14Gyr_emx50%_eta5.6d13_P1.2TW_1.5wt%_D5.0km-NH3',
]
min_zbot = []
max_zbot = []
amplitude_zbot=[]
for i, model in enumerate(model_list):
data = pd.read_csv(workpath+model+'_Hvar_2_thermal-evolution.dat',
header=None,names=header_list,delim_whitespace=True)[2:].reset_index(drop=True)
data = data.replace('D','e',regex=True).astype(float) # data convert to float
x = data.time_Gyr
mask_cond = data.conv
mask_conv = ~ma.array(data.zbot, mask = data.conv).mask
zbot_cond = ma.array(data.zbot, mask = mask_cond)
zbot_conv = ma.array(data.zbot, mask = mask_conv)
if i < 2:
ax2.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=3)
else:
ax2.plot(x,zbot_conv,color=colors[i],label=label_list[i],lw=1)
ax2.plot(x,zbot_cond,color=colors[i],linestyle='dashed')
# ------------------------------ figure setting ------------------------------
ax.set_ylim(161,0)
ax2.set_ylim(161,0)
ax2.legend(fontsize=labelsize)
ax.set_xlabel('time (Gyr)',fontsize=labelsize)
ax2.set_xlabel('time (Gyr)',fontsize=labelsize)
for aa in [ax,ax2]:
aa.set_ylabel('ice layer thickness (km)',fontsize = labelsize)
aa.minorticks_on()
aa.tick_params(which='minor', length=5, width=2, direction='in')
aa.tick_params(labelsize=labelsize,width=3,length=10,right=True, top=True,direction='in',pad=15)
aa.set_xlim(0,4.55)
aa.grid()
for axis in ['top','bottom','left','right']:
aa.spines[axis].set_linewidth(bwith)
# fig.savefig('/Users/chingchen/Desktop/StagYY_Works/figure/figure6_v2.pdf')