Purpose of this notebook: Introduce you to:
At the end of this lesson, you should be able to read a MODICE hypsometry file, and:
In [1]:
%pylab inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from imp import reload
pd.set_option('display.max_rows', 370)
pd.set_option('display.max_columns', 90)
pd.set_option('display.width', 200)
In [2]:
import hypsometry
reload(hypsometry)
filename = "modice_area_by_elev/IN_Indus_at_Kotri.0100m.modicev03_area_by_elev.txt"
modice = hypsometry.Hypsometry()
modice.read( filename, verbose=True )
In [3]:
modice.data
Out[3]:
In [4]:
modice.data.ix[0].plot( title='IN_Indus_at_Kotri MODICE by elevation', kind='barh',figsize=(12,8) )
Out[4]:
In [5]:
fig, ax = plt.subplots(1,1)
ax.set_title('IN_Indus_at_Kotri MODICE by elevation')
ax.set_xlabel('MODICE Area($km^2$)')
ax.set_ylabel('Elevation ($m$)')
modice.data.ix[0].plot( kind='barh',figsize=(12,12))
ax.set_yticks( ax.get_yticks()[::10] )
ax.set_yticklabels( modice.data.columns[::10] )
Out[5]:
Ref: Racoviteanu, A. E., R. Armstrong, and M. W. Williams (2013), Evaluation of an ice ablation model to estimate the contribution of melting glacier ice to annual discharge in the Nepal Himalaya, Water Resour. Res., 49, 5117–5133, doi:10.1002/wrcr.20370.
In [6]:
import racovite_ablation_model
reload( racovite_ablation_model )
melt = racovite_ablation_model.run( modice, 5000., 0.6 )
In [7]:
melt.data
Out[7]:
In [8]:
melt.data.max(axis=1)
Out[8]:
In [9]:
melt.comments
Out[9]:
In [10]:
melt.comments.append( "ELA=500m" )
In [11]:
melt.comments.append( "db/dz=0.6m/100m" )
In [12]:
melt.comments
Out[12]:
In [13]:
out_filename = "modice_area_by_elev/IN_Indus_at_Kotri.0100m.racovite_clean_ice_melt_by_elev.txt"
melt.write( out_filename, verbose=True )
In [14]:
!cat modice_area_by_elev/IN_Indus_at_Kotri.0100m.racovite_clean_ice_melt_by_elev.txt
In [15]:
melt.data.ix[0].plot( title='IN_Indus_at_Kotri ablation melt by elevation', kind='barh',figsize=(12,8) )
Out[15]:
In [16]:
subset = melt.data[melt.data.columns[20:60]].ix[0]
subset
Out[16]:
In [17]:
label = 'Total melt=%.2f $km^3$' % ( melt.data.sum( axis=1 ).values[ 0 ] )
label
Out[17]:
In [18]:
subset = melt.data[melt.data.columns[20:60]].ix[0]
fig, ax = plt.subplots(1,1)
ax.set_title('IN_Indus_at_Kotri ablation model melt from MODICE')
ax.set_xlabel('Melt ($km^3$)')
ax.set_ylabel('Elevation ($m$)')
#melt.data.ix[0].plot( title='IN_Indus_at_Kotri ablation melt by elevation', kind='barh',figsize=(12,12))
subset.plot( title='IN_Indus_at_Kotri ablation melt by elevation', kind='barh',figsize=(12,12), label=label)
ax.set_yticks( ax.get_yticks()[::10] )
ax.set_yticklabels( subset.index[::10] )
ax.legend(loc='best')
Out[18]:
Exercise: There are modice files for the 5 CHARIS basins in the directory called modice_area_by_elev. Try running each basin with the following ELA and db/dz, plot the results, and compare them.
Basin Name | ELA (m) | db/dz (m/100m) |
---|---|---|
AM_AmuDarya_at_Chatly | 4600 | ? |
BR_Bramaputra_at_Bahadurabad | 5700 | 0.6 |
IN_Indus_at_Kotri | 5200 | 0.7 |
GA_Ganges_at_Paksey | 5700 | 0.6 |
SY_SyrDarya_at_TyumenAryk | 4100 | ?? |
In [44]:
basins = [ 'AM', 'SY', 'IN', 'GA', 'BR' ]
x1 = numpy.array( [ 1, 2, 3, 4, 5 ] )
x2 = x1 + 0.25
x3 = x2 + 0.25
area = numpy.array( [ 448967., 249068., 844673., 943244., 514184. ] )
ice = numpy.array( [ 12343.5, 2398.14, 29858.8, 10812.1, 18678.7 ] )
fig, ax = plt.subplots(1,1)
figsize( 12, 8 )
ax.set_title('CHARIS Basins')
ax.set_ylabel('Area (x $10^3$ $km^2$)')
plt.bar( x2, area / 1000., width=0.25, color='grey', label='Basin Area' )
plt.bar( x3, ice / 1000., width=0.25, color='blue', label='MODICE' )
ax.set_xticks( x3 )
ax.set_xticklabels( basins )
ax.legend(loc='best')
fig.savefig('/Users/mj/2014/AGU/ablation_gradient/charis_basin_ice_area.png', dpi=300 ) # change filename to .pdf to save to different format
In [49]:
basins = [ 'AM', 'SY', 'IN', 'GA', 'BR' ]
x1 = numpy.array( [ 1, 2, 3, 4, 5 ] )
x2 = x1 + 0.25
x3 = x2 + 0.25
discharge = numpy.array( [ 43.2, 16.6, 90.5, 379.9, 690.5 ] )
discharge_stdev = numpy.array( [ 11.4, 8.1, 24.9, 77.4, 122.2 ] )
total = numpy.array( [ 100., 100., 100., 100., 100. ] )
high_melt = numpy.array( [ 9.2, 1.5, 42.6, 22.2, 88.5 ] )
mid_high_melt = numpy.array( [ 6.1, 1.0, 31.8, 15.6, 66.7 ] )
mid_low_melt = numpy.array( [ 5.2, 0.6, 23.8, 13.6, 63.2 ] )
low_melt = numpy.array( [ 3.4, 0.4, 17.7, 9.6, 47.6 ] )
#melt = numpy.array()
fig, ax = plt.subplots(1,1)
figsize( 12, 8 )
ax.set_title('Modeled Ice Melt (% of GRDC Discharge)', fontsize=20 )
ax.set_ylabel('% of Measured Discharge', fontsize=20 )
ax.set_ylim( [0,55] )
ax.set_xlim( [0,6] )
plt.plot( x1, high_melt / discharge * 100., linestyle='', markersize=20., marker='o', color='blue' )
plt.plot( x1, mid_high_melt / discharge * 100., linestyle='', markersize=20., marker='o', color='blue' )
plt.plot( x1, mid_low_melt / discharge * 100., linestyle='', markersize=20., marker='o', color='blue' )
plt.plot( x1, low_melt / discharge * 100., linestyle='', markersize=20., marker='o', color='blue' )
plt.text( 1, high_melt[0] / discharge[0] * 100. + 2., str(discharge[0])+' +/- '+str(discharge_stdev[0])+" $km^3$", horizontalalignment='center', fontsize=20 )
plt.text( 2, high_melt[1] / discharge[1] * 100. + 2., str(discharge[1])+' +/- '+str(discharge_stdev[1])+" $km^3$", horizontalalignment='center', fontsize=20 )
plt.text( 3, high_melt[2] / discharge[2] * 100. + 2., str(discharge[2])+' +/- '+str(discharge_stdev[2])+" $km^3$", horizontalalignment='center', fontsize=20 )
plt.text( 4, high_melt[3] / discharge[3] * 100. + 2., str(discharge[3])+' +/- '+str(discharge_stdev[3])+" $km^3$", horizontalalignment='center', fontsize=20 )
plt.text( 5, high_melt[4] / discharge[4] * 100. + 2., str(discharge[4])+' +/- '+str(discharge_stdev[4])+" $km^3$", horizontalalignment='center', fontsize=20 )
ax.set_xticks( x1 )
ax.set_xticklabels( basins, fontsize=20 )
ax.set_yticklabels( numpy.array([0,10,20,30,40,50]), fontsize=20 )
fig.savefig('/Users/brodzik/2014/AGU/ablation_gradient/charis_discharge_vs_ice_melt.ps', dpi=300 ) # change filename to .pdf to save to different format
In [ ]:
k