-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'nrel/master' into dev/refactor
- Loading branch information
Showing
190 changed files
with
507,173 additions
and
38,656 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "4dbcf4e7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as widgets\n", | ||
"from ipywidgets import interact, Layout\n", | ||
"import plotly.express as px\n", | ||
"import pandas as pd\n", | ||
"import numpy as np\n", | ||
"import os\n", | ||
"\n", | ||
"# Plotting imports\n", | ||
"import plotly.graph_objects as go\n", | ||
"from plotly.subplots import make_subplots\n", | ||
"\n", | ||
"import plotly.io as pio\n", | ||
"PAPER_LAYOUT=dict(font=dict(family=\"Computer Modern\", size=18),\n", | ||
" margin=dict(t=40))\n", | ||
"pio.templates[\"paper\"] = go.layout.Template(layout=PAPER_LAYOUT)\n", | ||
"pio.templates.default = \"paper\"\n", | ||
"\n", | ||
"def chunks(lst, n):\n", | ||
" for i in range(0, len(lst), n):\n", | ||
" yield lst[i:i + n]\n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "3998d12c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"path = '../resource_files/grid'\n", | ||
"\n", | ||
"options = os.listdir(path)\n", | ||
"data = [pd.read_csv(os.path.join(path, file), header=None)[0] for file in options]\n", | ||
"\n", | ||
"def dayPlot(x):\n", | ||
" idx = options.index(x)\n", | ||
" xvals = np.arange(24)\n", | ||
" y = data[idx]\n", | ||
" s = None\n", | ||
" \n", | ||
" fig = go.Figure()\n", | ||
" \n", | ||
" for chunk in chunks(y, 24):\n", | ||
" d = np.array(chunk, ndmin=2)\n", | ||
" \n", | ||
" if s is None:\n", | ||
" s = d \n", | ||
" else:\n", | ||
" s = np.concatenate([s, d], axis=0)\n", | ||
" \n", | ||
" fig.add_trace(go.Scatter(x=xvals, y=chunk, line=dict(color='gray'), showlegend=False))\n", | ||
" \n", | ||
" fig.add_trace(go.Scatter(x=xvals, y=s.min(axis=0), line=dict(color='black', dash='dash'), showlegend=False))\n", | ||
" fig.add_trace(go.Scatter(x=xvals, y=s.max(axis=0), line=dict(color='black', dash='dash'), showlegend=False))\n", | ||
" fig.add_trace(go.Scatter(x=xvals, y=s.mean(axis=0), line=dict(color='black'), showlegend=False))\n", | ||
" \n", | ||
" fig.update_layout(title=x)\n", | ||
" fig.show()\n", | ||
" \n", | ||
" for i in range(2):\n", | ||
" print('hour', ''.join([f\"{i:7.0f}\" for i in xvals[i*12:12+i*12]]))\n", | ||
" print(' max', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].max(axis=0)]))\n", | ||
" print('mean', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].mean(axis=0)]))\n", | ||
"# print('mode', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].mode(axis=0)]))\n", | ||
" print(' min', ''.join([f\"{i:7.0f}\" for i in s[:,i*12:12+i*12].min(axis=0)]))\n", | ||
" print()\n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "34ade27e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "f3a2047c82ae4733aff8ad6a6cddad5a", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"interactive(children=(Dropdown(description='x', options=('pricing-data-2020-IronMtn-002.csv', 'test_prices.csv…" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"<function __main__.dayPlot(x)>" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"interact(dayPlot, x=options) #('test_prices.csv')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ca3ac299", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"[np.isnan(d).sum() for d in data]" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.