1+ import copy
2+
3+ import matplotlib .pyplot as plt
4+ import numpy as np
5+ import os
6+ import copy
7+
8+ import pandas as pd
9+
10+ os .chdir ("E:\\ Chapter 2\\ " )
11+ #save_path = 'C:\\Users\\frank\\OneDrive - University of North Carolina at Chapel Hill\\Chapter 2\\Cascade_CSV_Outputs\\Hindcasts\\'
12+
13+
14+
15+
16+ Base_Name_List = ['Geom_1' ,
17+ 'Geom_3' ,
18+ 'Geom_4' ,
19+ 'Geom_5' ]
20+
21+ Base_Name = Base_Name_List [0 ]
22+
23+ if Base_Name == 'Geom_1' :
24+ Cascade_Offset = 90
25+ if Base_Name == 'Geom_3' :
26+ Cascade_Offset = 490
27+ if Base_Name == 'Geom_4' :
28+ Cascade_Offset = 170
29+ if Base_Name == 'Geom_5' :
30+ Cascade_Offset = 160
31+
32+ run_name = 'Geom_1_IH_10_S1.npz' #'Geom_4_IL_10_S49_New_Sink.npz'
33+ #for geos in range(len(Base_Name_List)):
34+ # temp_run_name = copy.deepcopy(Base_Name_List[geos]+'_Calibrated_Hindcast_2.npz')
35+ # run_name.append(copy.deepcopy(temp_run_name))
36+
37+ output = np .load (run_name , allow_pickle = True )
38+ cascade = output ["cascade" ]
39+ cascade = cascade [0 ]
40+
41+ bmft = cascade ._bmft_coupler
42+ bmftc = bmft ._bmftc [0 ]
43+ O_flux = bmftc .fluxes
44+ Forest_e = bmftc .Forest_edge
45+ Marsh_e = bmftc .Marsh_edge
46+
47+ initial_C = bmftc ._marshOM_initial # kg's C accross entire platfrom
48+ initial_marsh_C_g = initial_C * 1000
49+
50+ # Create initial C layer
51+ Initial_Marsh_Width = Forest_e [49 ] - Marsh_e [49 ]
52+ Per_m_Marsh_C_g = initial_marsh_C_g / Initial_Marsh_Width
53+ Initial_Transect_C_Value = np .zeros (len (bmftc .elevation [0 ]))
54+
55+ # Add initial C to marsh cells
56+ Initial_Transect_C_Value [int (Marsh_e [49 ]):int (Forest_e [49 ])] = Per_m_Marsh_C_g
57+ Total_C_Deposited_TS = [Initial_Transect_C_Value ]
58+
59+ #Bmftc._BayOM[yr]
60+
61+ Shoreline_location_TS = cascade .brie .x_s_save
62+ All_Reletive_Shoreline = ((- Shoreline_location_TS + 1624 + 90 )+ Forest_e [49 ])[0 ]
63+
64+
65+ # Start Year = [50]
66+ Start_Year = 49
67+ End_Year = Start_Year + 125
68+
69+ C_autoch = bmftc ._organic_dep_autoch # Subtract eroded mass from depositional record
70+ C_alloch = bmftc ._organic_dep_alloch
71+
72+ Total_Annual_C_Change = np .sum ((C_alloch ,C_autoch ),axis = 0 )
73+
74+ for years in range (Start_Year ,End_Year ):
75+ temp_sum = np .sum (Total_Annual_C_Change [Start_Year :years ],axis = 0 )
76+ marsh_accumulation = temp_sum [int (Marsh_e [years ]):]
77+ temp_total_marsh_C_Change = np .zeros (len (temp_sum ))
78+ temp_total_marsh_C_Change [int (Marsh_e [years ]):] = marsh_accumulation
79+ new_C_deposition_plus_C0 = np .sum ((temp_total_marsh_C_Change ,Initial_Transect_C_Value ),axis = 0 )
80+ new_C_deposition_plus_C0 [new_C_deposition_plus_C0 < 0 ] = 0
81+ Total_C_Deposited_TS .append (copy .deepcopy (new_C_deposition_plus_C0 ))
82+
83+ plt .plot (Total_C_Deposited_TS [0 ][0 :])
84+ #plt.plot(Total_C_Deposited_TS[10][0:])
85+ plt .plot (Total_C_Deposited_TS [24 ][0 :],alpha = 0.8 )
86+ #plt.plot(Total_C_Deposited_TS[30][0:])
87+ plt .plot (Total_C_Deposited_TS [49 ][0 :], alpha = 0.8 )
88+ plt .plot (Total_C_Deposited_TS [74 ][0 :], alpha = 0.8 )
89+ plt .plot (Total_C_Deposited_TS [99 ][0 :], alpha = 0.8 )
90+ plt .plot (Total_C_Deposited_TS [124 ][0 :],alpha = 0.8 )
91+
92+ # plt.axvline(x=All_Reletive_Shoreline[0])
93+ # plt.axvline(x=Marsh_e[49])
94+ # #plt.axvline(x=All_Reletive_Shoreline[24])
95+ # plt.axvline(x=Marsh_e[74])
96+ # #plt.axvline(x=All_Reletive_Shoreline[49])
97+ # plt.axvline(x=Marsh_e[99])
98+ # plt.axvline(x=All_Reletive_Shoreline[74])
99+ # #plt.axvline(x=Marsh_e[124])
100+ # plt.axvline(x=All_Reletive_Shoreline[99])
101+ # #plt.axvline(x=Marsh_e[144],color = 'grey')
102+ # plt.axvline(x=All_Reletive_Shoreline[124])
103+ # #plt.axvline(x=Marsh_e[172],color='black')
104+
105+ plt .xlim (4500 ,7500 )
106+ #plt.ylim(0,3000)
107+ plt .show ()
108+
109+ plt .plot (Total_Annual_C_Change [25 ][0 :])
110+ plt .plot (Total_Annual_C_Change [50 ][0 :])
111+ plt .plot (Total_Annual_C_Change [75 ][0 :])
112+ plt .plot (Total_Annual_C_Change [100 ][0 :])
113+ plt .plot (Total_Annual_C_Change [124 ][0 :])
114+ plt .xlim (4000 ,7000 )
115+ plt .ylim (0 ,3000 )
116+ plt .show ()
117+
118+ plt .plot (bmftc .elevation [50 ])
119+ plt .plot (bmftc .elevation [55 ])
120+ plt .plot (bmftc .elevation [60 ])
121+ plt .plot (bmftc .elevation [70 ])
122+ plt .plot (bmftc .elevation [80 ])
123+
124+ plt .show ()
125+
126+ elev = bmftc .elevation
127+
128+ plt .plot (elev [50 ][4500 :])
129+ plt .axvline (x = Forest_e [50 ]- 4500 ,linestyle = 'dashed' ,color = 'blue' )
130+ plt .axvline (x = Marsh_e [50 ]- 4500 ,linestyle = 'dashed' , color = 'blue' )
131+ #plt.show()
132+
133+ plt .plot (elev [70 ][4500 :],color = 'orange' )
134+ plt .axvline (x = Forest_e [70 ]- 4500 ,linestyle = 'dashed' ,color = 'orange' )
135+ plt .axvline (x = Marsh_e [70 ]- 4500 ,linestyle = 'dashed' , color = 'orange' )
136+ #plt.show()
137+
138+ plt .plot (elev [90 ][4500 :],color = 'red' )
139+ plt .axvline (x = Forest_e [90 ]- 4500 ,linestyle = 'dashed' ,color = 'red' )
140+ plt .axvline (x = Marsh_e [90 ]- 4500 ,linestyle = 'dashed' , color = 'red' )
141+ #plt.show()
142+
143+ plt .plot (elev [110 ][4500 :],color = 'green' )
144+ plt .axvline (x = Forest_e [110 ]- 4500 ,linestyle = 'dashed' ,color = 'green' )
145+ plt .axvline (x = Marsh_e [110 ]- 4500 ,linestyle = 'dashed' , color = 'green' )
146+
147+ plt .plot (elev [130 ][4500 :],color = 'black' )
148+ plt .axvline (x = Forest_e [130 ]- 4500 ,linestyle = 'dashed' ,color = 'black' )
149+ plt .axvline (x = Marsh_e [130 ]- 4500 ,linestyle = 'dashed' , color = 'black' )
150+ #plt.show()
151+
152+ plt .plot (elev [150 ][4500 :],color = 'grey' )
153+ plt .axvline (x = Forest_e [150 ]- 4500 ,linestyle = 'dashed' ,color = 'grey' )
154+ plt .axvline (x = Marsh_e [150 ]- 4500 ,linestyle = 'dashed' , color = 'grey' )
155+ plt .show ()
156+
157+
158+ plt .plot (elev [51 ][4500 :])
159+ plt .plot (elev [101 ][4500 :])
160+ plt .plot (elev [151 ][4500 :])
161+ plt .show ()
162+
163+ b3d = cascade ._barrier3d [0 ]
164+
165+
166+ z = 20
0 commit comments