Пример #1
0
# -*- coding: utf-8 -*-
"""Plot to demonstrate the qualitative1 colormap.
"""

import numpy as np
import matplotlib.pyplot as plt

from typhon.plots import (figsize, cmap2rgba)

x = np.linspace(0, 10, 100)

fig, ax = plt.subplots(figsize=figsize(10))
ax.set_prop_cycle(color=cmap2rgba('qualitative1', 7))
for c in np.arange(1, 8):
    ax.plot(x, (15 + x) * c, linewidth=3)
ax.set_xlim(x.min(), x.max())

fig.tight_layout()
plt.show()
Пример #2
0
data = csv.read('/home/lukas/Desktop/2016/35/CL.txt')
csv.read('/home/lukas/Desktop/2016/35/MASTER.txt', stack=False, output=data)

data['PYR_CBH'] = clb.estimate_cloud_height(data['L'], data['TT002'] + 273.15)

# 10 minute moving average
_, data['PYR_CBH'] = clb.math.moving_average(data['MPLTIME'], data['PYR_CBH'],
                                             10)
_, data['CL_WBU'] = clb.math.moving_average(data['MPLTIME'], data['CL_WBU'],
                                            10)

# Plots
plt.style.use('typhon')

fig, axes = plt.subplots(4, 2, figsize=figsize(15), sharex=True, sharey=True)
for cc, ax in zip(np.arange(1, 9), axes.ravel()):
    # mask = np.logical_and(data['CL_SCBG'] >= cc , data['CL_SCBG'] < cc + 1)
    mask = np.logical_and(np.ma.greater_equal(data['CL_SCBG'], cc),
                          np.ma.less(data['CL_SCBG'], cc + 1))

    sts = clb.math.compare_arrays(data['CL_WBU'][mask], data['PYR_CBH'][mask])

    ax.plot(data['MPLTIME'][mask],
            data['CL_WBU'][mask] / 1e3,
            color='darkblue',
            label='Ceilometer',
            linestyle='none',
            marker='.')
    ax.plot(data['MPLTIME'][mask],
            data['PYR_CBH'][mask] / 1e3,
Пример #3
0
# -*- coding: utf-8 -*-
"""Plot to demonstrate the vorticity colormap.
"""

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt

from typhon.plots import figsize

fig = plt.figure(figsize=figsize(10))
ax = fig.gca(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
surf = ax.plot_surface(X,
                       Y,
                       Z,
                       cmap='vorticity',
                       vmin=-80,
                       vmax=80,
                       rstride=1,
                       cstride=1,
                       linewidth=0)
fig.colorbar(surf)
fig.tight_layout()
plt.show()
Пример #4
0
# -*- coding: utf-8 -*-

"""Plot to demonstrate the phase colormap
"""

import numpy as np
import matplotlib.pyplot as plt

from typhon.cm import mpl_colors
from typhon.plots import figsize


x = np.linspace(0, 4 * np.pi, 200)
phase_shifts = np.linspace(0, 2 * np.pi, 10)

fig, ax = plt.subplots(figsize=figsize(10))
ax.set_prop_cycle(color=mpl_colors('phase', len(phase_shifts)))
for p in phase_shifts:
    ax.plot(x, np.sin(x + p), lw=2)
ax.set_xlim(x.min(), x.max())
ax.set_ylim(-1.2, 1.2)

fig.tight_layout()
plt.show()
Пример #5
0
data = csv.read('/home/lukas/Desktop/2016/35/CL.txt')
csv.read('/home/lukas/Desktop/2016/35/MASTER.txt', stack=False, output=data)

data['PYR_CBH'] = clb.estimate_cloud_height(data['L'], data['TT002']+273.15)

# 10 minute moving average
_, data['PYR_CBH'] = clb.math.moving_average(
                         data['MPLTIME'], data['PYR_CBH'], 10)
_, data['CL_WBU'] = clb.math.moving_average(
                         data['MPLTIME'], data['CL_WBU'], 10)

# Plots
plt.style.use('typhon')

fig, axes = plt.subplots(4, 2, figsize=figsize(15), sharex=True, sharey=True)
for cc, ax in zip(np.arange(1, 9), axes.ravel()):
    # mask = np.logical_and(data['CL_SCBG'] >= cc , data['CL_SCBG'] < cc + 1)
    mask = np.logical_and(np.ma.greater_equal(data['CL_SCBG'], cc),
                          np.ma.less(data['CL_SCBG'], cc + 1))

    sts = clb.math.compare_arrays(data['CL_WBU'][mask], data['PYR_CBH'][mask])

    ax.plot(
        data['MPLTIME'][mask],
        data['CL_WBU'][mask]/1e3,
        color='darkblue',
        label='Ceilometer',
        linestyle='none',
        marker='.')
    ax.plot(
Пример #6
0
# -*- coding: utf-8 -*-

"""Plot to demonstrate the vorticity colormap.
"""

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np

import typhon.cm
from typhon.plots import figsize

fig = plt.figure(figsize=figsize(10))
ax = fig.gca(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
surf = ax.plot_surface(X, Y, Z, cmap='vorticity', vmin=-80, vmax=80,
                       rstride=1, cstride=1, linewidth=0)
fig.colorbar(surf)
fig.tight_layout()
plt.show()
Пример #7
0
    def test_figsize(self):
        """Test golden ratio for figures sizes."""
        ret = plots.figsize(10)

        assert ret == (10, 6.1803398874989481)