2026_10_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 87% 72% 66.8 29.71 11.9 SE 28.4 0.11 0",
032|     "1 73 77 83% 76% 68.3 29.63 13.2 SE 23.3 0.03 0",
033|     "2 73 77 78% 80% 68.7 29.59 13.6 SE 21.5 0 0",
034|     "3 72 72 0% 84% 68.6 29.61 7.8 SSW 25.4 0 0",
035|     "4 71 71 0% 87% 68.7 29.6 8.9 SSE 18.9 0 0",
036|     "5 72 76 87% 88% 70.6 29.57 8.7 SSE 18.4 0 0",
037|     "6 72 76 70% 94% 67.8 29.58 10.7 SSE 19.4 0.04 0",
038|     "7 71 71 89% 91% 68 29.54 11 S 19.8 0.05 0",
039|     "8 74 78 0% 87% 69 29.53 8.2 S 19.4 0 0",
040|     "9 77 82 82% 87% 71.4 29.54 11.2 SSW 18.7 0 0",
041|     "10 80 85 1% 76% 71.8 29.53 7.6 S 17.8 0 0",
042|     "11 81 85 76% 67% 75.7 29.52 11 SSW 21.8 0.03 0",
043|     "12 83 92 81% 85% 75.1 29.51 10.1 S 23.1 0.01 0",
044|     "13 80 84 78% 69% 71.5 29.5 10.3 SSW 24.1 0.02 0",
045|     "14 77 81 56% 74% 70.6 29.48 12.1 SSW 26.6 0.02 0",
046|     "15 82 84 88% 56% 72.3 29.47 13.6 SW 24 0.03 0",
047|     "16 85 87 71% 49% 70.4 29.45 12.5 SW 25.7 0.01 0",
048|     "17 82 86 75% 65% 66.9 29.44 12.5 WSW 24.5 0 0",
049|     "18 80 83 76% 67% 70.1 29.42 9.4 WSW 23.5 0 0",
050|     "19 82 84 88% 60% 65.2 29.44 9.7 W 17.7 0 0",
051|     "20 80 83 0% 66% 60.4 29.48 13.2 W 19.4 0 0",
052|     "21 77 79 0% 68% 60.6 29.51 12.3 W 22.3 0 0",
053|     "22 74 77 0% 68% 59.7 29.56 8.8 WNW 20 0 0",
054|     "23 72 72 0% 67% 58.2 29.57 7.4 WNW 15.2 0 0",
055| ]
056| 
057| 
058| ##================================================================================================##
059| def make_chart (data):
060|     filename = path.join(BasePath, 'hourly temps 2026-06-10')
061| 
062|     xs  = [t[0] for t in data]
063|     ys1 = [t[1] for t in data] # feels-like temp
064|     ys2 = [t[2] for t in data] # actual temp
065|     ys3 = [t[3] for t in data] # dew point
066|     ys4 = [int(t[4][:-1]) for t in data] # humidity (string)
067| 
068|     fig, ax = plt.subplots()
069|     fig.suptitle(f'Hourly Temps for June 10, 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|     #for tick in ax.xaxis.get_major_ticks():
082|     # tick.label1.set_rotation('vertical')
083|     # tick.label1.set_size(9)
084| 
085|     ax.set_ylabel('Temp', fontsize=11, fontweight='bold')
086|     ax.set_ylim(50.0, 100.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|     # Generate chart data from Table data...
117|     for row in Table:
118|         # Extract columns...
119|         hr,temp,feel,_,humid,dp,press,wind,tail = row.split('\t', 8)
120| 
121|         # Convert strings to numerical data...
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|         # Create a data tuple for the chart...
131|         cols = (hr,feel,temp,dp,humid)
132|         chart_data.append(cols)
133|     print()
134| 
135|     # Create the chart...
136|     make_chart(chart_data)
137| 
138|     # Return the chart data (FWIW)...
139|     return chart_data
140| 
141| 
142| ####################################################################################################
143| if __name__ == "__main__":
144|     print()
145|     rv = main()
146|     print()
147| ####################################################################################################
148| '''EOF'''
149|