Skip to content

Commit

Permalink
Add graph template examples using pngcairo terminal
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Dec 14, 2015
1 parent d2b937f commit bec24f6
Show file tree
Hide file tree
Showing 9 changed files with 464 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '15.12.0.dev1338'
_release = '1338'
_commit = 'f461de0'
__version__ = '15.12.0.dev1339'
_release = '1339'
_commit = 'd2b937f'
61 changes: 61 additions & 0 deletions src/pywws/examples/graph_templates/pngcairo/2014.png.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<graph>
<fileformat>pngcairo enhanced font "arial,10" rounded</fileformat>
<size>600, 600</size>
<lmargin>5</lmargin>
<start>year=2014, month=1, day=1, hour=0</start>
<stop>year=2014, month=12, day=31, hour=0</stop>
<xformat>%b</xformat>
<xlabel>%Y</xlabel>
<dateformat></dateformat>
<plot>
<bmargin>1</bmargin>
<title>Temperature (°C)</title>
<yrange>-10, 55</yrange>
<y2range>-10, 55</y2range>
<source>monthly</source>
<grid></grid>
<boxwidth>boxwidth / 2</boxwidth>
<subplot>
<style>box</style>
<colour>1</colour>
<title>Mean daytime max</title>
<xcalc>data['start'] + timedelta(days=20)</xcalc>
<ycalc>data['temp_out_max_ave']</ycalc>
</subplot>
<subplot>
<style>+</style>
<colour>8</colour>
<title>Highest daytime max</title>
<xcalc>data['temp_out_max_hi_t']</xcalc>
<ycalc>data['temp_out_max_hi']</ycalc>
</subplot>
<subplot>
<style>box</style>
<colour>3</colour>
<title>Mean nighttime min</title>
<xcalc>data['start'] + timedelta(days=7)</xcalc>
<ycalc>data['temp_out_min_ave']</ycalc>
</subplot>
<subplot>
<style>+</style>
<colour>5</colour>
<title>Lowest nighttime min</title>
<xcalc>data['temp_out_min_lo_t']</xcalc>
<ycalc>data['temp_out_min_lo']</ycalc>
</subplot>
</plot>
<plot>
<yrange>0, 180</yrange>
<y2range>0, 180</y2range>
<source>monthly</source>
<grid></grid>
<subplot>
<colour>5</colour>
<style>box</style>
<xcalc>data['start'] + timedelta(days=14)</xcalc>
<ycalc>data['rain']</ycalc>
<title>Monthly rainfall (mm)</title>
</subplot>
</plot>
</graph>
61 changes: 61 additions & 0 deletions src/pywws/examples/graph_templates/pngcairo/2015.png.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<graph>
<fileformat>pngcairo enhanced font "arial,10" rounded</fileformat>
<size>600, 600</size>
<lmargin>5</lmargin>
<start>year=2015, month=1, day=1, hour=0</start>
<stop>year=2015, month=12, day=31, hour=0</stop>
<xformat>%b</xformat>
<xlabel>%Y</xlabel>
<dateformat></dateformat>
<plot>
<bmargin>1</bmargin>
<title>Temperature (°C)</title>
<yrange>-10, 55</yrange>
<y2range>-10, 55</y2range>
<source>monthly</source>
<grid></grid>
<boxwidth>boxwidth / 2</boxwidth>
<subplot>
<style>box</style>
<colour>1</colour>
<title>Mean daytime max</title>
<xcalc>data['start'] + timedelta(days=20)</xcalc>
<ycalc>data['temp_out_max_ave']</ycalc>
</subplot>
<subplot>
<style>+</style>
<colour>8</colour>
<title>Highest daytime max</title>
<xcalc>data['temp_out_max_hi_t']</xcalc>
<ycalc>data['temp_out_max_hi']</ycalc>
</subplot>
<subplot>
<style>box</style>
<colour>3</colour>
<title>Mean nighttime min</title>
<xcalc>data['start'] + timedelta(days=7)</xcalc>
<ycalc>data['temp_out_min_ave']</ycalc>
</subplot>
<subplot>
<style>+</style>
<colour>5</colour>
<title>Lowest nighttime min</title>
<xcalc>data['temp_out_min_lo_t']</xcalc>
<ycalc>data['temp_out_min_lo']</ycalc>
</subplot>
</plot>
<plot>
<yrange>0, 180</yrange>
<y2range>0, 180</y2range>
<source>monthly</source>
<grid></grid>
<subplot>
<colour>5</colour>
<style>box</style>
<xcalc>data['start'] + timedelta(days=14)</xcalc>
<ycalc>data['rain']</ycalc>
<title>Monthly rainfall (mm)</title>
</subplot>
</plot>
</graph>
95 changes: 95 additions & 0 deletions src/pywws/examples/graph_templates/pngcairo/24hrs.png.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<graph>
<fileformat>pngcairo enhanced font "arial,10" rounded</fileformat>
<size>600, 1000</size>
<lmargin>7</lmargin>
<rmargin>7</rmargin>
<duration>hours=24</duration>
<xtics>2</xtics>
<xformat>%H%M</xformat>
<dateformat></dateformat>
<plot>
<command>set style circle radius 150</command>
<bmargin>1</bmargin>
<yrange>-10, 35</yrange>
<y2range>-10, 35</y2range>
<source>raw</source>
<grid></grid>
<subplot>
<colour>rgb "red"</colour>
<title>Temperature (°C)</title>
<ycalc>data['temp_out']</ycalc>
</subplot>
<subplot>
<colour>rgb "green"</colour>
<ycalc>dew_point(data['temp_out'], data['hum_out'])</ycalc>
<title>Dew point (°C)</title>
</subplot>
</plot>
<plot>
<bmargin>1</bmargin>
<title>Wind speed (mph)</title>
<yrange>0, 35</yrange>
<y2range>0, 35</y2range>
<source>raw</source>
<grid></grid>
<subplot>
<colour>rgb "blue"</colour>
<ycalc>wind_mph(data['wind_ave'])</ycalc>
<title>average</title>
</subplot>
<subplot>
<style>with circles lc rgb "orange"</style>
<ycalc>(None,wind_mph(data['wind_gust']))[data['wind_gust']-data['wind_ave']>1.0]</ycalc>
<title>gust</title>
</subplot>
</plot>
<plot>
<bmargin>1</bmargin>
<yrange>0, 360</yrange>
<ytics>45</ytics>
<y2tics>('N' 0, 'E' 90, 'S' 180, 'W' 270, 'N' 360)</y2tics>
<source>raw</source>
<grid></grid>
<subplot>
<style>with circles lc rgb "blue"</style>
<colour>2</colour>
<ycalc>(None,winddir_degrees(data['wind_dir']))[data['wind_ave']>0.5]</ycalc>
<title>Wind direction</title>
</subplot>
</plot>
<plot>
<title>Rainfall (mm)</title>
<bmargin>1</bmargin>
<yrange>0, 10</yrange>
<y2range>0, 50</y2range>
<ylabel>hourly</ylabel>
<y2label>total</y2label>
<source>hourly</source>
<grid></grid>
<subplot>
<colour>rgb "cyan"</colour>
<style>box</style>
<xcalc>data['idx'].replace(minute=30, second=0)</xcalc>
<ycalc>data['rain']</ycalc>
<title>hourly</title>
</subplot>
<subplot>
<colour>rgb "blue"</colour>
<axes>x1y2</axes>
<ycalc>data['rain'] + last_ycalc</ycalc>
<title>total</title>
</subplot>
</plot>
<plot>
<source>hourly</source>
<grid></grid>
<subplot>
<colour>rgb "black"</colour>
<ycalc>data['rel_pressure']</ycalc>
<title>Pressure (hPa)</title>
</subplot>
<yrange>960, 1060</yrange>
<y2range>960, 1060</y2range>
</plot>
</graph>
92 changes: 92 additions & 0 deletions src/pywws/examples/graph_templates/pngcairo/28days.png.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<graph>
<fileformat>pngcairo enhanced font "arial,10" rounded</fileformat>
<size>600, 800</size>
<duration>weeks=4</duration>
<xformat>%Y/%m/%d</xformat>
<dateformat></dateformat>
<lmargin>7</lmargin>
<rmargin>8</rmargin>
<plot>
<command>set style circle radius 150</command>
<title>Temperature (°C)</title>
<bmargin>2</bmargin>
<yrange>-10, 45</yrange>
<y2range>-10, 45</y2range>
<source>daily</source>
<grid></grid>
<boxwidth>boxwidth / 2</boxwidth>
<subplot>
<style>box</style>
<colour>rgb "red"</colour>
<title>day max</title>
<xcalc>data['start'] + timedelta(hours=18)</xcalc>
<ycalc>data['temp_out_max']</ycalc>
</subplot>
<subplot>
<style>box</style>
<colour>rgb "blue"</colour>
<title>night min</title>
<xcalc>data['start'] + timedelta(hours=6)</xcalc>
<ycalc>data['temp_out_min']</ycalc>
</subplot>
<subplot>
<colour>rgb "green"</colour>
<title>average</title>
<xcalc>data['start'] + timedelta(hours=12)</xcalc>
<ycalc>data['temp_out_ave']</ycalc>
</subplot>
</plot>
<plot>
<title>Wind speed (mph)</title>
<bmargin>1</bmargin>
<yrange>0, 35</yrange>
<y2range>0, 35</y2range>
<source>hourly</source>
<grid></grid>
<subplot>
<colour>rgb "blue"</colour>
<ycalc>wind_mph(data['wind_ave'])</ycalc>
<title>average</title>
</subplot>
<subplot>
<style>with circles lc rgb "orange"</style>
<ycalc>(None,wind_mph(data['wind_gust']))[data['wind_gust']-data['wind_ave']>1.0]</ycalc>
<title>gust</title>
</subplot>
</plot>
<plot>
<title>Rainfall (mm)</title>
<bmargin>1</bmargin>
<yrange>0, 40</yrange>
<ylabel>daily</ylabel>
<y2range>0, 200</y2range>
<y2label>total</y2label>
<source>daily</source>
<grid></grid>
<subplot>
<colour>rgb "cyan"</colour>
<style>box</style>
<xcalc>data['start'] + timedelta(hours=14)</xcalc>
<ycalc>data['rain']</ycalc>
<title>daily</title>
</subplot>
<subplot>
<colour>rgb "blue"</colour>
<axes>x1y2</axes>
<ycalc>data['rain'] + last_ycalc</ycalc>
<title>total</title>
</subplot>
</plot>
<plot>
<source>hourly</source>
<grid></grid>
<subplot>
<colour>rgb "black"</colour>
<ycalc>data['rel_pressure']</ycalc>
<title>Pressure (hPa)</title>
</subplot>
<yrange>960, 1060</yrange>
<y2range>960, 1060</y2range>
</plot>
</graph>

0 comments on commit bec24f6

Please sign in to comment.