A pma Non-Computing Example
Here is a trivial and indeed ridiculously contrived example of how pma could be
used to analyze data with arbitrary metrics - as long as it's in the correct format.
The example data being analyzed is how many "pollinators" (honeybees, butterflies, birds and bumblebees)
are observed to pollinate flowers in two observation zones (north and south) under particular
weather conditions during the time intervals of the observations. The weather metrics are temp_C,
press_kPa, rain_mm, windspeed_kmph and winddir_deg).
Pollinators data file
Note that the data sets have a count of 4 and an interval of 900s (4 x 900s = 3600s, which is 1 hour), so
the timestamps (DATE stanzas) occur once every hour.
TIME_VALUES:
4 900 # Comments can go here!
METADATA:
WEATHER V 1 temp_C press_kPa rain_mm windspeed_kmph winddir_deg
POLLINATORS A 1 honeybees butterflies birds bumblebees
DATE:
1451642400 # Fri 01 Jan 2016 10:00:00 UTC
WEATHER:
05 101 0.0 15 37
05 102 0.0 14 37
05 103 0.0 13 37
05 104 0.0 12 37
POLLINATORS:
north 201 21 4 2
south 101 11 30 11
north 201 21 4 2
south 101 11 29 12
north 201 21 4 2
south 101 11 28 13
north 201 21 4 2
south 101 11 27 14
DATE:
1451646000 # Fri 01 Jan 2016 11:00:00 UTC
WEATHER:
06 105 0.0 11 40
06 106 0.0 12 40
06 104 0.0 13 40
06 103 0.0 14 40
POLLINATORS:
north 202 22 4 2
south 102 11 26 15
north 202 22 4 2
south 102 11 25 16
north 202 22 4 2
south 102 11 24 17
north 202 22 4 2
south 102 11 23 18
DATE:
1451649600 # Fri 01 Jan 2016 12:00:00 UTC
WEATHER:
07 103 1.0 15 43
07 105 2.0 16 43
07 107 3.0 17 43
07 109 4.0 18 43
POLLINATORS:
north 203 23 4 2
south 103 11 22 19
north 203 23 4 2
south 103 11 21 20
north 203 23 4 2
south 103 11 20 21
north 203 23 4 2
south 103 11 19 22
DATE:
1451653200 # Fri 01 Jan 2016 13:00:00 UTC
WEATHER:
08 100 0.0 17 40
08 101 0.0 12 40
08 102 0.0 14 40
08 103 0.0 16 40
POLLINATORS:
north 204 24 4 2
south 104 11 18 23
north 204 24 4 2
south 104 11 17 24
north 204 24 4 4
south 104 11 16 25
north 204 24 4 2
south 104 11 15 26
DATE:
1451656800 # Fri 01 Jan 2016 14:00:00 UTC
WEATHER:
09 102 0.0 18 37
09 101 0.0 20 37
09 100 0.0 22 37
09 101 0.0 20 37
POLLINATORS:
north 205 25 4 2
south 105 11 14 27
north 205 25 4 2
south 105 11 13 28
north 201 25 4 2
south 105 11 12 29
north 205 25 4 1
south 105 11 11 30
Using pma to create its own configuration file
$ pma -pd pollinators.data > pollinators.config.orig
W: no output file has been specified!
Note that pma issues a suitable warning.
Here is the configuration file pma generated (with the -p and -d options). Note that all lines
are comments.
# Parameter Active Value Default Value
# ------------------------- ------------------------- -------------------------
# fullscale '100.0' # '100.0'
# TZ '' # ''
# metricdeviceseparator '_' # '_'
# singlefiledateformat '%x %X' # '%x %X'
# singlefiledelimiter ',' # ','
# multifiledateformat '%s' # '%s'
# multifiledelimiter ' ' # ' '
# multifileheaderformat '"%s|%.1f"' # '"%s|%.1f"'
# clockticksfilename 'clockticks' # 'clockticks'
# clockticks_level_0 '86400' # '86400'
# clockticks_level_1 '43200' # '43200'
# clockticks_level_2 '21600' # '21600'
# clockticks_level_3 '3600' # '3600'
# clockticks_level_4 '1800' # '1800'
# clockticks_level_5 '900' # '900'
# clockticks_level_6 '300' # '300'
# clockticks_level_7 '0' # '0'
### Summary Data ################### Max ################# Avg ######### Num
# temp_C 9.0 # 7.0 20
# press_kPa 109.0 # 103.1 20
# rain_mm 4.0 # 0.5 20
# windspeed_kmph 22.0 # 15.4 20
# winddir_deg 43.0 # 39.4 20
# honeybees 205.0 # 152.9 40
## honeybees_north 205.0 ## 202.8 20
## honeybees_south 105.0 ## 103.0 20
# butterflies 25.0 # 17.0 40
## butterflies_north 25.0 ## 23.0 20
## butterflies_south 11.0 ## 11.0 20
# birds 30.0 # 12.2 40
## birds_north 4.0 ## 4.0 20
## birds_south 30.0 ## 20.5 20
# bumblebees 30.0 # 11.3 40
## bumblebees_north 4.0 ## 2.0 20
## bumblebees_south 30.0 ## 20.5 20
Here is the configuration file after manual modification with a text editor:
# Parameter Active Value Default Value
# ------------------------- ------------------------- -------------------------
# fullscale '100.0' # '100.0'
# TZ '' # ''
# metricdeviceseparator '_' # '_'
# singlefiledateformat '%x %X' # '%x %X'
singlefiledelimiter '|' # ','
# multifiledateformat '%s' # '%s'
# multifiledelimiter ' ' # ' '
# multifileheaderformat '"%s|%.1f"' # '"%s|%.1f"'
# clockticksfilename 'clockticks' # 'clockticks'
# clockticks_level_0 '86400' # '86400'
# clockticks_level_1 '43200' # '43200'
# clockticks_level_2 '21600' # '21600'
# clockticks_level_3 '3600' # '3600'
# clockticks_level_4 '1800' # '1800'
# clockticks_level_5 '900' # '900'
# clockticks_level_6 '300' # '300'
# clockticks_level_7 '0' # '0'
### Summary Data ################### Max ################# Avg ######### Num
temp_C 100.0 # 7.0 20
press_kPa 100.0 # 103.1 20
rain_mm 100.0 # 0.5 20
windspeed_kmph 100.0 # 15.4 20
winddir_deg 100.0 # 39.4 20
honeybees 100.0 # 101.0 40
## honeybees_north 101.0 ## 101.0 20
## honeybees_south 101.0 ## 101.0 20
butterflies 100.0 # 11.0 40
## butterflies_north 11.0 ## 11.0 20
## butterflies_south 11.0 ## 11.0 20
birds 100.0 # 1.0 40
## birds_north 1.0 ## 1.0 20
## birds_south 1.0 ## 1.0 20
bumblebees 100.0 # 1.0 40
## bumblebees_north 1.0 ## 1.0 20
## bumblebees_south 1.0 ## 1.0 20
Note: a metric's data values are scaled by fullscale divided by that metric's maxscale.
In this case, fullscale and all maxscale values are 100, so all data values are all "scaled" by 1!
Run pma to generate a single output "csv" (bar separated) file
$ pma -c pollinators.config -s pollinators.csv pollinators.data
Time|temp_C|press_kPa|rain_mm|windspeed_kmph|winddir_deg|honeybees_north|honeybees_south|butterflies_north|butterflies_south|birds_north|birds_south|bumblebees_north|bumblebees_south
01/01/16 21:15:00|5.0|101.0|0.0|15.0|37.0|201.0|101.0|21.0|11.0|4.0|30.0|2.0|11.0
01/01/16 21:30:00|5.0|102.0|0.0|14.0|37.0|201.0|101.0|21.0|11.0|4.0|29.0|2.0|12.0
01/01/16 21:45:00|5.0|103.0|0.0|13.0|37.0|201.0|101.0|21.0|11.0|4.0|28.0|2.0|13.0
01/01/16 22:00:00|5.0|104.0|0.0|12.0|37.0|201.0|101.0|21.0|11.0|4.0|27.0|2.0|14.0
01/01/16 22:15:00|6.0|105.0|0.0|11.0|40.0|202.0|102.0|22.0|11.0|4.0|26.0|2.0|15.0
01/01/16 22:30:00|6.0|106.0|0.0|12.0|40.0|202.0|102.0|22.0|11.0|4.0|25.0|2.0|16.0
01/01/16 22:45:00|6.0|104.0|0.0|13.0|40.0|202.0|102.0|22.0|11.0|4.0|24.0|2.0|17.0
01/01/16 23:00:00|6.0|103.0|0.0|14.0|40.0|202.0|102.0|22.0|11.0|4.0|23.0|2.0|18.0
01/01/16 23:15:00|7.0|103.0|1.0|15.0|43.0|203.0|103.0|23.0|11.0|4.0|22.0|2.0|19.0
01/01/16 23:30:00|7.0|105.0|2.0|16.0|43.0|203.0|103.0|23.0|11.0|4.0|21.0|2.0|20.0
01/01/16 23:45:00|7.0|107.0|3.0|17.0|43.0|203.0|103.0|23.0|11.0|4.0|20.0|2.0|21.0
02/01/16 00:00:00|7.0|109.0|4.0|18.0|43.0|203.0|103.0|23.0|11.0|4.0|19.0|2.0|22.0
02/01/16 00:15:00|8.0|100.0|0.0|17.0|40.0|204.0|104.0|24.0|11.0|4.0|18.0|2.0|23.0
02/01/16 00:30:00|8.0|101.0|0.0|12.0|40.0|204.0|104.0|24.0|11.0|4.0|17.0|2.0|24.0
02/01/16 00:45:00|8.0|102.0|0.0|14.0|40.0|204.0|104.0|24.0|11.0|4.0|16.0|4.0|25.0
02/01/16 01:00:00|8.0|103.0|0.0|16.0|40.0|204.0|104.0|24.0|11.0|4.0|15.0|2.0|26.0
02/01/16 01:15:00|9.0|102.0|0.0|18.0|37.0|205.0|105.0|25.0|11.0|4.0|14.0|2.0|27.0
02/01/16 01:30:00|9.0|101.0|0.0|20.0|37.0|205.0|105.0|25.0|11.0|4.0|13.0|2.0|28.0
02/01/16 01:45:00|9.0|100.0|0.0|22.0|37.0|201.0|105.0|25.0|11.0|4.0|12.0|2.0|29.0
02/01/16 02:00:00|9.0|101.0|0.0|20.0|37.0|205.0|105.0|25.0|11.0|4.0|11.0|1.0|30.0
Display the same data in a different timezone
$ export TZ=UTC; pma -c pollinators.config -s pollinators.csv pollinators.data
Time|temp_C|press_kPa|rain_mm|windspeed_kmph|winddir_deg|honeybees_north|honeybees_south|butterflies_north|butterflies_south|birds_north|birds_south|bumblebees_north|bumblebees_south
01/01/16 10:15:00|5.0|101.0|0.0|15.0|37.0|201.0|101.0|21.0|11.0|4.0|30.0|2.0|11.0
01/01/16 10:30:00|5.0|102.0|0.0|14.0|37.0|201.0|101.0|21.0|11.0|4.0|29.0|2.0|12.0
01/01/16 10:45:00|5.0|103.0|0.0|13.0|37.0|201.0|101.0|21.0|11.0|4.0|28.0|2.0|13.0
01/01/16 11:00:00|5.0|104.0|0.0|12.0|37.0|201.0|101.0|21.0|11.0|4.0|27.0|2.0|14.0
01/01/16 11:15:00|6.0|105.0|0.0|11.0|40.0|202.0|102.0|22.0|11.0|4.0|26.0|2.0|15.0
01/01/16 11:30:00|6.0|106.0|0.0|12.0|40.0|202.0|102.0|22.0|11.0|4.0|25.0|2.0|16.0
01/01/16 11:45:00|6.0|104.0|0.0|13.0|40.0|202.0|102.0|22.0|11.0|4.0|24.0|2.0|17.0
01/01/16 12:00:00|6.0|103.0|0.0|14.0|40.0|202.0|102.0|22.0|11.0|4.0|23.0|2.0|18.0
01/01/16 12:15:00|7.0|103.0|1.0|15.0|43.0|203.0|103.0|23.0|11.0|4.0|22.0|2.0|19.0
01/01/16 12:30:00|7.0|105.0|2.0|16.0|43.0|203.0|103.0|23.0|11.0|4.0|21.0|2.0|20.0
01/01/16 12:45:00|7.0|107.0|3.0|17.0|43.0|203.0|103.0|23.0|11.0|4.0|20.0|2.0|21.0
01/01/16 13:00:00|7.0|109.0|4.0|18.0|43.0|203.0|103.0|23.0|11.0|4.0|19.0|2.0|22.0
01/01/16 13:15:00|8.0|100.0|0.0|17.0|40.0|204.0|104.0|24.0|11.0|4.0|18.0|2.0|23.0
01/01/16 13:30:00|8.0|101.0|0.0|12.0|40.0|204.0|104.0|24.0|11.0|4.0|17.0|2.0|24.0
01/01/16 13:45:00|8.0|102.0|0.0|14.0|40.0|204.0|104.0|24.0|11.0|4.0|16.0|4.0|25.0
01/01/16 14:00:00|8.0|103.0|0.0|16.0|40.0|204.0|104.0|24.0|11.0|4.0|15.0|2.0|26.0
01/01/16 14:15:00|9.0|102.0|0.0|18.0|37.0|205.0|105.0|25.0|11.0|4.0|14.0|2.0|27.0
01/01/16 14:30:00|9.0|101.0|0.0|20.0|37.0|205.0|105.0|25.0|11.0|4.0|13.0|2.0|28.0
01/01/16 14:45:00|9.0|100.0|0.0|22.0|37.0|201.0|105.0|25.0|11.0|4.0|12.0|2.0|29.0
01/01/16 15:00:00|9.0|101.0|0.0|20.0|37.0|205.0|105.0|25.0|11.0|4.0|11.0|1.0|30.0
Note: This could have also been done by setting the TZ parameter in the configuration file.
Run pma to generate multiple output files in a specified directory
pma -c pollinators.config -m Multiple_File_Directory pollinators.data
(Output not shown.)