Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More examples #44

Merged
merged 4 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions docs/source/_static/p5min_error_2021_ahead_time_hists.html

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions docs/source/_static/p5min_error_2021_ahead_time_percentile.html

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions docs/source/_static/p5min_error_2021_tod_percentile.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/source/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
maxdepth: 2
---
examples/visualising_p5min_demand_forecasts
examples/p5min_demand_forecast_error_2021
```
430,812 changes: 430,812 additions & 0 deletions docs/source/examples/p5min_demand_forecast_error_2021.ipynb

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion docs/source/examples/visualising_p5min_demand_forecasts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jupytext:
format_version: 0.13
jupytext_version: 1.14.1
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
---
Expand Down Expand Up @@ -74,6 +74,8 @@ Here we'll define our datetime range that we're interested in:
## Get demand forecast data for NSW

```{code-cell} ipython3
:tags: [remove-output]

p5_run_start, p5_run_end = generate_runtimes(start, end,
"P5MIN")
p5_data = compile_data(p5_run_start, p5_run_end, start, end,
Expand Down Expand Up @@ -107,6 +109,7 @@ hvhmap = p5_demand_forecasts.hvplot.heatmap(

```{code-cell} ipython3
:tags: [remove-cell]

pio.write_html(go.Figure(hvplot.render(hvhmap, backend="plotly")), "../_static/hvhmap.html")
```

Expand All @@ -123,6 +126,7 @@ file: ../_static/hvhmap.html
To compare forecasts with actual demand data, we will use `NEMOSIS` to obtain actual demand data for NSW for this evening.

```{code-cell} ipython3
:tags: [remove-output]
# create a folder for NEMOSIS data
nemosis_cache = Path("nemosis_cache/")
if not nemosis_cache.exists():
Expand Down Expand Up @@ -213,6 +217,7 @@ fig = fig.update_layout(

```{code-cell} ipython3
:tags: [remove-cell]

pio.write_html(fig, "../_static/hvhmap+line.html")
```

Expand All @@ -237,6 +242,7 @@ run_lines = go.Figure(hvplot.render(run_time_iterations, backend="plotly"))

```{code-cell} ipython3
:tags: [remove-cell]

pio.write_html(run_lines, "../_static/run_lines.html")
```

Expand Down Expand Up @@ -276,6 +282,7 @@ overlay = overlay.update_layout(

```{code-cell} ipython3
:tags: [remove-cell]

pio.write_html(overlay, "../_static/cleaner_run_lines.html")
```

Expand All @@ -287,6 +294,7 @@ file: ../_static/cleaner_run_lines.html

```{code-cell} ipython3
:tags: [remove-cell]

for folder in ("./nemosis_cache/", "./nemseer_cache/"):
folder = Path(folder)
for file in folder.iterdir():
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

```{toctree}
---
maxdepth: 3
maxdepth: 2
caption: Contents
---
quick_start
Expand Down
6 changes: 5 additions & 1 deletion src/nemseer/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def get_sqlloader_forecast_tables(
- Removes numbering from enumerated tables for `P5MIN`
- e.g. `CONSTRAINTSOLUTION(x)` are all reduced to `CONSTRAINTSOLUTION`

Examples:
See :ref:`querying table availability <quick_start:table availability>`
Args:
year: Year
month: Month
Expand Down Expand Up @@ -248,7 +250,9 @@ def get_sqlloader_forecast_tables(

def get_sqlloader_years_and_months() -> Dict[int, List[int]]:
"""Years and months with data on NEMWeb MMSDM Historical Data SQLLoader

Examples:
See :ref:`querying date ranges \
<quick_start:date range of available data>`
Returns:
Months mapped to each year. Data is available for each of these months.
"""
Expand Down
4 changes: 4 additions & 0 deletions src/nemseer/forecast_type/run_time_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ def generate_runtimes(
may not be accurate for all :term:`forecast types`, e.g. :term:`MTPASA` which is not
run at a set time.

Examples:
See :ref:`getting valid run times for a set of forecasted time \
<quick_start:getting valid run times for a set of forecasted times>`.

Args:
forecasted_start: Forecasts pertaining to times at or after this
datetime are retained.
Expand Down
8 changes: 7 additions & 1 deletion src/nemseer/nemseer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def download_raw_data(
1. :attr:`run_start` and :attr:`run_end`
2. :attr:`forecasted_start` and :attr:`forecasted_end`

Examples:
See :ref:`downloading raw data examples <quick_start:downloading raw data>`.

Arguments:
forecast_type: One of :data:`nemseer.forecast_types`
tables: Table or tables required. A single table can be supplied as
Expand Down Expand Up @@ -135,7 +138,7 @@ def compile_data(
For each queried table, this function:

1. If required, downloads raw forecast data for the table and converts to the
requested data structure.
requested data structure.
2. Otherwise, compiles table data from either of or both of the caches.
3. Applies user-requested filtering to :term:`run times` and
:term:`forecasted times` to any raw data.
Expand All @@ -144,6 +147,9 @@ def compile_data(
If :attr:`data_format` = "df" (default), a :class:`pandas.DataFrame` is returned.
Otherwise, if :attr:`data_format` = "xr", a :class:`xarray.Dataset` is returned.

Examples:
See :ref:`compiling data examples <quick_start:compiling data>`.

Arguments:
run_start: Forecast runs at or after this datetime are queried.
run_end: Forecast runs before or at this datetime are queried.
Expand Down