From 93da3d701f24d1938eceb34500e81100dcbc4e22 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Mon, 31 Mar 2025 15:19:38 -0400 Subject: [PATCH] Fix capitalization on map annotations --- bin/xmet-sounding-plot | 19 ++++++++++++++++--- bin/xmet-spc-render-file | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/xmet-sounding-plot b/bin/xmet-sounding-plot index d05bb2e..14b0f06 100755 --- a/bin/xmet-sounding-plot +++ b/bin/xmet-sounding-plot @@ -5,8 +5,8 @@ import cairo import shapely from xmet.db import Database -from xmet.sounding import Sounding -from xmet.skew_t import SkewTGraph, SkewTLegend +from xmet.sounding import Sounding, SoundingParams +from xmet.skew_t import SkewTOptions, SkewTGraph, SkewTLegend from xmet.hodograph import Hodograph IMAGE_WIDTH = 800 @@ -18,6 +18,19 @@ GRAPH_HEIGHT = 800 - 128 def plot_skew_t(sounding: Sounding, output: str): print(f"Plotting Skew-T chart of {sounding.station} sounding at {sounding.timestamp_observed} to {output}") + opts = SkewTOptions() + opts.skew = 1.0 + opts.draw_virtual_temp = True + opts.draw_lcl = True + opts.draw_lfc = True + opts.draw_el = True + opts.draw_moist_adiabats = True + opts.draw_cape_mixing_ratio = True + opts.draw_cape_dry_adiabat = True + opts.draw_cape_moist_adiabat = True + + #params = SoundingParams.from_sounding(sounding) + with cairo.SVGSurface(output, IMAGE_WIDTH, IMAGE_HEIGHT) as surface: cr = cairo.Context(surface) @@ -25,7 +38,7 @@ def plot_skew_t(sounding: Sounding, output: str): cr.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT) cr.fill() - skew_t = SkewTGraph(GRAPH_WIDTH, GRAPH_HEIGHT) + skew_t = SkewTGraph(GRAPH_WIDTH, GRAPH_HEIGHT, opts) skew_t.draw(cr, 64, 64, sounding) cr.set_source_rgb(0, 0, 0) diff --git a/bin/xmet-spc-render-file b/bin/xmet-spc-render-file index 9292215..d906c6a 100755 --- a/bin/xmet-spc-render-file +++ b/bin/xmet-spc-render-file @@ -58,7 +58,9 @@ def render_probabilistic(conus: SPCOutlookMap, if args.dark: cr.set_source_rgb(1, 1, 1) - conus.draw_annotation(cr, f"Day {outlook.day} Probabilistic {hazard.lower().capitalize()} Risk") + hazard = ' '.join(map(lambda p: p.lower().capitalize(), hazard.split(' '))) + + conus.draw_annotation(cr, f"Day {outlook.day} Probabilistic {hazard} Risk") argparser = argparse.ArgumentParser(description='Render graphical SPC outlooks from text file') argparser.add_argument('db', help='Spatialite database file')