<jupyter_start><jupyter_text>Greenland data- Coastline: https://doi.org/10.5285/8cecde06-8474-4b58-a9cb-b820fa4c9429 (BAS)- RGI06: https://www.glims.org/RGI/rgi60_dl.html- Ice-sheet basins: https://datadryad.org/stash/dataset/doi:10.7280/D1WT11<jupyter_code>dfg_coast = open_zip_shapefile('data/shapes/Greenland_coast.zip')
dfg_rgi = open_zip_shapefile('data/shapes/05_rgi60_GreenlandPeriphery.zip')
dfg_rgi = dfg_rgi.to_crs(dfg_coast.crs)
dfg_ice = open_zip_shapefile('data/shapes/doi_10.7280_D1WT11__v1.zip')
dfg_ice = dfg_ice.to_crs(dfg_coast.crs)
# We don't plot the basins of the ice sheet 
dfg_ice['A'] = 1
dfg_ice = dfg_ice.dissolve(by='A')
# Because the dissolve does not work perfectly
dfg_hide = open_zip_shapefile('data/shapes/to_hide.zip')
dfg_hide = dfg_hide.to_crs(dfg_coast.crs)
bbg = dfg_rgi.total_bounds<jupyter_output><empty_output><jupyter_text>Antarctica data- all outlines from https://doi.org/10.3189/2013AoG63A377 (Bliss et al)- removed glaciers in Millan et al 22 obtained from the author<jupyter_code>dfa = open_zip_shapefile('data/shapes/add_coastpoly_minus_rockReClassVelLamb.zip')
dfag = open_zip_shapefile('data/shapes/add_glaciers_icecaps5.zip')
dfag = dfag.to_crs(dfa.crs)
dfam = open_zip_shapefile('data/shapes/rgi19_removed_glaciers_millan.zip')
dfam = dfam.to_crs(dfa.crs)
bba = dfa.total_bounds
# Find out how much area is outside the bounds
bounds = dfag.bounds
df_out = dfag.loc[(bounds.maxx < bba[0]) | (bounds.minx > bba[2]) | (bounds.miny > bba[3]) | (bounds.maxy < bba[1])]
df_out['Area'].sum() / dfag['Area'].sum()
df_out['Area'].sum() * 1e-6, dfag['Area'].sum() * 1e-6<jupyter_output><empty_output><jupyter_text>Plot<jupyter_code>cols = sns.color_palette("deep")  # bright
cols
c_ocean = '#e9f3ff' # '#e5f1ff'
c_icesheet = 'white'
c_land = '#bbb4af'
c_glaciers = cols[3]
c_glaciers_1 = cols[1]
c_glaciers_2 = cols[0]
c_shelf = cols[-1]
c_rise = cols[4]
c_tongue = '#266bc4'
c_removed = cols[-4]
xg = bbg[[0, 2]] + np.array([-5e4, 5e4])
yg = bbg[[1, 3]] + np.array([-5e4, 5e4])

xa = bba[[0, 2]] + np.array([-1e5, 1e5])
ya = bba[[1, 3]] + np.array([-1e5, 1e5])

rxg = xg[1] - xg[0]
ryg = yg[1] - yg[0]

rxa = xa[1] - xa[0]
rya = ya[1] - ya[0]
f = plt.figure(figsize=(12, 8))

gs1 = gridspec.GridSpec(1, 2, width_ratios=[rxg / ryg, rxa / rya])
ax1 = f.add_subplot(gs1[0])
ax2 = f.add_subplot(gs1[1])

# GRL
ax = ax1
ax.set_facecolor(c_ocean)

dfg_coast.plot(ax=ax, edgecolor='k', facecolor=c_land, linewidth=0.2);
dfg_ice.plot(ax=ax, edgecolor='k', facecolor=c_icesheet, linewidth=0.2);
dfg_hide.plot(ax=ax, edgecolor=c_icesheet, facecolor=c_icesheet);

dfg_rgi.loc[dfg_rgi.Connect == 0].plot(ax=ax, edgecolor=c_glaciers, facecolor=c_glaciers, linewidth=0.2);
dfg_rgi.loc[dfg_rgi.Connect == 1].plot(ax=ax, edgecolor=c_glaciers_1, facecolor=c_glaciers_1, linewidth=0.2);
dfg_rgi.loc[dfg_rgi.Connect == 2].plot(ax=ax, edgecolor=c_glaciers_2, facecolor=c_glaciers_2, linewidth=0.2);



ax.set_xlim(xg);
ax.set_ylim(yg);
ax.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False) 
ax.tick_params(axis='y', which='both', left=False, right=False, labelleft=False) 

handles = []
handles.append(mpatches.Patch(facecolor=c_glaciers, label='Level 0'))
handles.append(mpatches.Patch(facecolor=c_glaciers_1, label='Level 1'))
handles.append(mpatches.Patch(facecolor=c_glaciers_2, label='Level 2'))
ax.legend(handles=handles, loc='lower right', title='Connectivity');

# Scale
w = 5e5
h = 0.004
l = 0.02
t = 0.01
xc = [xg[0] + rxg*l, xg[0] + rxg*l + w, xg[0] + rxg*l + w, xg[0] + rxg*l]
yc = [yg[0] + ryg*t, yg[0] + ryg*t, yg[0] + ryg*t+ h*ryg, yg[0] + ryg*t + h*ryg]
gpd.GeoSeries([shpg.Polygon(np.array([xc, yc]).T)]).plot(ax=ax, facecolor='k', edgecolor='k')
ax.text((xc[0] + xc[1])/2, yc[1] + ryg * t, '500 km', ha='center', fontsize=12)

# place a text box in upper left in axes coords
ax.text(0.02 * ryg / rxg, 0.96, 'a', transform=ax.transAxes, fontsize=14, bbox={'facecolor':'w', 'edgecolor':'k', 'boxstyle':'round'})

# AA
ax = ax2
ax.set_facecolor(c_ocean)

dfa.loc[dfa.cst00srf == 'land'].plot(ax=ax, edgecolor='k', facecolor=c_icesheet, linewidth=0.1);
dfa.loc[dfa.cst00srf == 'ice shelf'].plot(ax=ax, edgecolor='k', facecolor=c_shelf, linewidth=0.1);
dfa.loc[dfa.feat_type == 'ice rise'].plot(ax=ax, edgecolor='k', facecolor=c_rise, linewidth=0.1);
dfa.loc[dfa.feat_type == 'rumple'].plot(ax=ax, edgecolor='k', facecolor=c_rise, linewidth=0.1);
dfa.loc[dfa.cst00srf == 'ice tongue'].plot(ax=ax, edgecolor='k', facecolor=c_shelf, linewidth=0.1);

dfag.plot(ax=ax, edgecolor=cols[3], facecolor=cols[3], linewidth=0.2);
dfam.plot(ax=ax, edgecolor=cols[-4], facecolor=cols[-4], linewidth=0.2);

ax.set_xlim(xa);
ax.set_ylim(ya);
ax.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False) 
ax.tick_params(axis='y', which='both', left=False, right=False, labelleft=False) 

handles = []
handles.append(mpatches.Patch(facecolor=c_shelf, label='Ice shelf/tongue'))
handles.append(mpatches.Patch(facecolor=c_rise, label='Ice rise/rumple'))
handles.append(mpatches.Patch(facecolor=c_glaciers, label='RGI6 considered in M22'))
handles.append(mpatches.Patch(facecolor=c_removed, label='RGI6 removed in M22'))
ax.legend(handles=handles, loc='lower left');

# Scale
l = 0.9
xc = [xa[0] + rxa*l, xa[0] + rxa*l + w, xa[0] + rxa*l + w, xa[0] + rxa*l]
yc = [ya[0] + rya*t, ya[0] + rya*t, ya[0] + rya*t+ h*rya, ya[0] + rya*t + h*rya]
gpd.GeoSeries([shpg.Polygon(np.array([xc, yc]).T)]).plot(ax=ax, facecolor='k', edgecolor='k')
ax.text((xc[0] + xc[1])/2, yc[1]+rya*t, '500 km', ha='center', fontsize=12)

ax.text(0.02 * rya / rxa, 0.96, 'b', transform=ax.transAxes, fontsize=14, bbox={'facecolor':'w', 'edgecolor':'k', 'boxstyle':'round'})

plt.tight_layout()
plt.savefig('plot_maps_deep.png', dpi=300, bbox_inches='tight');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19570815450643778, 'fraction_numerical': 0.045150214592274675, 'mean_word_length': 6.546632124352332, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '175792', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2833, 'n_tokens_neox': 2691, 'n_words': 413, 'path': 'maps.ipynb', 'repo_name': 'fmaussion/global_glacier_volume_figure', 'size': '5825'}