Visualizing output from the Mass Balance workflow

This notebook is designed to work with output from the Mass Balance workflow [iceflow] developed during Geohackweek2016 at the University of Washington (https://github.com/dshean/iceflow).

1. Viewing the specific mass balance of glacier polygons

Set up the environment

This notebook requires the following packages:

matplotlib
shapely
geopandas

In [1]:
%matplotlib inline

import os

import matplotlib.pyplot as plt
# The two statements below are used mainly to set up a plotting
# default style that's better than the default from matplotlib
#import seaborn as sns
plt.style.use('bmh')

from shapely.geometry import Point
#import pandas as pd
import geopandas as gpd
from geopandas import GeoSeries, GeoDataFrame

Set file names and directories


In [2]:
file_pth = 'rgi_centralasia/13_rgi32_CentralAsia.shp'

rgi_glac = gpd.read_file(file_pth)

timeframe='[time between DEMs]'

rgi_glac.head()


Out[2]:
AREA BGNDATE CENLAT CENLON ENDDATE GLACTYPE GLIMSID NAME O1REGION O2REGION RGIFLAG RGIID geometry
0 0.455 -9999999 38.7047 72.9207 -9999999 9099 G072921E38705N None 13 3 Glacier RGI32-13.00001 POLYGON ((72.92587000000012 38.70524000000002,...
1 0.102 -9999999 38.8898 73.1162 -9999999 9099 G073116E38890N None 13 3 Glacier RGI32-13.00002 POLYGON ((73.11698000000005 38.89063000000004,...
2 0.792 -9999999 38.8849 73.1052 -9999999 9099 G073105E38885N None 13 3 Glacier RGI32-13.00003 POLYGON ((73.10908000027831 38.8796899994485, ...
3 0.113 -9999999 38.8765 73.1130 -9999999 9099 G073113E38877N None 13 3 Glacier RGI32-13.00004 POLYGON ((73.1127900000001 38.87709000000008, ...
4 0.124 -9999999 38.8800 73.1129 -9999999 9099 G073113E38880N None 13 3 Glacier RGI32-13.00005 POLYGON ((73.11370000000007 38.88089000000006,...

Plot the glacier outlines based on their specific mass balance


In [ ]:
# test data set-up
gdf = rgi_glac
gdf.plot()

In [ ]:
# test data set-up
import random
my_randoms = random.sample(xrange(-50,50), 15)
gdf["spec"]= my_randoms
gdf.to_file("rgi_test.shp")

In [ ]:
f, ax = plt.subplots(1, figsize=(6, 4))
rgi_glac.plot(column='[spec mb]', scheme='fisher_jenks', k=7, 
                         alpha=0.9, cmap=plt.cm.Blues, legend=True, ax=ax)
plt.axis('equal')
ax.set_title('Specific Mass Balance'+timeframe)