The US Energy Infrastructure Visualization is a data visualization web app that classifies and displays nationwide infrastructure data by infrastructure type, total asset value, and location on a map of the United States. The project uses D3.js to process the data and render the maps, allowing users to select layers grouped into the following categories:
- gas wells
- offshore wells
- oil and gas pipelines
- oil refineries
- gas processing and storage
- coal mines
- railroads
- electricity transmission grid
- power plants
This project is the result of a grant-funded partnership between the National Science Foundation and the Center for Robust Decision-making on Climate and Energy Policy designed to generate data visualizations that can be used by policy-makers and educators.
git clone
python run.py
Ensure that you have Python 3.x and pip installed on your machine; install Flask flask_assets, and flask_compress if you haven't already:
python --version
pip --version
pip install flask
pip install flask_assets
pip install flask_compress
The web app is built with Flask and is organized in a pretty run-of-the-mill no-frills manner.
-
/static/js
is the business.-
energy-maps.init.X.vY.js
files load data files and initialize the mapping functions for various maps (defined by the X in filename). -
energy-maps.funcs.X.vY.js
files contain functions relevant to the various maps. -
energy-maps.funcs.vY.js
contain functions relevant to all of the various maps. -
energy-maps.globals.vY.js
contain variables relevant to all of the various maps. -
energy-maps.legends.vY.js
contain functions responsible for drawing map legends.
-
-
/static/json
and/static/csv
contain data files. -
/static/css
and/static/sass
contain project stylesheets.- All styling is written in SCSS and compiled down to CSS like so:
sass main.v#.sass main.v#.css
- All styling is written in SCSS and compiled down to CSS like so:
- Function names are snake_case()
- Fat arrow functions are generally avoided
- Descriptive variable names are used rather than magic numbers
let
rather thanvar
,const
whenever possible.- JSDoc is used whenever possible. Documentation is generated by
jsdoc energy_maps/static/js/* -d energy_maps/docs
- Curly braces open at the end of a line and close on their own line, like so:
if (i === foo) {
bar()
}
This project is licensed under the TBA License - see LICENSE.md for details.