In [1]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
/Users/brodzik/miniconda/envs/charistools/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
In [5]:
from charistools.hypsometry import Hypsometry as hyps
from charistools.convertors import Csv2Hypsometry
import matplotlib.pyplot as plt
import numpy as np
# from scipy import stats
In [6]:
help(Csv2Hypsometry)
Help on function Csv2Hypsometry in module charistools.convertors:
Csv2Hypsometry(csv_filename, hyps_filename, comments=[], verbose=False)
from charistools.convertors import Csv2Hypsometry
charistools.convertors.Csv2Hypsometry(csv_filename, hyps_filename,
comments=[], verbose=False)
Arguments:
csv_filename : name of 3-column comma-separated value file
1st column is ignored,
2nd column: elevation in meters at
bottom of elevation band
3rd column: area in km^2 for the elevation band
hyps_filename : name of file to write converted data to
comments : list of strings
optional comments to add to output file
Name of input file will be written as the first line
of comments
verbose : boolean, default False
The Csv2Hypsometry utility converts a 3-column csv file with
hyposmetric information (for example from ArcGIS) into a
charistools Hypsometry file.
Assumes first line in the csv file is column headers, and ignores it.
In [11]:
filename = "/Users/brodzik/projects/CHARIS/pdd_melt_model/2015_paper/Hunza_calibration/best_model/" + \
"IN_Hunza_at_Danyour.2004.0100m.GRSIZE_SCAG.0215.ice_melt.dat"
new = hyps(filename=filename, verbose=True)
new
charistools.hypsometry : read hypsometry data from /Users/brodzik/projects/CHARIS/pdd_melt_model/2015_paper/Hunza_calibration/best_model/IN_Hunza_at_Danyour.2004.0100m.GRSIZE_SCAG.0215.ice_melt.dat
charistools.hypsometry : 17 comments.
charistools.hypsometry : 366 dates.
charistools.hypsometry : 64 elevations.
charistools.hypsometry : initialized new hypsometry object
Out[11]:
<charistools.hypsometry.Hypsometry instance at 0x10b93aa28>
In [12]:
new.data
Out[12]:
1400.
1500.
1600.
1700.
1800.
1900.
2000.
2100.
2200.
2300.
...
6800.
6900.
7000.
7100.
7200.
7300.
7400.
7500.
7600.
7700.
Date
2004-01-01
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-02
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-03
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-04
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-05
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-06
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-07
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-08
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-09
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-10
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-11
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-12
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-13
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-14
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-15
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-16
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-17
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-18
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-19
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-20
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-21
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-22
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-23
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-24
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-25
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-26
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-27
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-28
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-29
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-01-30
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
2004-12-02
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-03
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-04
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-05
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-06
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-07
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-08
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-09
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-10
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-11
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-12
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-13
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-14
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-15
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-16
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-17
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-18
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-19
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-20
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-21
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-22
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-23
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-24
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-25
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-26
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-27
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-28
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-29
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-30
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
2004-12-31
0
0
0
0
0
0
0
0
0
0
...
0
0
0
0
0
0
0
0
0
0
366 rows × 64 columns
In [19]:
#new.data['5000.']
stats.describe(new.data['5000.'])
Out[19]:
DescribeResult(nobs=366, minmax=(0.0, 0.0077400000000000004), mean=0.00041368852459016401, variance=1.5505296451830225e-06, skewness=3.6693347753107473, kurtosis=14.04215684573802)
In [24]:
plt.plot(new.data['5000.'])
Out[24]:
[<matplotlib.lines.Line2D at 0x115ff19d0>]
In [25]:
from charistools.modelEnv import ModelEnv
In [26]:
myEnv=ModelEnv()
charistools.modelEnv: Error(Config file not found: "modis_tiles_config.ini".)
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-26-4a9656c3c3d4> in <module>()
----> 1 myEnv=ModelEnv()
/Users/brodzik/anaconda2/envs/test/lib/python2.7/site-packages/charistools/modelEnv.py in __init__(self, tileConfigFile, topDir, verbose)
44
45 try:
---> 46 self.tileConfig = ConfigObj(self.tileConfigFile, file_error=True)
47 except Exception as e:
48 print (__name__ + ": Error({0})".format(e),
/Users/brodzik/anaconda2/envs/test/lib/python2.7/site-packages/configobj.pyc in __init__(self, infile, options, configspec, encoding, interpolation, raise_errors, list_values, create_empty, file_error, stringify, indent_type, default_encoding, unrepr, write_empty_values, _inspec)
1227 configspec = options['configspec']
1228 self._original_configspec = configspec
-> 1229 self._load(infile, configspec)
1230
1231
/Users/brodzik/anaconda2/envs/test/lib/python2.7/site-packages/configobj.pyc in _load(self, infile, configspec)
1238 elif self.file_error:
1239 # raise an error if the file doesn't exist
-> 1240 raise IOError('Config file not found: "%s".' % self.filename)
1241 else:
1242 # file doesn't already exist
IOError: Config file not found: "modis_tiles_config.ini".
In [29]:
strikes=2
strikes
Out[29]:
2
In [28]:
str(strikes)
Out[28]:
'1'
In [ ]:
test
Content source: mjbrodzik/ipython_notebooks
Similar notebooks: