Graphing

From IARC 207 Wiki
Jump to navigation Jump to search

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.

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

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
		[[[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