Python Metrological Python Script For Weather (Pressure, Density and Temperature) Assessment
Python Metrological Python Script For Weather (Pressure, Density and Temperature) Assessment
# Index 3163720
# AERO 4
## file names
Cape_Town_file = "south.csv" # Change the file name
London_file = "north.csv" # Change the file name
## Title of graphs
Cape_Town_title = f"A LINE GRAPH TO PLOT THE DAILY\n SURFACE TEMPERATURE, PRESSURE AND DENSITY AT {southern.upper()} AERODROME"
London_title = f"A LINE GRAPH TO PLOT THE DAILY\n SURFACE TEMPERATURE, PRESSURE AND DENSITY AT {northern.upper()} AERODROME"
for i in Cape_Town_data:
_, _, Temp, Pres, _ = i.values()
T_k.append(float(Temp))
P_k.append(float(Pres))
rho_k.append(float(Pres)*1000/(287*(float(Temp)+273)))
for i in London_data:
_, _, Temp, Pres, _ = i.values()
T_p.append(float(Temp))
P_p.append(float(Pres))
rho_p.append(float(Pres)*1000/(287*(float(Temp)+273)))
# Plotting of data
fig, (grf1, ax1) = plt.subplots(2, 1, figsize=(12, 6))
color = "tab:red"
ax1.set_title(Cape_Town_title)
ax1.set_xlabel("Time (day)")
ax1.set_ylabel("Temperature (K)", color = color)
ax1.plot(range(1, 366), T_k, color= color)
ax1.tick_params(axis="y", labelcolor= color)
ax2 = ax1.twinx()
color = "tab:blue"
# ax2.spines["right"].set_position(("outward", ))
ax2.set_ylabel("Pressure (C)", color = color)
ax2.plot(range(1, 366), P_k, color= color)
ax2.tick_params(axis="y", labelcolor= color)
ax3 = ax1.twinx()
color = "tab:green"
ax3.spines["right"].set_position(("outward", 50))
ax3.set_ylabel("Density (Kg/m^3)", color = color)
ax3.plot(range(1, 366), rho_k, color= color)
ax3.tick_params(axis="y", labelcolor= color)
# --------------------------------------------------------------------
grf1.set_title(London_title)
color = "tab:red"
grf1.set_xlabel("Time (day)")
grf1.set_ylabel("Temperature (K)", color = color)
grf1.plot(range(1, 366), T_p, color= color)
grf1.tick_params(axis="y", labelcolor= color)
grf2 = grf1.twinx()
color = "tab:blue"
# ax2.spines["right"].set_position(("outward", ))
grf2.set_ylabel("Pressure (C)", color = color)
grf2.plot(range(1, 366), P_p, color= color)
grf2.tick_params(axis="y", labelcolor= color)
grf3 = grf1.twinx()
color = "tab:green"
grf3.spines["right"].set_position(("outward", 50))
grf3.set_ylabel("Density (Kg/m^3)", color = color)
grf3.plot(range(1, 366), rho_p, color= color)
grf3.tick_params(axis="y", labelcolor= color)
fig.tight_layout()
plt.show()
Follow the steps to use the Report Generator
Before you proceed, make sure that your data file is saved with the name north.csv for the northen hermisphere, and south.csv for the southern hermisphere.
Any variation from these names will render the code useless.
Also, ensure that both the code and the data files (CSV files) are in the same folder.
Open your CSV file and delete the first 11 lines, thus from the -BEGIN HEADER- to -END HEADER-. Leave everything else...
Enter the name of your airport in the north: London-Gatwick
Enter the name of your airport in the south: Cape Town
Cape_Town density counts: 365
London density counts: 365