Difference between revisions of "Graphing"

From IARC 207 Wiki
Jump to navigation Jump to search
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
Some initial stuff for starting out....
+
==Overview==
 +
Graphing is the figure generating portion of the stuff from EEI.  This program is quite a bit more complicated than the html exporting utility.  The complication is that it uses all of the configuration information (contents of the .ini file and supporting files) used by [[GP]] plus a second  configuration file specific to this program. Sample contents and variables contained in it are outlined below.
 +
 
 +
A side note, this seems to work marginally from windows and nicely from linux.  Not sure why exactly but plots came out consistently partially made on the windows computer.
 +
 
 +
Another important note is the graph.py and it's associated files should be run from the same directory as gp.py  so that python can find all of the support files.
 +
 
 +
==Required Packages==
 
Packages required in addition to those required for [[GP]]:<br>
 
Packages required in addition to those required for [[GP]]:<br>
 
* ConfigObj<br><pre>http://pypi.python.org/packages/2.5/C/ConfigObj</pre>
 
* ConfigObj<br><pre>http://pypi.python.org/packages/2.5/C/ConfigObj</pre>
Line 5: Line 12:
 
* Numpy<br><pre>http://pypi.python.org/pypi/numpy/1.1.1</pre>
 
* Numpy<br><pre>http://pypi.python.org/pypi/numpy/1.1.1</pre>
  
 +
All user-written files:
 +
<pre>
 +
graph.py -- main program
 +
BaseGraph.py
 +
GWSFigures.py
 +
gpUtil.py
 +
graph_lib.py
 +
unit_conversion.py
 +
</pre>
 +
 +
==Program Execution and Background==
 
To run:
 
To run:
  $ python graph.py -cd4 ./ADOT/dot_win.ini ./ADOT/graphs2.ini
+
$ python graph.py [Options] [gp.py configuration file] [graph.py configuration file]
 +
 
 +
Such as:
 +
  $ python graph.py -cd4 ./ADOT/dot.ini ./ADOT/graphs2.ini
 +
$ python graph.py -y4 ./ADOT/dot.ini ./ADOT/graphs2.ini
 +
$ python graph.py -d4 -X6 -Y4.5 ./ADOT/dot.ini ./ADOT/graphs2.ini
 +
 
 +
Command line parameters (case sensitive):
 +
# Options (see below)
 +
# .ini file used by [[GP |gp.py]]
 +
# .ini file used by [[Graphing | graph.py]]
 +
 
 +
Command line options
 +
* -c for current plus...
 +
* -d# for days
 +
* -m# for months
 +
* -y# for years
 +
Other Choices:
 +
* -X for X dimension in pixels / 100 (6 is default = 600 pixels wide)
 +
* -Y for Y dimension in pixels / 100 (4.5 is default = 450 pixels wide)
 +
 
 +
==Sample contents of a graph.py configuration file==
 +
Below is what you might find in a graph.py configuration file.  In a real file there would probably be several stations listed with several plots per station.  In this example there is just one station with two plots being created.
 +
 
 +
<pre>
 +
[c1-grid]
 +
[[Air]]
 +
fileName = c1-grid-air
 +
                title = "Whatever you like for a title"
 +
                caption = "Whatever you like for a caption, will show up below graphs but above legend"
 +
[[[Graphs]]]
 +
[[[[AT]]]]
 +
graphType = T
 +
sensors = airTempAvg,
 +
                                lineColors = r
 +
[[[[Relative_Humidity]]]]
 +
graphType = RH
 +
sensors = relativeHumidityAvg,
 +
                                lineColors = b
 +
</pre>
 +
 
 +
====fileName====
 +
Set this to be whatever you like.  EEI example was like 'air' but including the station name wouldn't hurt.
 +
 
 +
====graphType Choices====
 +
Add your own in ''BaseGraph.py'' function ''setGraphType'' or select one of these pre-existing ones (identified only if I can figure out what it is).<br>
 +
'''T''' for a temperature plot, units = C or F; Degrees C on left Degrees F on right<br>
 +
'''TN''' Same as '''T''', units = C or FN<br>
 +
'''WCC''' Same as '''T''', units = C or F <br>
 +
'''WCF''' Similar to '''T''' but Degrees F are on the left and Degrees C are on the right to two decimal places, units = C or F <br>
 +
'''WS''' for wind speed, units = m/s, MPH, or KNT<br>
 +
'''WD''' for wind direction, units = degrees<br>
 +
'''BP''' for pressure, units = milliBars<br>
 +
'''V''' for voltage, units = Volts<br>
 +
'''RH''' for relative humidity, units = Percent<br>
 +
'''P''' for precipitation, units = mm<br>
 +
'''NR''' for Net Radiation, units = W/m^2<br>
 +
'''RR''' for Reflected SW Radiation, units = W/m^2<br>
 +
'''IR''' for incoming SW Radiation, units = W/m^2<br>
 +
'''SD''' for snow depth, units = cm<br>
 +
'''VP''' for Vapor Pressure, units = kPa<br>
 +
 
 +
====sensors====
 +
The ''sensors'' variable can be a single value or a comma separated list of values to be shown on the graph.
 +
The names here are found in the files looking something like this:  '''TemplateMap-atlas3m.profile'''.  the '''atlas3m''' part is then specified in '''stationInfo.csv''' discussed in [[GP]].  The purpose of these template files is to convert the varied names of sensor columns into a common set for use in gp.py and graph.py.  '''The trailing comma is required to show the end of all sensor rows.'''
 +
 
 +
====lineColors====
 +
As you might imagine these are the plot line colors.  Choices are:<br>
 +
'''b''' -- Blue<br>
 +
'''r''' -- Red<br>
 +
'''c''' -- Cyan<br>
 +
'''y''' -- Yellow<br>
 +
'''k''' -- Black<br>
 +
'''g''' -- Green <br>
 +
'''m''' -- Magenta<br>

Latest revision as of 17:08, 7 October 2008

Overview

Graphing is the figure generating portion of the stuff from EEI. This program is quite a bit more complicated than the html exporting utility. The complication is that it uses all of the configuration information (contents of the .ini file and supporting files) used by GP plus a second configuration file specific to this program. Sample contents and variables contained in it are outlined below.

A side note, this seems to work marginally from windows and nicely from linux. Not sure why exactly but plots came out consistently partially made on the windows computer.

Another important note is the graph.py and it's associated files should be run from the same directory as gp.py so that python can find all of the support files.

Required Packages

Packages required in addition to those required for GP:

  • ConfigObj
    http://pypi.python.org/packages/2.5/C/ConfigObj
  • MatPlotLib
    http://pypi.python.org/pypi/matplotlib/0.91.4
  • Numpy
    http://pypi.python.org/pypi/numpy/1.1.1

All user-written files:

graph.py -- main program
BaseGraph.py 
GWSFigures.py
gpUtil.py
graph_lib.py
unit_conversion.py

Program Execution and Background

To run:

$ python graph.py [Options] [gp.py configuration file] [graph.py configuration file]
Such as:
$ python graph.py -cd4 ./ADOT/dot.ini ./ADOT/graphs2.ini
$ python graph.py -y4 ./ADOT/dot.ini ./ADOT/graphs2.ini
$ python graph.py -d4 -X6 -Y4.5 ./ADOT/dot.ini ./ADOT/graphs2.ini

Command line parameters (case sensitive):

  1. Options (see below)
  2. .ini file used by gp.py
  3. .ini file used by graph.py

Command line options

  • -c for current plus...
  • -d# for days
  • -m# for months
  • -y# for years

Other Choices:

  • -X for X dimension in pixels / 100 (6 is default = 600 pixels wide)
  • -Y for Y dimension in pixels / 100 (4.5 is default = 450 pixels wide)

Sample contents of a graph.py configuration file

Below is what you might find in a graph.py configuration file. In a real file there would probably be several stations listed with several plots per station. In this example there is just one station with two plots being created.

[c1-grid]
	[[Air]]
		fileName = c1-grid-air
                title = "Whatever you like for a title"
                caption = "Whatever you like for a caption, will show up below graphs but above legend"
		[[[Graphs]]]
			[[[[AT]]]]
				graphType = T
				sensors = airTempAvg,
                                lineColors = r
			[[[[Relative_Humidity]]]]
				graphType = RH
				sensors = relativeHumidityAvg,
                                lineColors = b

fileName

Set this to be whatever you like. EEI example was like 'air' but including the station name wouldn't hurt.

graphType Choices

Add your own in BaseGraph.py function setGraphType or select one of these pre-existing ones (identified only if I can figure out what it is).
T for a temperature plot, units = C or F; Degrees C on left Degrees F on right
TN Same as T, units = C or FN
WCC Same as T, units = C or F
WCF Similar to T but Degrees F are on the left and Degrees C are on the right to two decimal places, units = C or F
WS for wind speed, units = m/s, MPH, or KNT
WD for wind direction, units = degrees
BP for pressure, units = milliBars
V for voltage, units = Volts
RH for relative humidity, units = Percent
P for precipitation, units = mm
NR for Net Radiation, units = W/m^2
RR for Reflected SW Radiation, units = W/m^2
IR for incoming SW Radiation, units = W/m^2
SD for snow depth, units = cm
VP for Vapor Pressure, units = kPa

sensors

The sensors variable can be a single value or a comma separated list of values to be shown on the graph. The names here are found in the files looking something like this: TemplateMap-atlas3m.profile. the atlas3m part is then specified in stationInfo.csv discussed in GP. The purpose of these template files is to convert the varied names of sensor columns into a common set for use in gp.py and graph.py. The trailing comma is required to show the end of all sensor rows.

lineColors

As you might imagine these are the plot line colors. Choices are:
b -- Blue
r -- Red
c -- Cyan
y -- Yellow
k -- Black
g -- Green
m -- Magenta