Skip to content

Commit 0df5a57

Browse files
committed
update
1 parent 4bcad3e commit 0df5a57

15 files changed

+361
-61
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.gitignore.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*old/
2+
*.DS_Store
3+
*temp-files/

03c-allsky-correct-modis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
DESCRIPTION
66
7-
1. Correct clear-sky albedo to all-sky using Key et al. (2001) approach/
7+
1. Correct clear-sky albedo to all-sky using Key et al. (2001) approach.
88
99
"""
1010

05-experiments-surface.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#%%
1717

1818
# Define user
19-
user = 'jryan4'
19+
user = 'johnnyryan'
2020

2121
# Define path
2222
path = '/Users/' + user + '/Dropbox (University of Oregon)/research/feedbacks/data/'
@@ -54,6 +54,34 @@
5454
OPTIONAL
5555
"""
5656

57+
mean_albedo = []
58+
for f in range(len(modis_files)):
59+
60+
print('Processing... %s' % f)
61+
62+
# Import albedo data
63+
modis = xr.open_dataset(modis_files[f])
64+
65+
# Some preprocessing
66+
albedo = modis['albedo'].values.astype(np.float32)
67+
albedo[mask3d == 0] = np.nan
68+
albedo[albedo == 0] = np.nan
69+
70+
# Add max snow albedo
71+
albedo[albedo > 84] = 84
72+
albedo[albedo <= 30] = 30
73+
74+
# Mean albedo
75+
mean_albedo.append(np.nanmean(np.nanmean(albedo, axis=2)))
76+
77+
print(np.mean(mean_albedo))
78+
79+
#%%
80+
81+
"""
82+
OPTIONAL
83+
"""
84+
5785
# Do some preprocessing to find which grid cells to mask
5886
nan_x, nan_y = [], []
5987
for f in range(len(modis_files)):

07a-surface-forcing-ice-sheet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#%%
1414

1515
# Define user
16-
user = 'johnnyryan'
16+
user = 'jryan4'
1717

1818
# Define path
1919
path = '/Users/' + user + '/Dropbox (University of Oregon)/research/feedbacks/data/'

07b-surface-forcing-elevation.py

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
#%%
1616

1717
# Define user
18-
user = 'jryan4'
18+
user = 'johnnyryan'
1919

2020
# Define path
2121
path = '/Users/' + user + '/Dropbox (University of Oregon)/research/feedbacks/data/'
22-
savepath = '/Users/' + user + '/Dropbox (University of Oregon)/research/feedbacks/figures/'
22+
savepath = '/Users/' + user + '/Library/CloudStorage/OneDrive-DukeUniversity/research/feedbacks/re-revision/'
2323

2424
#%%
2525

@@ -70,7 +70,7 @@
7070
df = pd.DataFrame(list(zip(ice, snowline, snow)))
7171
df.columns = ['ice', 'snowline', 'snow']
7272
df['bulk'] = df['ice'] + df['snowline'] + df['snow']
73-
df.to_csv(path + 'radiative-forcing-elevation.csv', index=False)
73+
#df.to_csv(path + 'radiative-forcing-elevation.csv', index=False)
7474

7575
#%%
7676

@@ -96,7 +96,7 @@
9696
coeffs['snowline_gt_std'] = coeffs['snowline_std']/1e+06*area*92
9797
coeffs['snow_gt_std'] = coeffs['snow_std']/1e+06*area*92
9898

99-
coeffs.to_csv(path + 'final-coeffs.csv')
99+
#coeffs.to_csv(path + 'final-coeffs.csv')
100100
#%%
101101

102102
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(nrows=2, ncols=3, figsize=(16, 10))
@@ -134,7 +134,6 @@
134134
coeffs['ice_gt']+coeffs['snowline_gt']+coeffs['snow_gt']-
135135
(coeffs['ice_gt_std']+coeffs['snowline_gt_std']+coeffs['snow_gt_std']),
136136
zorder=1, color=c4, alpha=0.2)
137-
ax3.legend(fontsize=13)
138137
ax3.set_yticklabels([])
139138
ax3.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
140139
ax3.set_xlim(0, 8.5)
@@ -184,7 +183,7 @@
184183

185184
ax1.set_xlabel('Radiative forcing (W m$^{-2}$)', fontsize=14)
186185
ax2.set_xlabel('Ice sheet area (km$^2$)', fontsize=14)
187-
ax3.set_xlabel('Meltwater melt (Gt yr$^{-1}$)', fontsize=14)
186+
ax3.set_xlabel('Meltwater production (Gt yr$^{-1}$)', fontsize=14)
188187
ax4.set_xlabel('Radiative forcing (W m$^{-2}$)', fontsize=14)
189188
ax5.set_xlabel('Meltwater production (mm w.e. d$^{-1}$)', fontsize=14)
190189
ax6.set_xlabel('Meltwater production (Gt yr$^{-1}$)', fontsize=14)
@@ -204,7 +203,12 @@
204203
ax5.text(0.03, 0.89, "e", fontsize=24, transform=ax5.transAxes)
205204
ax6.text(0.03, 0.89, "f", fontsize=24, transform=ax6.transAxes)
206205

207-
fig.savefig(savepath + 'radiative-forcing-elevation.png', dpi=200)
206+
ax1.set_xlim(0, 100)
207+
ax4.set_xlim(0, 100)
208+
ax3.set_xlim(0, 8.6)
209+
ax6.set_xlim(0, 8.6)
210+
211+
fig.savefig(savepath + 'fig2.png', dpi=300)
208212

209213

210214
#%%
@@ -341,6 +345,94 @@
341345
all_gt_max = np.sum(coeffs['ice_gt_max']) + np.sum(coeffs['snowline_gt_max']) + np.sum(coeffs['snow_gt_max'])
342346

343347

348+
#%%
349+
350+
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(nrows=2, ncols=3, figsize=(16, 10))
351+
352+
# Define colour map
353+
c1 = '#E05861'
354+
c2 = '#616E96'
355+
c3 = '#F8A557'
356+
c4 = '#3CBEDD'
357+
358+
ax1.plot(ice+snowline+snow, elevations[:-1], color=c4, zorder=2, lw=2,
359+
alpha=0.8, label='Surface radiative forcing')
360+
ax1.fill_betweenx(elevations[:-1],
361+
ice+snowline+snow+ice_std+snowline_std+snow_std,
362+
ice+snowline+snow-(ice_std+snowline_std+snow_std),
363+
zorder=1, color=c4, alpha=0.2)
364+
ax1.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
365+
ax1.legend(fontsize=13)
366+
ax1.set_xlim(0, 100)
367+
368+
ax2.barh(range(len(area)), area, align='edge', alpha=0.4, color=c4, edgecolor='k')
369+
ax2.set_ylim(0,17)
370+
ax2.grid(linestyle='dotted', lw=1, zorder=1)
371+
ax2.tick_params(axis='both', which='major', labelsize=13)
372+
ax2.set_yticklabels([])
373+
374+
#ax3.plot(coeffs['melt_gt'], elevations[:-1], color=c4, zorder=2,
375+
# lw=2, alpha=0.8, label='Total')
376+
ax3.plot(coeffs['ice_gt']+coeffs['snowline_gt']+coeffs['snow_gt'],
377+
elevations[:-1], color=c4, zorder=2,
378+
lw=2, alpha=0.8, label='')
379+
ax3.fill_betweenx(elevations[:-1],
380+
coeffs['ice_gt']+coeffs['snowline_gt']+coeffs['snow_gt']+
381+
coeffs['ice_gt_std']+coeffs['snowline_gt_std']+coeffs['snow_gt_std'],
382+
coeffs['ice_gt']+coeffs['snowline_gt']+coeffs['snow_gt']-
383+
(coeffs['ice_gt_std']+coeffs['snowline_gt_std']+coeffs['snow_gt_std']),
384+
zorder=1, color=c4, alpha=0.2)
385+
ax3.legend(fontsize=13)
386+
ax3.set_yticklabels([])
387+
ax3.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
388+
ax3.set_xlim(0, 8.5)
389+
390+
ax4.plot(snowline, elevations[:-1], color=c2, lw=2, zorder=2, alpha=0.8, label='Snowline')
391+
ax4.fill_betweenx(elevations[:-1], snowline+snowline_std, snowline-snowline_std, color=c2, zorder=1, alpha=0.2)
392+
ax4.set_xlim(0, 60)
393+
ax4.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
394+
ax4.legend(fontsize=13)
395+
396+
ax5.plot(coeffs['snowline'], elevations[:-1], color=c2,
397+
lw=2, zorder=2, alpha=0.8, label='Snowline')
398+
ax5.fill_betweenx(elevations[:-1], coeffs['snowline']+coeffs['snowline_std'],
399+
coeffs['snowline']-coeffs['snowline_std'], color=c2, zorder=1, alpha=0.2)
400+
ax5.set_xlim(0, 2.3)
401+
ax5.set_yticklabels([])
402+
ax5.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
403+
404+
ax6.plot(coeffs['snowline_gt'], elevations[:-1], color=c2,
405+
lw=2, zorder=2, alpha=0.8, label='Snowline')
406+
ax6.fill_betweenx(elevations[:-1], coeffs['snowline_gt']+coeffs['snowline_gt_std'],
407+
coeffs['snowline_gt']-coeffs['snowline_gt_std'], color=c2, zorder=1, alpha=0.2)
408+
ax6.set_xlim(0, 4)
409+
ax6.axhline(y=1600, ls='dashed', color='k', zorder=1, alpha=0.5)
410+
ax6.set_yticklabels([])
411+
412+
413+
ax1.set_xlabel('Radiative forcing (W m$^{-2}$)', fontsize=14)
414+
ax2.set_xlabel('Ice sheet area (km$^2$)', fontsize=14)
415+
ax3.set_xlabel('Meltwater melt (Gt yr$^{-1}$)', fontsize=14)
416+
ax4.set_xlabel('Radiative forcing (W m$^{-2}$)', fontsize=14)
417+
ax5.set_xlabel('Meltwater production (mm w.e. d$^{-1}$)', fontsize=14)
418+
ax6.set_xlabel('Meltwater production (Gt yr$^{-1}$)', fontsize=14)
419+
420+
ax1.set_ylabel('Elevation (m a.s.l.)', fontsize=14)
421+
ax4.set_ylabel('Elevation (m a.s.l.)', fontsize=14)
422+
423+
for ax in [ax1, ax3, ax4, ax5, ax6]:
424+
ax.grid(linestyle='dotted', lw=1, zorder=1)
425+
ax.tick_params(axis='both', which='major', labelsize=13)
426+
ax.set_ylim(0, 3400)
427+
428+
ax1.text(0.03, 0.89, "a", fontsize=24, transform=ax1.transAxes)
429+
ax2.text(0.03, 0.87, "b", fontsize=24, transform=ax2.transAxes)
430+
ax3.text(0.03, 0.89, "c", fontsize=24, transform=ax3.transAxes)
431+
ax4.text(0.03, 0.89, "d", fontsize=24, transform=ax4.transAxes)
432+
ax5.text(0.03, 0.89, "e", fontsize=24, transform=ax5.transAxes)
433+
ax6.text(0.03, 0.89, "f", fontsize=24, transform=ax6.transAxes)
434+
435+
#fig.savefig(savepath + 'radiative-forcing-snowline.png', dpi=200)
344436

345437

346438

0 commit comments

Comments
 (0)