-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_real_topo.py
202 lines (185 loc) · 7.81 KB
/
run_real_topo.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
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
from delta_obj2 import delta
import numpy as np
from matplotlib.pyplot import figure, plot, show, legend
import matplotlib.pyplot as plt
# import the real params
# all are in standard units of meters; fluxes in m**3
num_pres_strata = 74
channel_prop_median = 0.18135607321131447 # using extract_ch_proportions.py
not_subaerial_prop_median = 0.61619800332778696
font = {'size':16}
sect_comps = np.loadtxt('section_completenesses.txt')
SL_trajectory = np.loadtxt('real_SL.txt')[1:]
Q_real = np.loadtxt('real_Qs.txt')[1:]
# use the 1st step as the initial condition...
mydelta = delta()
ins = mydelta.read_input_file('real_inputs.txt')
nt = int(ins['nt'])
completenesses = []
tscales, completenesses = mydelta.execute('real_inputs.txt', SL_trajectory,
completeness_records=completenesses, graphs=True, Q=Q_real,
initial_topo=(1.04, 0.065)) #, save_strat=(20,(3.5,0.4)))
final_pres = mydelta.final_preserved
completeness_subsampled = []
for i in xrange(10):
condition = np.random.rand(final_pres.size)<(float(num_pres_strata-1)/nt)
new_pres_strata = np.logical_and(final_pres, condition)
tsc, comp = mydelta.full_completeness(record=new_pres_strata)
completeness_subsampled.append(comp.copy())
figure(7)
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
for i in completeness_subsampled:
plot(tsc, i, '0.5', ls='--')
plot(sect_comps[54:,0], sect_comps[54:,1], 'k', lw=3)
plot(sect_comps[54:,0], sect_comps[54:,2], 'k', lw=3) # only >2000 s
plot([],[],'0.5', ls='--', label='resampled completenesses')
plot([],[],'k', lw=3, label='real sections')
plt.gca().set_ybound(0,1)
plt.rc('font', **font)
legend(loc=4)
# now the restricted channel version
completeness_surface_walk = [] # forced with the mean "deep channel" proportion
completeness_synth_walk = [] # this one is forced with py (num_pres_strata-1)/nt == 0.0258
completeness_surface_rand = []
completeness_synth_rand = []
num_roll_pres_surf_w = []
num_roll_pres_synth_w = []
num_roll_pres_surf_r = []
num_roll_pres_synth_r = []
synth_py = float((num_pres_strata-1)/nt)
mydelta1 = delta()
mydelta2 = delta()
mydelta3 = delta()
mydelta4 = delta()
for i in xrange(30):
tscales, completeness_surface_walk = mydelta1.execute('real_inputs.txt', SL_trajectory,
completeness_records=completeness_surface_walk, graphs=False, Q=Q_real,
walking_erosion_depo=True)
num_roll_pres_surf_w.append(mydelta1.final_preserved.sum())
tscales, completeness_synth_walk = mydelta2.execute('real_inputs_frfixed.txt', SL_trajectory,
completeness_records=completeness_synth_walk, graphs=False, Q=Q_real,
walking_erosion_depo=True)
num_roll_pres_synth_w.append(mydelta2.final_preserved.sum())
tscales, completeness_surface_rand = mydelta3.execute('real_inputs.txt', SL_trajectory,
completeness_records=completeness_surface_rand, graphs=False, Q=Q_real,
restricted_channel_mass_conserved=True)
num_roll_pres_surf_r.append(mydelta3.final_preserved.sum())
tscales, completeness_synth_rand = mydelta4.execute('real_inputs_frfixed.txt', SL_trajectory,
completeness_records=completeness_synth_rand, graphs=False, Q=Q_real,
restricted_channel_mass_conserved=True)
num_roll_pres_synth_r.append(mydelta4.final_preserved.sum())
### for some reason the initial topo breaks these!!! run it without...
figure(8)
for i in xrange(len(completeness_surface_walk)):
plot(tscales, completeness_surface_walk[i],'darkblue', ls='--')
#plot(tscales, completeness_synth_walk[i],'skyblue', ls='-')
plot(tscales, completeness_surface_rand[i],'firebrick', ls='--')
#plot(tscales, completeness_synth_rand[i],'lightsalmon', ls='-')
plot([],[],'darkblue', ls='--', label='random walk')
#plot([],[],'skyblue', ls='-', label='random walk, forced py')
plot([],[],'firebrick', ls='--', label='no system memory')
#plot([],[],'lightsalmon', ls='-', label='no system memory, forced py')
plot(sect_comps[54:,0], sect_comps[54:,1], 'k', lw=3)
plot(sect_comps[54:,0], sect_comps[54:,2], 'k', lw=3) # only >2000 s
plot([],[],'k', lw=3, label='real sections')
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
plt.rc('font', **font)
legend(loc=4)
figure('8b')
for i in xrange(len(completeness_surface_walk)):
plot(tscales, completeness_surface_walk[i],'darkblue', ls='--')
plot(tscales, completeness_surface_rand[i],'firebrick', ls='--')
plot(tscales, completeness_synth_walk[i],'skyblue', ls='-')
#plot(tscales, completeness_synth_rand[i],'lightsalmon', ls='-')
plot([],[],'darkblue', ls='--', label='random walk, real py')
plot([],[],'firebrick', ls='--', label='no system memory, real py')
plot([],[],'skyblue', ls='-', label='random walk, forced py')
#plot([],[],'lightsalmon', ls='-', label='no system memory, forced py')
plot(sect_comps[54:,0], sect_comps[54:,1], 'k', lw=3)
plot(sect_comps[54:,0], sect_comps[54:,2], 'k', lw=3) # only >2000 s
plot([],[],'k', lw=3, label='real sections')
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
plt.rc('font', **font)
legend(loc=4)
figure(9)
for i in xrange(len(completeness_surface_walk)):
plot(tscales, completeness_surface_walk[i],'darkblue', ls='--')
plot(tscales, completeness_synth_walk[i],'skyblue', ls='-')
plot(tscales, completeness_surface_rand[i],'firebrick', ls='--')
plot(tscales, completeness_synth_rand[i],'lightsalmon', ls='-')
plot([],[],'darkblue', ls='--', label='random walk, real py')
plot([],[],'skyblue', ls='-', label='random walk, forced py')
plot([],[],'firebrick', ls='--', label='no system memory, real py')
plot([],[],'lightsalmon', ls='-', label='no system memory, forced py')
plot([],[],'k', lw=3, label='real sections')
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
legend(loc=4)
figure(10)
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
for i in completenesses:
plot(tsc, i, '0.5', ls='--')
plot(sect_comps[54:,0], sect_comps[54:,1], 'k', lw=3)
plot(sect_comps[54:,0], sect_comps[54:,2], 'k', lw=3) # only >2000 s
plot([],[],'0.5', ls='--', label='simulated completeness')
plot([],[],'k', lw=3, label='real sections')
plt.gca().set_ybound(0,1)
plt.rc('font', **font)
legend(loc=4)
figure(11)
for i in xrange(mydelta.strat_eta.shape[0]):
plot(mydelta.radial_distances, mydelta.strat_eta[i,:], 'k')
plt.xlabel('Radial distance')
plt.ylabel('Height')
plt.gca().set_xbound(0,3.5)
figure(12)
for i in xrange(len(completeness_surface_walk)):
plot(tscales, completeness_synth_walk[i],'skyblue', ls='-')
plot([],[],'skyblue', ls='-', label='random walk, forced py')
plot([],[],'k', lw=3, label='real sections')
plot(sect_comps[54:,0], sect_comps[54:,1], 'k', lw=3)
plot(sect_comps[54:,0], sect_comps[54:,2], 'k', lw=3) # only >2000 s
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
legend(loc=4)
figure(13)
for i in xrange(mydelta2.strat_eta.shape[0]):
plot(mydelta2.radial_distances, mydelta2.strat_eta[i,:], 'k')
plt.xlabel('Radial distance (m)')
plt.ylabel('Height (m)')
plt.gca().set_xbound(0,3.5)
figure(14)
mystrata = np.where(np.random.rand(mydelta.strat_eta.shape[0])
<0.025831564048124558)[0]
for i in mystrata:
plot(mydelta.radial_distances, mydelta.strat_eta[i,:], 'k')
plt.xlabel('Radial distance')
plt.ylabel('Height')
plt.gca().set_xbound(0,3.5)
figure(15)
plot(sect_comps[54:,0], sect_comps[54:,1], 'k--', lw=3, label='Section A')
plot(sect_comps[54:,0], sect_comps[54:,2], 'k:', lw=3, label='Section B') # only >2000 s
plt.gca().set_xscale('log')
plt.xlabel('Timescale (s)')
plt.ylabel('Completeness')
plt.gca().set_ybound(0,1)
plt.rc('font', **font)
legend(loc=4)
figure(16)
plot(mydelta.output_times, SL_trajectory, 'k', lw=3)
plt.xlabel('Time (s)')
plt.ylabel('Water surface elevation (m)')
plt.ticklabel_format(style='sci', axis='x', scilimits=(0,0))
plt.gca().set_ybound(0.,0.3)
plt.rc('font', **font)
show()