In [1]:
%cd /vagrant/source/charistools/test/test_files
%ls
In [2]:
from charistools.hypsometry import Hypsometry
import numpy as np
import pandas as pd
In [3]:
sol_hyps = Hypsometry('test_basin.500.ALBEDO_MCD.0035.snow_off_ice.dat')
t_hyps = Hypsometry('test_basin.500.temperature.dat')
In [4]:
sol = sol_hyps.data.copy()
t = t_hyps.data.copy()
In [5]:
sol, t
Out[5]:
In [14]:
t[['4000.','5000.']]
Out[14]:
In [18]:
#melt = sol.multiply(t[['4000.','5000.']],fill_value=0.)
melt = sol * t[['4000.','5000.']]
melt
Out[18]:
In [6]:
sol.index
Out[6]:
In [ ]:
ddfs = np.arange(len(sol.index))
ddf_series = pd.Series(data=ddfs, index=sol.index, name="Snow_DDF_mm_pday_pdegC")
ddf_series
In [ ]:
sol.multiply(ddf_series, axis=0)
In [21]:
sol
Out[21]:
In [22]:
sol * 10
Out[22]:
In [ ]:
doy = sol.index.dayofyear
In [ ]:
doy
In [ ]:
type(sol.index)
In [ ]:
tmp = sol.index
tmp
In [ ]:
test = tmp[0].replace(year=2000)
test
new = [test]
new
In [ ]:
import calendar
In [ ]:
leaptest = [calendar.isleap(year) for year in sol.index.year]
leaptest
In [ ]:
leaptest[0] = True
leaptest
In [ ]:
daysinyear = [366 if x else 365 for x in leaptest]
In [ ]:
print(isleap)
print(daysinyear)
In [ ]:
for x in isleap:
print x
In [ ]:
[1 if isleap[x] else 365 for x in isleap]
In [33]:
pow(10.,-4)
Out[33]:
In [ ]: