In [1]:
%run talktools
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
sns.set_style('whitegrid')
from IPython.display import Image, display
EGU 2015 - PICO session on Open Source Computing in Hydrology
F Perez
Open, collaborative by definition.
Continuous, public process.
Reproducible by necessity.
Public bug tracking.
The use of licenses is essential (CC, BSD, GPL,...)
F Perez
What do we need:
We need to embed the entire lifecycle of a scientific idea:
Ipython (Jupyter!) Notebook can support on the different levels
Ipython (Jupyter!) Notebook... (this is a notebook!)
Check it out on https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks
In [2]:
# %load PDM_HPC.py
In [3]:
pars =pd.read_csv('data/example2_PDM_parameters.txt',header=0, sep=',', index_col=0)
measured = pd.read_csv('data/example_PDM_measured.txt', header=0, sep='\t', decimal='.', index_col=0)
modelled = pd.read_csv('data/example2_PDM_outputs.txt',header=0, sep=',', index_col=0).T
In [4]:
modeloutput1 = pd.DataFrame(modelled.iloc[:,0].values, index=measured.index)
Measured vs modelled discharge:
In [5]:
fig, ax = plt.subplots(figsize=(10, 6))
p1 = measured.plot(ax=ax, label='measured')
p2 = modeloutput1.plot(ax=ax, label='modelled')
t = ax.set_ylabel(r'Q m$^3$s$^{-1}$')
plt.legend(['measured', 'modelled'])
Out[5]:
In [6]:
from scatter_hist2 import create_scatterhist, create_seasonOF
names = pars.columns
time=np.array(measured.index)
modelled.index = time
pars_name={}
for i in range(0, names.size):
pars_name[names[i]]=i
In [7]:
objective_functions = create_seasonOF(modelled, measured)
In [8]:
from scatter_hist_season import create_scatterhist
In [9]:
scatter = create_scatterhist(pars, 2, 1, objective_functions, names,
objective_function='SSE',
threshold=0.4,
season = 'Winter')
In [10]:
scatter = create_scatterhist(pars, 2, 1, objective_functions, names,
objective_function='SSE',
threshold=0.4,
season = 'Spring')
In [12]:
#Loading interact functionality
from IPython.html.widgets import interact, fixed
interact(create_scatterhist,*args, **kwargs)
input list => dropdown
objective_function = ['SSE', 'RMSE', 'RRMSE']
season = ['Winter','Summer',
'Spring', 'Autumn','All season']
input array => slider
threshold=(0,1,0.005)
Github Stijn Van Hoey stvhoey.vanhoey@ugent.be, @SVanHoey
Github Sophie sophie.balemans@ugent.be
In [ ]:
In [ ]: