Created
December 10, 2019 09:29
-
-
Save thomascamminady/ce23d9fffbeba59d4451fcb1b15c6fe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
sns.set_context("poster") | |
df = pd.read_csv("US_Standard_Atmosphere_1976.csv") | |
cols = list(df) | |
R = 287.058 | |
df[r"Density (kg/m${}^3$)"] = df["Static pressure (pascals)"]/df["Standard temperature (K) "]/R | |
cols = list(df) | |
heights = [int(height/1000) for height in df[cols[1]]] | |
fig,axs = plt.subplots(1,3,figsize=(24,10)) | |
#### TEMPERATURE | |
ax = axs[0] | |
ax.plot(df[cols[5]],df[cols[1]]/1000,'--o') | |
ax.grid(True) | |
ax.set_xlabel(cols[5],labelpad = 16) | |
ax.set_xlim(200,300) | |
ax.set_xticks([200+10*i for i in range(0,11,2)]) | |
ax.set_xticklabels([200+10*i for i in range(0,11,2)]) | |
ax.set_ylabel("Geopotential height above MSL (km)",labelpad = 10) | |
ax.set_ylim([0,80]) | |
ax.set_yticks(heights) | |
ax.set_yticklabels(heights) | |
#### DENSITY | |
ax = axs[1] | |
ax.semilogx(df[cols[-1]],df[cols[1]]/1000,'--o') | |
ax.grid(True) | |
ax.set_xlabel(cols[-1],labelpad = 10) | |
ax.set_xlim([10**(-5),10]) | |
ax.set_xticks([10**k for k in range(-5,2)]) | |
ax.set_yticks(heights) | |
ax.set_yticklabels([]) | |
ax.set_ylim([0,80]) | |
#### PRESSURE | |
ax = axs[2] | |
ax.semilogx(df[cols[3]]/1000,df[cols[1]]/1000,'--o') | |
ax.grid(True) | |
ax.set_xlabel("Static pressure (kPa)",labelpad = 10) | |
ax.set_xlim([10**(-3),10**3]) | |
ax.set_xticks([10**k for k in range(-3,4)]) | |
ax.set_yticks(heights) | |
ax.set_yticklabels([]) | |
ax.set_ylim([0,80]) | |
fig.align_labels() # same as fig.align_xlabels(); fig.align_ylabels() | |
plt.suptitle("The 1976 U.S. Standard Atmosphere",fontsize = 40); | |
plt.savefig("StandardAtmosphere1976.png",dpi = 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment