<jupyter_start><jupyter_text>Example 2Read and explore the output from Example 2 -- a multidim parameter study that evaluates the effects of varying temperature and precipitation on sediment load values in [HydroTrend](http://csdms.colorado.edu/wiki/Model:HydroTrend). Use `pylab` magic:<jupyter_code>%pylab inline<jupyter_output><empty_output><jupyter_text>Read the Dakota tabular data file.<jupyter_code>dat_file = '../examples/2-hydrotrend/dakota.dat'
data = numpy.loadtxt(dat_file, skiprows=1, unpack=True, usecols=[0,2,3,4,5])<jupyter_output><empty_output><jupyter_text>Extract the temperature and precipitation parameter values from the tabular data array.<jupyter_code>T = data[1,]
P = data[2,]
print 'Temperature:'
print T
print 'Precipitation:'
print P<jupyter_output><empty_output><jupyter_text>Plot the multidim parameter study evaluation locations.<jupyter_code>plot(T, P, 'ro')
xlim((5, 25))
ylim((1, 3))
xlabel('$T \,(^{\circ}C)$')
ylabel('$P \,(m)$')
title('Planview of parameter study locations')<jupyter_output><empty_output><jupyter_text>Next, to make surface and contour plots of the Dakota responses, the $T$, $P$ and $Q_s$ values have to be reshaped into 2D arrays.<jupyter_code>m = len(set(T))
n = len(set(P))
T2 = T.reshape(n,m)
P2 = P.reshape(n,m)
Qs2 = data[3,].reshape(n,m)<jupyter_output><empty_output><jupyter_text>Make a wire mesh surface plot of the mean $Q_s$ values at the study locations.<jupyter_code>from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_wireframe(T2, P2, Qs2)
ax.set_xlabel('$T \,(^\circ C)$')
ax.set_ylabel('$P \,(m)$')
ax.set_zlabel('$Q_s \,(kg \, s^{-1})$')<jupyter_output><empty_output><jupyter_text>Make a contour plot of the mean $Q_s$ values at the study locations.<jupyter_code>contour(T2, P2, Qs2, 15, cmap=cm.Blues_r)
xlim((5, 25))
ylim((1, 3))
xlabel('$T \,(^\circ C)$')
ylabel('$P \,(m)$')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1578672242550967, 'fraction_numerical': 0.01986408782017773, 'mean_word_length': 7.214592274678112, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '389242', 'license': 'MIT', 'n_tokens_mistral': 767, 'n_tokens_neox': 743, 'n_words': 175, 'path': 'notebooks/2-hydrotrend.ipynb', 'repo_name': 'mdpiper/dakota-tutorial', 'size': '1913'}