Skip to content

Commit fdb21f4

Browse files
committed
starting sunshing
1 parent 7bf1ad1 commit fdb21f4

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

data_reduce.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
for row in spamreader:
88
# reduce(row, lambda x: x[4])
99
#print row[4]
10-
1110
a.append(row)
1211
pass
1312
from pprint import pprint

data_reduce_month.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
res=[]
1919

2020
for i in a:
21-
2221
k = i[0].split(' ')[0]
23-
2422
if k!= sliding_shit:
2523
sliding_shit=k
2624
res.append(0)
2725

2826
res[len(res)-1]+=float(i[3])
2927

3028
res = map(lambda x: round(x*100)/100.0, res)
31-
res = map(lambda x: x*30, res)
29+
res = map(lambda x: x*30*24/1000, res)
3230
print json.dumps(res)
3331

3432
#for line in sys.stdin:

get_csv.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def exec_cmd(cmd):
5050
sys.exit()
5151

5252
cords = our_entry['geometry']['location']
53+
54+
if sys.argv[2] == 'sunshine':
55+
56+
sys.exit()
57+
5358
#pprint(our_entry)
5459
#url="http://solarview.niwa.co.nz/createImage?latitude=%f&longitude=%f&azimuth_angle=&zenith_angle=&image_title=Address+unknown" % (cords['lat'],cords['lng'])
5560

get_energy.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33

44
$period = $_REQUEST['period'];
55
$address = $_REQUEST['address'];
6+
$sunshine = $_REQUEST['sunshine'];
67
$PWD = __DIR__;
78
header('Content-Type: application/json');
89

910
$address = escapeshellcmd($address);
1011

1112
if ($period == 'month') {
12-
echo shell_exec("python $PWD/get_csv.py '" .$address. "'| xargs curl -s | python $PWD/data_reduce_month.py");
13+
echo shell_exec("python $PWD/get_csv.py '" .$address. "' | xargs curl -s | python $PWD/data_reduce_month.py");
1314
} else if ($period == 'year') {
14-
echo shell_exec("python $PWD/get_csv.py '" .$address. "'| xargs curl -s | python $PWD/data_reduce.py");
15+
echo shell_exec("python $PWD/get_csv.py '" .$address. "' | xargs curl -s | python $PWD/data_reduce.py");
16+
} else if ($sunshine == 1) {
17+
echo shell_exec("python $PWD/get_csv.py '" .$address. "' sunshine");
1518
} else {
1619
echo json_encode(['error' => 'wrong period']);
1720
}

0 commit comments

Comments
 (0)