GithubHelp home page GithubHelp logo

r24mille / watttime-grid-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from egeriicw/watttime-grid-api

0.0 2.0 0.0 4.07 MB

An API for the power grid.

License: Apache License 2.0

Python 83.03% CSS 4.03% HTML 12.95%

watttime-grid-api's Introduction

watttime-grid-api

What kind of electricity are you getting right now? The WattTime grid API collects real-time information on the current generation fuel mix from the major American electricity markets (MISO, PJM, CAISO, ERCOT, ISONE, SPP, and BPA) using the pyiso library and displays it in a convenient standardized format. The API also calculates a real-time carbon footprint of electricity use in a given place and time based on this fuel mix. See the code in action at http://api.watttime.org/!

What's included

All the Django apps are in watttime_grid_api/apps. These are

  • gridentities: provides models for metadata and descriptions of geographic entities (BalancingAuthority and PowerPlant) and data types (FuelType); standalone
  • griddata: provides models for time series data (DataPoint); depends on gridentities
  • supply_demand: provides Generation, Load, and TieFlow models that associates generation and load observations to DataPoints, and management commands and celery tasks for pulling the data; depends on gridentities and griddata
  • carbon: provides Carbon and FuelCarbonIntensity models that associate carbon intensity observations to DataPoints, and tasks for calculating the data; depends on gridentities, griddata, and supply_demand
  • marginal: provides MOER, MOERAlgorithm, and StructuralModelSet models that associate marginal carbon intensity observations (MOER) to DataPoints, and tasks for calculating the data; depends on gridentities, griddata, and supply_demand
  • api: implements a Django REST Framework API to all other apps; depends on gridentities, griddata, supply_demand, carbon, and marginal
  • etl: implements a extract-transform-load job flow to supply data to all other apps; depends on gridentities, griddata, supply_demand, carbon, and marginal

Quickstart dev environment

Start a postgres server (eg http://postgresapp.com/) and create a database called mydbname. You'll also need libmemcached:

   brew install libmemcached

Also install the GeoDjango requirements. See the platform-specific instructions at https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/, I used homebrew:

   brew install postgresql
   brew install postgis
   brew install libgeoip
   psql mydbname
   # CREATE EXTENSION postgis;

Clone this repo and install the requirements:

  cd watttime-grid-api
  mkvirtualenv watttime-grid-api
  pip install -r reqs/dev.txt

Set up the environment variables. You can put then in a .env file and use foreman (get it at https://github.com/ddollar/foreman or as part of the Heroku CLI) or put them in your bash profile or whatever. If you're not using foreman, remove the 'foreman run' from all following commands.

  echo DATABASE_URL=postgres://localhost/mydbname > .env

Create database tables for the models (create user when prompted):

  foreman run ./manage.py syncdb
  foreman run ./manage.py migrate

Test the site:

  foreman run ./manage.py test
  foreman run ./manage.py loaddata isos gentypes fuelcarbonintensities griddata
  foreman run ./manage.py shell
  >>> from apps.gridentities import load
  >>> load.run_balancing_authority()
  foreman run ./manage.py runserver

To run tasks with celery, run rabbitmq-server &, then celery -A watttime_grid_api worker -B -l info or foreman start (if you have newrelic-admin installed locally).

watttime-grid-api's People

Contributors

aschn avatar gavin-mccormick avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.