In [1]:
%pylab notebook
import matplotlib.pyplot as plt


Populating the interactive namespace from numpy and matplotlib

In [2]:
from charistools.hypsometry import Hypsometry
from charistools.meltModels import PlotTriSurfInput
help(PlotTriSurfInput)


Help on function PlotTriSurfInput in module charistools.meltModels:

PlotTriSurfInput(ax, SOL_hyps, SOI_hyps, EGI_hyps, temperature_hyps, ice_hyps=None, title=None, SOL_color='seagreen', SOI_color='royalblue', EGI_color='darkorchid', temperature_color=[0.8, 0.8, 0.8], ice_color=[0.2, 0.2, 0.2], hline_temperature_C=0.0, linewidth=3, boxwidth_scale=0.75, verbose=False)
    Creates a time series plot of melt model inputs by day-of-year.
    
    Creates a time series of model inputs snow-on-land, snow-on-ice,
    exposed-glacier-ice, and ice area and average temperature by day-of-year.
    
    Args:
      ax: Axes object to add the plot to
    
      SOL_hyps: Hypsometry, snow-on-land area, km^2
    
      SOI_hyps: Hypsometry, snow-on-ice area, km^2
    
      EGI_hyps: Hypsometry, exposed-glacier-ice area, km^2
    
      temperature_hyps: Hypsometry, temperature, deg C
    
      ice_hyps: Hypsometry, ice area, km^2
    
      title: string, Axes title
    
      SOL_color: color for snow-on-land line
    
      SOI_color: color for snow-on-ice line
    
      EGI_color: color for exposed-glacier-ice line
    
      temperature_color: color for average temperature line
    
      ice_color: color for ice line
    
      hline_temperature_C: float, temperature value of horizontal line,
        degrees C
    
      line_width: line width
    
      verbose: boolean to turn on verbose output to stderr.
    
    Result:
      Returns Axes object


In [3]:
%cd /projects/CHARIS/charistools_test_data/derived_hypsometries/GA_SaptaKosi_at_Chatara
%ls


/projects/CHARIS/charistools_test_data/derived_hypsometries/GA_SaptaKosi_at_Chatara
GA_SaptaKosi_at_Chatara.0100m.modicev04_1strike_area_by_elev.txt
GA_SaptaKosi_at_Chatara.0100m.modicev04_2strike_area_by_elev.txt
GA_SaptaKosi_at_Chatara.0100m.modicev04_3strike_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2001.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2002.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2003.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2004.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2005.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2006.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2007.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2008.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2009.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2010.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2011.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2012.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2013.0100m.snow_on_land_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt
GA_SaptaKosi_at_Chatara.2014.0100m.snow_on_land_area_by_elev.txt

In [39]:
import glob
list = sort(glob.glob("GA_Sap*.2001.*txt"))
list
#sol = Hypsometry(filename='IN_Hunza_at_DainyorBridge.2001.0100m.snow_on_land_area_by_elev.txt')


Out[39]:
array([ 'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0040.exposed_glacier_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0040.snow_on_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0045.exposed_glacier_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0045.snow_on_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0050.exposed_glacier_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ALBEDO_MOD10A1.0050.snow_on_ice_area_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.ERA_Interim_downscale_uncorrected_tsurf.v0.2_by_elev.txt',
       'GA_SaptaKosi_at_Chatara.2001.0100m.snow_on_land_area_by_elev.txt'], 
      dtype='|S91')

In [40]:
sol = Hypsometry(list[-1])
soi = Hypsometry(list[1])
egi = Hypsometry(list[0])
temperature = Hypsometry(list[-2])

In [44]:
help(plt.subplots)


Help on function subplots in module matplotlib.pyplot:

subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)
    Create a figure with a set of subplots already made.
    
    This utility wrapper makes it convenient to create common layouts of
    subplots, including the enclosing figure object, in a single call.
    
    Keyword arguments:
    
      *nrows* : int
        Number of rows of the subplot grid.  Defaults to 1.
    
      *ncols* : int
        Number of columns of the subplot grid.  Defaults to 1.
    
      *sharex* : string or bool
        If *True*, the X axis will be shared amongst all subplots.  If
        *True* and you have multiple rows, the x tick labels on all but
        the last row of plots will have visible set to *False*
        If a string must be one of "row", "col", "all", or "none".
        "all" has the same effect as *True*, "none" has the same effect
        as *False*.
        If "row", each subplot row will share a X axis.
        If "col", each subplot column will share a X axis and the x tick
        labels on all but the last row will have visible set to *False*.
    
      *sharey* : string or bool
        If *True*, the Y axis will be shared amongst all subplots. If
        *True* and you have multiple columns, the y tick labels on all but
        the first column of plots will have visible set to *False*
        If a string must be one of "row", "col", "all", or "none".
        "all" has the same effect as *True*, "none" has the same effect
        as *False*.
        If "row", each subplot row will share a Y axis and the y tick
        labels on all but the first column will have visible set to *False*.
        If "col", each subplot column will share a Y axis.
    
      *squeeze* : bool
        If *True*, extra dimensions are squeezed out from the
        returned axis object:
    
        - if only one subplot is constructed (nrows=ncols=1), the
          resulting single Axis object is returned as a scalar.
    
        - for Nx1 or 1xN subplots, the returned object is a 1-d numpy
          object array of Axis objects are returned as numpy 1-d
          arrays.
    
        - for NxM subplots with N>1 and M>1 are returned as a 2d
          array.
    
        If *False*, no squeezing at all is done: the returned axis
        object is always a 2-d array containing Axis instances, even if it
        ends up being 1x1.
    
      *subplot_kw* : dict
        Dict with keywords passed to the
        :meth:`~matplotlib.figure.Figure.add_subplot` call used to
        create each subplots.
    
      *gridspec_kw* : dict
        Dict with keywords passed to the
        :class:`~matplotlib.gridspec.GridSpec` constructor used to create
        the grid the subplots are placed on.
    
      *fig_kw* : dict
        Dict with keywords passed to the :func:`figure` call.  Note that all
        keywords not recognized above will be automatically included here.
    
    Returns:
    
    fig, ax : tuple
    
      - *fig* is the :class:`matplotlib.figure.Figure` object
    
      - *ax* can be either a single axis object or an array of axis
        objects if more than one subplot was created.  The dimensions
        of the resulting array can be controlled with the squeeze
        keyword, see above.
    
    Examples::
    
        x = np.linspace(0, 2*np.pi, 400)
        y = np.sin(x**2)
    
        # Just a figure and one subplot
        f, ax = plt.subplots()
        ax.plot(x, y)
        ax.set_title('Simple plot')
    
        # Two subplots, unpack the output array immediately
        f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
        ax1.plot(x, y)
        ax1.set_title('Sharing Y axis')
        ax2.scatter(x, y)
    
        # Four polar axes
        plt.subplots(2, 2, subplot_kw=dict(polar=True))
    
        # Share a X axis with each column of subplots
        plt.subplots(2, 2, sharex='col')
    
        # Share a Y axis with each row of subplots
        plt.subplots(2, 2, sharey='row')
    
        # Share a X and Y axis with all subplots
        plt.subplots(2, 2, sharex='all', sharey='all')
        # same as
        plt.subplots(2, 2, sharex=True, sharey=True)


In [46]:
fig, ax = plt.subplots(1,3, figsize=(8,14))
PlotTriSurfInput(ax[0], sol, soi, egi, temperature, title="AM_Vakhsh inputs, t=0.40")


Out[46]:
(<matplotlib.axes._subplots.AxesSubplot at 0x7f0625925d50>,
 <matplotlib.axes._subplots.AxesSubplot at 0x7f0625941910>)

In [ ]: