Skip to content
Snippets Groups Projects
Commit c48a6483 authored by Stefano Serafin's avatar Stefano Serafin
Browse files

added ability to sort shuffled observations before plotting

parent 40a747ed
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@ import os
import glob
import pandas as pd
is_sorted = lambda a: np.all(a[:-1] <= a[1:])
def decode_observations(observation_files):
# Read set of CSV files into a pandas dataframe.
......@@ -98,19 +100,30 @@ if __name__ == '__main__':
makeplots = True
# Make plots
if makeplots:
# If observations are shuffled, sort them again
ntimes = ocoords.shape[0]
for k in range(ntimes):
if is_sorted(ocoords[k,:]):
pass
else:
indices = np.argsort(ocoords[k,:])
ocoords[k,:] = ocoords[k,indices]
observations[k,:] = observations[k,indices]
fig, ax1 = p.subplots(1,1,constrained_layout=True)
fig.set_size_inches(4,3)
tint = 300
t = np.linspace(0,tint*(ocoords.shape[0]-1),ocoords.shape[0])[:,None]+np.zeros(ocoords.shape)
t = t/3600.
c = ax1.scatter(t,ocoords,s=5,c=observations,vmin=290,vmax=296)
#c = ax1.pcolormesh(t,ocoords,observations,vmin=290,vmax=296)
#ax1.contour(t,ocoords,observations,
# np.linspace(290,290+0.003*2000,13),
# colors='white',
# linestyles='--',
# linewidths=0.75)
#c = ax1.scatter(t,ocoords,s=5,c=observations,vmin=290,vmax=296)
c = ax1.pcolormesh(t,ocoords,observations,vmin=290,vmax=296)
ax1.contour(t,ocoords,observations,
np.linspace(290,290+0.003*2000,13),
colors='white',
linestyles='--',
linewidths=0.75)
ax1.set_ylim([0,2000])
ax1.set_ylabel(r'Height (m)')
ax1.set_xlabel(r'Time (s)')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment