Skip to content
This repository was archived by the owner on Oct 7, 2019. It is now read-only.

Commit 0c69c09

Browse files
authored
Merge pull request #23 from civicmapper/integrate-local-dem
Integrate local dem
2 parents 49d0589 + c673ccb commit 0c69c09

37 files changed

+40923
-938
lines changed

Pipfile

+5-33
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,11 @@ name = "pypi"
77

88
[packages]
99

10-
argh = "==0.26.2"
11-
bcrypt = "==3.1.1"
12-
cffi = "==1.9.1"
13-
coverage = "==3.7.1"
14-
cssutils = "==1.0.2"
15-
ecdsa = "==0.13"
16-
Fabric = "==1.10.1"
17-
Flask = "==0.10.1"
18-
Flask-Bcrypt = "==0.6.2"
19-
Flask-Login = "==0.4.0"
20-
Flask-SQLAlchemy = "==1.0"
21-
Flask-WTF = "==0.11"
22-
gunicorn = "==19.3.0"
23-
itsdangerous = "==0.23"
24-
"Jinja2" = "==2.7.2"
25-
jsmin = "==2.2.2"
26-
MarkupSafe = "==0.18"
27-
nose = "==1.3.4"
28-
paramiko = "==1.12.2"
29-
pathtools = "==0.1.2"
30-
pycparser = "==2.17"
31-
pycrypto = "==2.6.1"
32-
pyparsing = "==2.1.10"
33-
python-bcrypt = "==0.3.1"
34-
python-dateutil = "==2.6.0"
35-
PyYAML = "==3.12"
36-
requests = "==2.13.0"
37-
SQLAlchemy = "==0.9.9"
38-
watchdog = "==0.8.3"
39-
webassets = "==0.12.1"
40-
Werkzeug = "==0.10.1"
41-
WTForms = "==1.0.5"
42-
Flask-JSGlue = "*"
10+
flask = "*"
11+
flask-jsglue = "*"
12+
flask-markdown = "*"
13+
watchdog = "*"
14+
requests = "*"
4315

4416

4517
[dev-packages]

Pipfile.lock

+44-233
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
# dependencies
88
from flask import Flask, render_template, request, session, redirect, url_for, flash, send_from_directory, jsonify, make_response
99
from flask_jsglue import JSGlue
10+
from flaskext.markdown import Markdown
1011
import requests
11-
import pdb
12+
# import pdb
1213

1314
#----------------------------------------------------------------------------
1415
# APPLICATION SETUP
1516

1617
app = Flask(__name__)
1718
app.config.from_pyfile('config.py')
19+
# add JSGlue plugin
1820
jsglue = JSGlue(app)
21+
# add Markdown plugin
22+
Markdown(app)
1923

2024
#----------------------------------------------------------------------------
2125
# HELPERS
5.21 KB
Loading

app/static/assets/currenthydro.png

137 KB
Loading

app/static/css/bundle.core.css

+4-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/static/js/bundle.core.js

+38,656-2
Large diffs are not rendered by default.

app/static/js/bundle.core.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/templates/layout/nav.html

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Fixed navbar -->
2-
<div class="navbar navbar-inverse navbar-fixed-top">
2+
<div class="navbar navbar-default navbar-fixed-top">
33
<div class="container-fluid">
44
<div class="navbar-header">
55
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@@ -13,16 +13,11 @@
1313
</div>
1414
<div class="collapse navbar-collapse">
1515
<ul class="nav navbar-nav navbar-right">
16-
<li id="results-nav-button-item">
17-
<div><button id="swipe-btn" class="btn btn-primary btn-block sidebar-toggle" type="submit"><i class="fa fa-arrows-h"></i></button></div>
16+
<li>
17+
<button id="about-btn" class="btn btn-default navbar-btn" type="submit"><i class="fa fa-info-circle"></i></button>
1818
</li>
19-
<li class="dropdown">
20-
<!--<li id="parameters-nav-button-item"><div><button id="nav-params-btn" class="btn btn-primary btn-block params-btn" type="submit">Parameters</button></div></li>
21-
<li id="analyze-nav-button-item"><div><button id="nav-analyze-btn" class="btn btn-primary btn-block analyze-btn" type="submit">Calculate</button></div></li>
22-
<li id="results-nav-button-item"><div><button id="nav-results-btn" class="btn btn-primary btn-block results-btn" type="submit">Results</button></div></li>-->
23-
<li id="results-nav-button-item">
24-
<div><button id="about-btn" class="btn btn-primary btn-block" type="submit"><i class="fa fa-info-circle"></i></button></div>
25-
</li>
19+
<li>
20+
<button id="swipe-btn" class="btn btn-default navbar-btn sidebar-toggle" type="submit"><i class="fa fa-arrows-h"></i></button>
2621
</li>
2722
</ul>
2823
</div>

app/templates/pages/help.html

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="modal" id="aboutModal" tabindex="-1" role="dialog">
2+
<div class="modal-dialog modal-lg">
3+
<div class="modal-content">
4+
<div class="modal-header">
5+
<button class="close" type="button" data-dismiss="modal" aria-hidden="true">&times;</button>
6+
<h3 class="modal-title">Microhydropower Calculator</h3>
7+
<h3><small>A project by Bard College and Current Hydro</small></h3>
8+
</div>
9+
<div class="modal-body">
10+
<ul class="nav nav-tabs nav-justified" id="aboutTabs">
11+
<li class="active">
12+
<a href="#about" data-toggle="tab">
13+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> About</a>
14+
</li>
15+
<li>
16+
<a href="#methods" data-toggle="tab">
17+
<span class="glyphicon glyphicon-book" aria-hidden="true"></span> How It Works</a>
18+
</li>
19+
20+
</ul>
21+
<div class="tab-content" id="aboutTabsContent">
22+
<div id="about" class="tab-pane active in">
23+
<p>The Microhydropower Calculator was built by
24+
<a href="http://www.civicmapper.com">CivicMapper</a> on behalf of
25+
<a href="http://spatialanalytixllc.com/">Spatial Analytix LLC</a>, for
26+
<a href="http://www.bard.edu/">Bard College</a> and
27+
<a href="http://www.currenthydro.com/">Current Hydro LLC</a>.</p>
28+
</div>
29+
<div id="methods" class="tab-pane">
30+
{% filter markdown %} {% include 'pages/help_methods.md' %} {% endfilter %}
31+
</div>
32+
</div>
33+
</div>
34+
<div class="modal-footer">
35+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
36+
</div>
37+
</div>
38+
</div>
39+
</div>

app/templates/pages/help_methods.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
[Current Hydro](http://www.currenthydro.com/) provides an overview of microhydropower technology on their website.
3+
4+
This tool uses a basic formula for estimating power generation potential; it is suitable for planning purposes only.
5+
6+
#### Variables
7+
8+
* `A` = area of the watershed upstream of the microhydropower installation, in `square miles`. This helps determine the volume of water that could pass through the turbine. This tool automatically determines this value from geospatial data (you have the option to override that).
9+
* `H` = head (elevation change) for the microhydropower installation in `feet`; the drop in elevation helps determine how much energy the turbine will be able to generate. This tool automatically determines this value from geospatial data (you have the option to override that).
10+
* `Y` = watershed yield, as `cubic feet per second per square mile` (`cfs/sqmi`). We use 1.6 cfs/sqmi as a constant as a general estimate of the amount of water per square mile a watershed will yield, which is good enough for planning purposes.
11+
* `F` = an environmental flow constant, typically between 0.1 and 0.5 `cfs/sqmi`. Our default is 0.3.
12+
* `E` = a power generation efficiency constant. Our default is 70%.
13+
* `R` = electricity value per kilowatt-hour, in dollars
14+
* `P` = power generated, in kilowatt-hours
15+
* `V` = annual value of power generated, in dollars
16+
17+
#### Calculation
18+
19+
##### Estimate potential watershed yield
20+
21+
* `Qt = A * Y` (cubic feet per second)
22+
* `Qe = A * F` (cubic feet per second)
23+
* `Qu = Qt - Qe` useable yield from the watershed (cubic feet per second)
24+
25+
#### Calculate Power Generation
26+
27+
* `P = (Qu * H / 11.8) x e` power generated, in kilowatt-hours
28+
29+
#### Calculate Power Value
30+
31+
* `V = R * 8766 * P` annual value of power generated, in dollars

0 commit comments

Comments
 (0)