diff --git a/README.md b/README.md
index 03905fd..99f0aea 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,7 @@ Prerequisites
- SQLAlchemy (0.8.2)
- psycopg2 (2.5.1)
- flask-wtf (0.9.1)
-- numpy (1.7.1)
-- PostgreSQL
+- PostgreSQL (9.4+)
Installation
diff --git a/app/main/templates/main/details.html b/app/main/templates/main/details.html
index 8df0ed6..b62a71f 100644
--- a/app/main/templates/main/details.html
+++ b/app/main/templates/main/details.html
@@ -14,37 +14,37 @@
- Year |
- January °C |
- February °C |
- March °C |
- April °C |
- May °C |
- June °C |
- July °C |
- August °C |
- September °C |
- October °C |
- November °C |
- December °C |
+ Year |
+ January °C |
+ February °C |
+ March °C |
+ April °C |
+ May °C |
+ June °C |
+ July °C |
+ August °C |
+ September °C |
+ October °C |
+ November °C |
+ December °C |
{% for temp in temps %}
- {{ temp[0]|int }} |
- {{ temp[1]|round(2) }} |
- {{ temp[2]|round(2) }} |
- {{ temp[3]|round(2) }} |
- {{ temp[4]|round(2) }} |
- {{ temp[5]|round(2) }} |
- {{ temp[6]|round(2) }} |
- {{ temp[7]|round(2) }} |
- {{ temp[8]|round(2) }} |
- {{ temp[9]|round(2) }} |
- {{ temp[10]|round(2) }} |
- {{ temp[11]|round(2) }} |
- {{ temp[12]|round(2) }} |
+ {{ temp[0] }} |
+ {{ temp[1][0] }} |
+ {{ temp[1][1] }} |
+ {{ temp[1][2] }} |
+ {{ temp[1][3] }} |
+ {{ temp[1][4] }} |
+ {{ temp[1][5] }} |
+ {{ temp[1][6] }} |
+ {{ temp[1][7] }} |
+ {{ temp[1][8] }} |
+ {{ temp[1][9] }} |
+ {{ temp[1][10] }} |
+ {{ temp[1][11] }} |
{% endfor %}
diff --git a/app/main/utils.py b/app/main/utils.py
index a1fcdcd..e2ed19e 100644
--- a/app/main/utils.py
+++ b/app/main/utils.py
@@ -1,5 +1,3 @@
-import numpy
-
from .models import DB
@@ -23,8 +21,7 @@ def avg_air_temp(temps):
def ann_air_indices(temps):
ATI, AFI = 0.0, 0.0
- # TODO: drop numpy
- indices = numpy.zeros((len(temps), 2), dtype='int')
+ indices = [[0 for x in range(2)] for y in range(len(temps))]
months = [0.0 for m in range(12)]
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
i = 0
@@ -39,25 +36,27 @@ def ann_air_indices(temps):
ATI = ATI + ind
else:
AFI = AFI + ind
- indices[i, 0], indices[i, 1] = int(ATI), int(AFI)
+ indices[i][0], indices[i][1] = int(ATI), int(AFI)
ATI, AFI = 0.0, 0.0
i += 1
return indices
def avg_air_indices(indices):
- # TODO: drop numpy
- temp = numpy.average(indices, axis=0)
- return (int(temp[0]), int(temp[1]))
+ year_counter, total_freezing, total_thawing = 0, 0, 0
+ for index in indices:
+ total_thawing += index[0]
+ total_freezing += index[1]
+ year_counter += 1
+ return (int(total_thawing / year_counter), int(total_freezing / year_counter))
def des_air_indices(indices):
- if indices.shape[0] > 2:
- # TODO: drop numpy
- ati = numpy.sort(indices[:, 0])
- afi = numpy.sort(indices[:, 1])
- dti = (ati[-1] + ati[-2] + ati[-3]) / 3.0
- dfi = (afi[0] + afi[1] + afi[2]) / 3.0
+ if len(indices) > 2:
+ ati = sorted(indices, key=lambda arr: arr[0])
+ afi = sorted(indices, key=lambda arr: arr[1])
+ dti = (ati[-1][0] + ati[-2][0] + ati[-3][0]) / 3.0
+ dfi = (afi[0][1] + afi[1][1] + afi[2][1]) / 3.0
return (int(dti), int(dfi))
else:
return (None, None)
diff --git a/app/main/views.py b/app/main/views.py
index 078fb82..4df4632 100644
--- a/app/main/views.py
+++ b/app/main/views.py
@@ -1,5 +1,3 @@
-from numpy import arange, hstack
-
from flask import session, render_template, request, redirect, url_for
from . import main
@@ -76,10 +74,7 @@ def details():
community_id = request.args.get('community_id', '')
minyear = request.args.get('minyear', '')
maxyear = request.args.get('maxyear', '')
- temps = getTemps(datasets, community_id, minyear, maxyear)
- years = arange(int(minyear),
- int(maxyear)+1).reshape(int(maxyear)-int(minyear) + 1, 1)
- temps = hstack((years, temps))
+ temps = getTemps(session)
return render_template('main/details.html',
lat=request.args.get('lat', ''),
lon=request.args.get('lon', ''),