|
28 | 28 | TZ_UTC = ZoneInfo("UTC") |
29 | 29 | TZ_PACIFIC = ZoneInfo("America/Los_Angeles") |
30 | 30 |
|
| 31 | +DATETIME_FORMAT = "%a %b %d %H:%M (Pacific)" |
| 32 | +"""Format used when formatting datetimes.""" |
| 33 | + |
31 | 34 | FEET_PER_METER = 3.28 |
32 | 35 |
|
33 | 36 | NUM_FORECASTS = 145 # 1 + 24 * 6 hours |
@@ -330,7 +333,7 @@ def main( |
330 | 333 |
|
331 | 334 | ax.set_ylim(0) |
332 | 335 | ax.set_ylabel("Significant wave height (ft)") |
333 | | - ax.set_xlabel("Pacific Time") |
| 336 | + ax.set_xlabel("Time (Pacific)") |
334 | 337 | ax.legend(loc="upper right") |
335 | 338 | ax.grid(linestyle=":") |
336 | 339 |
|
@@ -367,19 +370,19 @@ def main( |
367 | 370 | plot_dir.mkdir(parents=True, exist_ok=True) |
368 | 371 | for hour_i in tqdm(range(NUM_FORECASTS)): |
369 | 372 | pacific_time = analysis_date_pacific + datetime.timedelta(hours=hour_i) |
370 | | - pacific_time_str = pacific_time.strftime("%a %b %d %H:%M PT") |
| 373 | + pacific_time_str = pacific_time.strftime(DATETIME_FORMAT) |
371 | 374 |
|
372 | 375 | img.set_data(wave_height_ft[hour_i]) |
373 | 376 | update_arrows(arrow_heading_rad[hour_i], lats=lats, lons=lons, arrows=arrows, latlon_idxs=arrow_latlon_idxs) |
374 | 377 |
|
375 | | - plt.title(f"Significant wave height (ft) and primary wave direction\nHour {hour_i:03} ({pacific_time_str})") |
| 378 | + plt.title(f"Significant wave height (ft) and primary wave direction\nHour {hour_i:03} -- {pacific_time_str}") |
376 | 379 | plt.savefig(plot_dir / f"{hour_i}.png") |
377 | 380 |
|
378 | 381 | # Get current time |
379 | 382 |
|
380 | 383 | now_utc = datetime.datetime.now(tz=TZ_UTC) |
381 | 384 | now_pacific = now_utc.astimezone(tz=TZ_PACIFIC) |
382 | | - now_pacific_str = now_pacific.strftime("%a %b %d %H:%M PT") |
| 385 | + now_pacific_str = now_pacific.strftime(DATETIME_FORMAT) |
383 | 386 |
|
384 | 387 | # Export HTML |
385 | 388 |
|
|
0 commit comments