Fix capitalization on map annotations
This commit is contained in:
parent
ed7c5bf317
commit
93da3d701f
2 changed files with 19 additions and 4 deletions
|
@ -5,8 +5,8 @@ import cairo
|
||||||
import shapely
|
import shapely
|
||||||
|
|
||||||
from xmet.db import Database
|
from xmet.db import Database
|
||||||
from xmet.sounding import Sounding
|
from xmet.sounding import Sounding, SoundingParams
|
||||||
from xmet.skew_t import SkewTGraph, SkewTLegend
|
from xmet.skew_t import SkewTOptions, SkewTGraph, SkewTLegend
|
||||||
from xmet.hodograph import Hodograph
|
from xmet.hodograph import Hodograph
|
||||||
|
|
||||||
IMAGE_WIDTH = 800
|
IMAGE_WIDTH = 800
|
||||||
|
@ -18,6 +18,19 @@ GRAPH_HEIGHT = 800 - 128
|
||||||
def plot_skew_t(sounding: Sounding, output: str):
|
def plot_skew_t(sounding: Sounding, output: str):
|
||||||
print(f"Plotting Skew-T chart of {sounding.station} sounding at {sounding.timestamp_observed} to {output}")
|
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:
|
with cairo.SVGSurface(output, IMAGE_WIDTH, IMAGE_HEIGHT) as surface:
|
||||||
cr = cairo.Context(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.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT)
|
||||||
cr.fill()
|
cr.fill()
|
||||||
|
|
||||||
skew_t = SkewTGraph(GRAPH_WIDTH, GRAPH_HEIGHT)
|
skew_t = SkewTGraph(GRAPH_WIDTH, GRAPH_HEIGHT, opts)
|
||||||
skew_t.draw(cr, 64, 64, sounding)
|
skew_t.draw(cr, 64, 64, sounding)
|
||||||
|
|
||||||
cr.set_source_rgb(0, 0, 0)
|
cr.set_source_rgb(0, 0, 0)
|
||||||
|
|
|
@ -58,7 +58,9 @@ def render_probabilistic(conus: SPCOutlookMap,
|
||||||
if args.dark:
|
if args.dark:
|
||||||
cr.set_source_rgb(1, 1, 1)
|
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 = argparse.ArgumentParser(description='Render graphical SPC outlooks from text file')
|
||||||
argparser.add_argument('db', help='Spatialite database file')
|
argparser.add_argument('db', help='Spatialite database file')
|
||||||
|
|
Loading…
Add table
Reference in a new issue