Skip to content

Instantly share code, notes, and snippets.

@TaylorMutch
Created November 22, 2016 21:28
Show Gist options
  • Save TaylorMutch/2c68c43861d31fd15e8519a1c6a2a97e to your computer and use it in GitHub Desktop.
Save TaylorMutch/2c68c43861d31fd15e8519a1c6a2a97e to your computer and use it in GitHub Desktop.
An example for reading sodar data into a matplotlib chart.
from sodar_utils import SodarCollection
import matplotlib.pyplot as plt
import numpy as np
sodars = SodarCollection('sodar_data/Primet')
data = sodars.night_array('speed')
# Find the index of the specific night we're interested in
index = [i for i, j in enumerate(data[1]) if j['name']=='0518'][0]
# Get the data for just that night
night = np.transpose(data[0][index])[:26]
# Create the plot, with a color key
fig, ax = plt.subplots(figsize=(8,8))
cax = fig.add_axes([1.0, 0.1, 0.05, 0.8])
im = ax.imshow(night, aspect='auto', origin='lower', cmap='spectral', interpolation='none')
fig.colorbar(im, cax=cax)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment