2026_29_june.html
001| """Weather Data for June 2026."""
002|
003| from os import path
004| from datetime import datetime
005| import matplotlib.pyplot as plt
006| import matplotlib.ticker as mlticks
007| import matplotlib.dates as mldates
008|
009| BasePath = r'C:\CJS\prj\Python\app\weather'
010| ImgsPath = path.join(BasePath, 'img')
011|
012|
013|
014| Captions = [
015| "Time",
016| "Temp. (ºF)",
017| "Feel (ºF)",
018| "Cloud Cover (%)",
019| "Humidity (%)",
020| "Dew Point (ºF)",
021| "Barometer (inHg)",
022| "Wind Speed (mph)",
023| "Wind Direction",
024| "Wind Gust (mph)",
025| "1hr. Precip / Rainfall (in)",
026| "Snow Depth (in)",
027| ]
028|
029|
030| Table = [
031| "0 73 77 80% 87% 68.7 29.69 6.9 SE 19.1 0.1 0",
032| "1 71 71 76% 89% 68.7 29.64 9 SE 23.1 0.03 0",
033| "2 74 78 79% 90% 70.8 29.64 6.5 SE 18.6 0.06 0",
034| "3 74 78 76% 92% 71.4 29.65 7.6 SE 13.9 0.01 0",
035| "4 72 76 79% 92% 70.3 29.67 8.1 SE 14.4 0.11 0",
036| "5 72 77 85% 92% 70.8 29.65 8.9 SSE 15.1 0 0",
037| "6 75 79 95% 93% 72.4 29.65 9.2 SSE 14.5 0 0",
038| "7 75 80 10% 93% 73.1 29.65 13.1 SSE 16.6 0 0",
039| "8 77 82 76% 89% 74.6 29.65 7.8 SSE 22.7 0.06 0",
040| "9 80 86 33% 82% 75 29.64 9.1 SSE 15.1 0 0",
041| "10 83 91 20% 74% 76.1 29.66 9.7 SSE 14.2 0 0",
042| "11 89 105 3% 65% 79.6 29.65 10.9 SSE 15.4 0 0",
043| "12 88 102 80% 66% 78.2 29.64 12 SSE 17 0 0",
044| "13 90 105 80% 61% 78.3 29.64 16.3 S 23 0 0",
045| "14 91 105 34% 60% 77.8 29.62 17 S 24.8 0 0",
046| "15 93 108 72% 58% 77.6 29.61 17.2 S 28.8 0 0",
047| "16 93 108 22% 57% 77.1 29.6 17.2 S 29 0 0",
048| "17 93 108 25% 58% 77.4 29.6 14.5 S 26.3 0 0",
049| "18 91 106 74% 58% 77.8 29.59 16.3 S 23.2 0.02 0",
050| "19 90 104 89% 58% 77.2 29.6 15.7 S 25.1 0.02 0",
051| "20 88 101 78% 63% 77.6 29.58 14.5 S 25.6 0.01 0",
052| "21 83 91 89% 67% 75.6 29.61 13.9 S 25.8 0.15 0",
053| "22 81 87 75% 69% 74.1 29.62 14.1 S 29.7 0.2 0",
054| "23 80 86 88% 72% 74.4 29.63 11.3 SSW 25.1 0.06 0",
055| ]
056|
057|
058|
059| def make_chart (data):
060| filename = path.join(BasePath, 'hourly temps 2026-06-29')
061|
062| xs = [t[0] for t in data]
063| ys1 = [t[1] for t in data]
064| ys2 = [t[2] for t in data]
065| ys3 = [t[3] for t in data]
066| ys4 = [int(t[4][:-1]) for t in data]
067|
068| fig, ax = plt.subplots()
069| fig.suptitle(f'Hourly Temps for June 29, 2026', fontsize=14, fontweight='bold')
070| fig.set_figwidth(8.8)
071| fig.set_figheight(4.0)
072| fig.subplots_adjust(left=0.075, right=0.985, bottom=0.12, top=0.92)
073|
074| ax.set_xlabel('Hour', fontsize=11, fontweight='bold')
075| ax.set_xlim(0, 23)
076| ax.xaxis.set_major_locator(mlticks.MultipleLocator(1))
077| ax.xaxis.set_minor_locator(mlticks.NullLocator())
078| ax.xaxis.set_major_formatter(mlticks.FormatStrFormatter('%02d'))
079| ax.xaxis.set_minor_formatter(mlticks.NullFormatter())
080|
081|
082|
083|
084|
085| ax.set_ylabel('Temp', fontsize=11, fontweight='bold')
086| ax.set_ylim(65.0, 115.0)
087| ax.yaxis.set_major_locator(mlticks.MultipleLocator(5.0))
088| ax.yaxis.set_minor_locator(mlticks.MultipleLocator(1.0))
089| ax.yaxis.set_major_formatter(mlticks.FormatStrFormatter('%.0f'))
090| ax.yaxis.set_minor_formatter(mlticks.NullFormatter())
091|
092| ax.grid(which='major', axis='both', color='#7f7f7f', lw=1.2,ls='-',zorder=1, alpha=1.0)
093| ax.grid(which='minor', axis='both', color='#bfbfbf', lw=0.6,ls='-',zorder=0, alpha=1.0)
094| ax.tick_params(which='major', axis='both', direction='out', color='#000000')
095| ax.tick_params(which='minor', axis='both', direction='out', color='#000000')
096|
097| ax.plot(xs,ys1, label='Feels Like', color='#ff0000', lw=3.0, alpha=0.75, zorder=13)
098| ax.plot(xs,ys2, label='Actual Temp', color='#df5f00', lw=3.0, alpha=0.75, zorder=12)
099| ax.plot(xs,ys3, label='Dew Point', color='#007f7f', lw=3.0, alpha=0.75, zorder=11)
100|
101| ax.fill_between(xs,ys2,ys3, color='#9f9f9f', lw=0, alpha=0.50, zorder=10)
102|
103| fig.legend(ncols=1, fontsize=10, loc='upper left', bbox_to_anchor=(0.08,0.91))
104|
105| fig.savefig(filename)
106| print('wrote: %s' % filename)
107| print()
108|
109|
110|
111| def main ():
112| print("Hr F/L AT DP Hum Press Wind")
113|
114| chart_data = []
115|
116|
117| for row in Table:
118|
119| hr,temp,feel,_,humid,dp,press,wind,tail = row.split('\t', 8)
120|
121|
122| hr = int(hr)
123| temp = int(temp)
124| feel = int(feel)
125| dp = float(dp)
126| press = float(press)
127| wind = float(wind)
128| print(f'{hr:02d}: {feel:3d} {temp} {dp:.1f} {humid} {press:5.2f} {wind:4.1f}')
129|
130|
131| cols = (hr,feel,temp,dp,humid)
132| chart_data.append(cols)
133| print()
134|
135|
136| make_chart(chart_data)
137|
138|
139| return chart_data
140|
141|
142|
143| if __name__ == "__main__":
144| print()
145| rv = main()
146| print()
147|
148| '''EOF'''
149|