|
30 | 30 | dyr[1:] = yr[1:]-yr[:-1] |
31 | 31 |
|
32 | 32 | # ---- Figure: mass change rate --- |
33 | | -fig, ax = plt.subplots(3,3) |
34 | | - |
| 33 | +fig, ax = plt.subplots(3,3, figsize=(15,12)) |
35 | 34 | #===================== |
36 | 35 | # 1. Total mass budget |
37 | 36 | #===================== |
|
58 | 57 |
|
59 | 58 | # Grounding line flux and grounding line migration flux |
60 | 59 | # do not come into the global mass budget |
61 | | -ax[0,0].plot(yr, SMB+BMB+calv+FMF, "--", label="total") |
| 60 | +tot = SMB+BMB+calv+FMF |
| 61 | +ax[0,0].plot(yr, tot, "--", label="total") |
62 | 62 |
|
63 | 63 | ax[0,0].legend(loc='best', prop={'size': 6}) |
64 | 64 | ax[0,0].set_ylabel('Mass change (Gt)') |
|
70 | 70 |
|
71 | 71 | ax[1,0].plot(yr, (calv*dyr).cumsum(), label='calving') |
72 | 72 | ax[1,0].plot(yr, (FMF*dyr).cumsum(), label='facemelt') |
73 | | -ax[1,0].plot(yr, ( (SMB+BMB+calv+FMF) * dyr).cumsum(), "--", label='total budget') |
| 73 | +ax[1,0].plot(yr, (tot * dyr).cumsum(), "--", label='total budget') |
74 | 74 |
|
75 | 75 | ax[1,0].legend(loc='best', prop={'size': 6}) |
76 | 76 | ax[1,0].set_ylabel('Cumulative mass change (Gt)') |
77 | 77 |
|
78 | | -ax[2,0].semilogy(yr, np.abs( ( (dvol) - (SMB+BMB+calv+FMF) ) / dvol ) ) |
79 | | -ax[2,0].set_ylabel('fractional error') |
80 | | - |
| 78 | +ax[2,0].semilogy(yr, np.abs( (tot - dvol ) / dvol ) ) |
| 79 | +ax[2,0].set_ylabel('fractional error', color='tab:blue') |
| 80 | +absErrAxTot = ax[2,0].twinx() |
| 81 | +absErrAxTot.plot(yr, tot - dvol, color='tab:orange') |
81 | 82 | #======================== |
82 | 83 | # 2. Grounded mass budget |
83 | 84 | #======================== |
|
107 | 108 | GLMigrationflux = -f.variables['groundingLineMigrationFlux'][:]/1.0e12 |
108 | 109 | ax[0,1].plot(yr, GLMigrationflux, label="GL migration flux") |
109 | 110 |
|
110 | | -ax[0,1].plot(yr, SMBg+BMBg+calvg+FMFg+GLflux+GLMigrationflux, "--", label="total") |
| 111 | +grndTot = SMBg+calvg+BMBg+FMFg+GLflux+GLMigrationflux |
| 112 | +ax[0,1].plot(yr, grndTot, "--", label="total") |
111 | 113 |
|
112 | 114 | ax[0,1].legend(loc='best', prop={'size': 6}) |
113 | 115 |
|
114 | 116 | # --- Figure: cumulative mass change --- |
| 117 | + |
115 | 118 | ax[1,1].plot(yr, volGround - volGround[0], 'k', linewidth=3, label='total mass change') |
116 | 119 | ax[1,1].plot(yr, (SMBg*dyr).cumsum(), label="SMB") |
117 | 120 | ax[1,1].plot(yr, (BMBg*dyr).cumsum(), label="BMB") |
|
120 | 123 | ax[1,1].plot(yr, (FMFg*dyr).cumsum(), label='facemelt') |
121 | 124 | ax[1,1].plot(yr, (GLflux*dyr).cumsum(), label="GL flux") |
122 | 125 | ax[1,1].plot(yr, (GLMigrationflux*dyr).cumsum(), label="GL Migration flux") |
123 | | -ax[1,1].plot(yr, ( (SMBg+BMBg+calvg+FMFg+GLflux+GLMigrationflux) * dyr).cumsum(), "--", label='total budget') |
| 126 | +ax[1,1].plot(yr, ( (grndTot) * dyr).cumsum(), "--", label='total budget') |
124 | 127 |
|
125 | 128 | ax[1,1].legend(loc='best', prop={'size': 6}) |
| 129 | +ax[2,1].semilogy(yr, np.abs( (grndTot - dvolGround) / dvolGround ) ) |
126 | 130 |
|
127 | | -ax[2,1].semilogy(yr, np.abs( ( (dvolGround) - (SMBg+BMBg+calvg+FMFg+GLflux+GLMigrationflux) ) / dvolGround ) ) |
128 | | - |
129 | | - |
| 131 | +absErrAxGrnd = ax[2,1].twinx() |
| 132 | +absErrAxGrnd.plot(yr, grndTot - dvolGround, color='tab:orange') |
130 | 133 | #======================== |
131 | 134 | # 3. Floating mass budget |
132 | 135 | #======================== |
|
150 | 153 | FMFf = -f.variables['totalFloatingFaceMeltingFlux'][:] / 1.0e12 |
151 | 154 | ax[0,2].plot(yr, FMFf, label='facemelt') |
152 | 155 |
|
153 | | -GLflux = f.variables['groundingLineFlux'][:]/1.0e12 |
154 | | -ax[0,2].plot(yr, GLflux, label="GL flux") |
| 156 | +ax[0,2].plot(yr, -GLflux, label="GL flux") |
| 157 | + |
| 158 | +ax[0,2].plot(yr, -GLMigrationflux, label="GL migration flux") |
155 | 159 |
|
156 | | -GLMigrationflux = f.variables['groundingLineMigrationFlux'][:]/1.0e12 |
157 | | -ax[0,2].plot(yr, GLMigrationflux, label="GL migration flux") |
158 | | -ax[0,2].plot(yr, SMBf+BMBf+calvf+FMFf+GLflux+GLMigrationflux, "--", label="total") |
| 160 | +fltTot = SMBf+BMBf+FMFf+calvf-GLflux-GLMigrationflux |
| 161 | +ax[0,2].plot(yr, fltTot, "--", label="total") |
159 | 162 |
|
160 | 163 | ax[0,2].legend(loc='best', prop={'size': 6}) |
161 | 164 |
|
|
166 | 169 |
|
167 | 170 | ax[1,2].plot(yr, (calvf*dyr).cumsum(), label='calving') |
168 | 171 | ax[1,2].plot(yr, (FMFf*dyr).cumsum(), label='facemelt') |
169 | | -ax[1,2].plot(yr, (GLflux*dyr).cumsum(), label="GL flux") |
170 | | -ax[1,2].plot(yr, (GLMigrationflux*dyr).cumsum(), label="GL Migration flux") |
171 | | -ax[1,2].plot(yr, ( (SMBf+BMBf+calvf+FMFf+GLflux+GLMigrationflux) * dyr).cumsum(), "--", label='total budget') |
| 172 | +ax[1,2].plot(yr, (-GLflux*dyr).cumsum(), label="GL flux") |
| 173 | +ax[1,2].plot(yr, (-GLMigrationflux*dyr).cumsum(), label="GL Migration flux") |
| 174 | +ax[1,2].plot(yr, (fltTot * dyr).cumsum(), "--", label='total budget') |
172 | 175 |
|
173 | 176 | ax[1,2].legend(loc='best', prop={'size': 6}) |
174 | 177 |
|
175 | | -ax[2,2].semilogy(yr, np.abs( ( (dvolFloat) - (SMBf+BMBf+calvf+FMFf+GLflux+GLMigrationflux) ) / dvolFloat ) ) |
| 178 | +ax[2,2].semilogy(yr, np.abs( (fltTot - dvolFloat) / dvolFloat ) ) |
| 179 | + |
| 180 | +absErrAxFlt = ax[2,2].twinx() |
| 181 | +absErrAxFlt.plot(yr, fltTot - dvolFloat, color='tab:orange') |
| 182 | +absErrAxFlt.set_ylabel('Absolute error (Gt; budget - true)', color='tab:orange') |
176 | 183 |
|
177 | 184 | for plotAx in ax.ravel(): |
178 | 185 | plotAx.grid('on') |
|
183 | 190 | ax[0,0].set_title('Total budget') |
184 | 191 | ax[0,1].set_title('Grounded budget') |
185 | 192 | ax[0,2].set_title('Floating budget') |
| 193 | + |
| 194 | +fig.subplots_adjust(wspace=0.5) |
186 | 195 | plt.show() |
187 | 196 | f.close() |
0 commit comments