diff --git a/examples/example_notebook.ipynb b/examples/example_notebook.ipynb new file mode 100644 index 00000000..0772040d --- /dev/null +++ b/examples/example_notebook.ipynb @@ -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 +}