Skip to content

Instantly share code, notes, and snippets.

@tommylees112
Last active April 6, 2021 17:01
Show Gist options
  • Save tommylees112/e6f7278ae063563d3831e039f68a83b4 to your computer and use it in GitHub Desktop.
Save tommylees112/e6f7278ae063563d3831e039f68a83b4 to your computer and use it in GitHub Desktop.
example script for loading in pandas csv file and a very basic SkewT plot
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
# make sure the data is loaded
data_dir = Path("/Users/tommylees/Downloads")
df = pd.read_csv(data_dir / "demo_sonde.csv", index_col=0)
# initialise plot
f, ax = plt.subplots()
ax.plot(df.temperature, df.pressure, label="Temperature")
ax.plot(df.dewpoint, df.pressure, label="Dewpoint")
ax.plot(df.parcel_profile, df.pressure, label="Parcel Lapse Rate", color="k")
# additional plot niceities
plt.legend()
ax.invert_yaxis()
ax.set_xlabel("Temperature [$^oC$]")
ax.set_ylabel("Pressure [hPa]")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment