-
Notifications
You must be signed in to change notification settings - Fork 6
/
blankspot_stats.py
executable file
·50 lines (34 loc) · 1.33 KB
/
blankspot_stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /usr/bin/env python
"""
Calculate statistics for each study area, and prints results to stdout.
All it prints is the number of blankspots, the number of v1 nodes,
and the number of total nodes. Since I am no longer storing the blankspot
information in the hist_point table itself, these stats are no longer very informative.
Currently, user_analysis.py does what this script used to do. It prints the "output_totals_*"
files which contain the stats for each study area by date.
"""
import MapGardening
import optparse
usage = "usage: %prog [options]"
p = optparse.OptionParser(usage)
p.add_option('--place', '-p',
default="all"
)
options, arguments = p.parse_args()
possible_tables = [
'blankspots_1000_b',
]
if options.place == "all":
places = MapGardening.get_all_places()
else:
placename = options.place
place = MapGardening.get_place(placename)
places = {placename: place}
MapGardening.init_logging()
for placename in places.keys():
print "printing blankspot info for", placename
MapGardening.init_db(places[placename]['dbname'])
for table in possible_tables:
nodetable = MapGardening.NodeTable(table) # Table may not exist, but object will still be created
nodetable.get_blankspot_stats()
MapGardening.disconnect_db()