In [35]:
# -*- coding: utf-8 -*-
%matplotlib inline
from __future__ import print_function
import pylab as plt
import datetime
import numpy as np
plt.rcParams['figure.figsize'] = (14, 6)
In [ ]:
In [36]:
snow_temp = np.array([0., 0., -0.1, -0.2, -0.5, -0.7, -0.8, -0.8, -1., -1., -1., -1., -1.1, -1.1, -1.2, -1.3, -1.5, -1.7, -1.9, -2., -2.4, -2.9, -3.2, -3.8, -4.3, -5.1, -5.9, -6.7, -8., -9.2, -12.2, -15.3, -15.8, -15.6, -14.9, -14.8, -13.7, -13.9, -14.1, -12.3, -11.1, -11.5, -12.0, -12.3, -12.8, -13.5, -14.6, -15.1, -15.7, -16., -16.1, -16.2, -16.4, -17.1, -17.3, -17.8, -17.8, -17.9, -17.9, -18., -18.1, -18.0, -17.8, -17.7, -17.5, -17.3, -17.3, -17.3, -17.2, -17.2])
snow_depth = np.linspace(0, 70, len(snow_temp))
snow_temp_grad = np.gradient(snow_temp, (snow_depth[1]-snow_depth[2])*0.01)
print(len(snow_temp))
# and now with poorer resolution like from a pit using a thermometer
measurements = [0, 10, 20, 30, 40, 45, 50, 55, 60, 65, 67]
snow_temp_lowres = snow_temp[measurements[:-1]]
snow_depth_lowres = snow_depth[measurements]
snow_temp_grad_lowres = np.gradient(snow_temp_lowres, np.diff(snow_depth_lowres)*0.01)
In [45]:
f, (ax_t, ax_g) = plt.subplots(1, 2, sharey=True)
ax_t.plot(snow_temp, snow_depth, label="temperature profile {0:.0f} cm resolution".format(snow_depth[1]-snow_depth[0]))
ax_t.plot(snow_temp_lowres, snow_depth_lowres[:-1], label="temperature profile {0:.0f} to {1:.0f} cm resolution".format(snow_depth_lowres[-2]-snow_depth_lowres[-3], snow_depth_lowres[1]-snow_depth_lowres[0]))
ax_t.scatter(snow_temp_lowres, snow_depth_lowres[:-1])
ax_g.plot(snow_temp_grad, snow_depth)
ax_g.plot(snow_temp_grad_lowres, snow_depth_lowres[:-1])
ax_t.set_xlabel("Snow pack temperature (C)")
ax_g.set_xlabel("Temperature gradient (C/m)")
ax_t.set_ylabel("Snow height (cm)")
ax_t.legend()
# Make a plot where T-grad is measured only between top and bottom
Out[45]:
In [ ]:
In [ ]: