Created
July 9, 2014 04:30
-
-
Save dsoto/0c71eb51b8bc673e8e67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "import pandas as pd\nimport bokeh.plotting as bkp\nimport bokeh.objects as bko\n\n# download tmy3 data\nsr = pd.read_table('http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/724957TY.csv', skiprows=1, sep=',')\n \n# create datetime index from TMY3 format data\nimport datetime as dt\nyear = 2014\nindex = []\nfor d in sr.iterrows():\n M, D, Y = map(int, d[1]['Date (MM/DD/YYYY)'].split('/'))\n h, m = map(int, d[1]['Time (HH:MM)'].split(':'))\n index.append(dt.datetime(year, M, D, h - 1))\nsr.index = index", | |
"prompt_number": 1, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "# create standalone HTML output\nbkp.output_file('bokeh-tmy.html')\n\n# set up data source with solar, temperature, and wind speed\nsource = bko.ColumnDataSource()\nx = sr.index\nxr = bko.Range1d(start=sr.index[0], end=sr.index[-1])\nsource.add(data=x, name='x')\nsource.add(data=sr['DNI (W/m^2)'].values, name='DNI')\nsource.add(data=sr['Dry-bulb (C)'].values, name='T')\nsource.add(data=sr['Wspd (m/s)'].values, name='W')\nkwargs = {'source':source,\n 'x_range':xr,\n 'plot_height':300,\n 'plot_width':300}\ns1 = bkp.line('x', 'DNI', title='DNI', **kwargs)\ns2 = bkp.line('x', 'T', title='Temp', **kwargs)\ns3 = bkp.line('x', 'W', title='Wind', **kwargs)\nbkp.gridplot([[s1, s2, s3]])\nbkp.show()", | |
"prompt_number": 2, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "code", | |
"input": "", | |
"prompt_number": 2, | |
"outputs": [], | |
"language": "python", | |
"trusted": true, | |
"collapsed": false | |
} | |
], | |
"metadata": {} | |
} | |
], | |
"metadata": { | |
"signature": "sha256:3577529dfe527b2806bc2ee9aa998bd88e3311e162a10ce98325c7a685c0145e", | |
"name": "", | |
"gist_id": "0c71eb51b8bc673e8e67" | |
}, | |
"nbformat": 3 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment