-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example run of forecast in a notebook with a plot (#39)
* example run of forecast in a notebook with a plot * add a static plot to example notebook to render in Github * small format change * small punctuation change * remove cell outputs
- Loading branch information
Showing
1 changed file
with
101 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Example Notebook to show how to predict solar power generation" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Make sure to have installed the quart_solar_forecast package: \n", | ||
"```\n", | ||
"pip install quartz_solar_forecast\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Import forecast script and PVSite class.\n", | ||
"from quartz_solar_forecast.forecast import run_forecast\n", | ||
"from quartz_solar_forecast.pydantic_models import PVSite\n", | ||
"\n", | ||
"# Import matplotlib and plotly for plotting.\n", | ||
"import plotly.express as px\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create a PVSite object with the site's latitude, longitude and capacity.\n", | ||
"site = PVSite(latitude=51.75, longitude=-1.25, capacity_kwp=1.25)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run the forecast for a specific initial timestamp.\n", | ||
"# This generates a forecast at 15 minute intervals for the following 48 hours.\n", | ||
"predictions_df = run_forecast(site=site, ts='2023-11-01')\n", | ||
"print(predictions_df)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create an interactive plot of the forecast using plotly.\n", | ||
"fig = px.line(predictions_df)\n", | ||
"fig.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create a static plot of the forecast using matplotlib.\n", | ||
"predictions_df.plot()\n", | ||
"plt.show()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "quartz_open", | ||
"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.10.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |