-
Notifications
You must be signed in to change notification settings - Fork 7
WIP: Signal Distribution and Forecast Accuracy Analysis Report #33
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
Changes from all commits
137b1fa
7278440
f5ce3f0
f1d3f21
59c1d8c
ed2d362
c94c399
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import unittest | ||
| from datetime import datetime, date | ||
| from watttime import report | ||
| from pathlib import Path | ||
| from typing import List, Union | ||
| from itertools import product | ||
|
|
||
| BA_LIST: List[str] = ["WEM"] | ||
| MODEL_DATE_LIST: List[str] = ["2022-10-01", "2024-10-16"] | ||
| SIGNAL_TYPE: str = "co2_moer" | ||
| EVAL_START: Union[str, datetime, date] = "2024-01-01T00:00Z" | ||
| EVAL_END: Union[str, datetime, date] = "2024-03-01T00:00Z" | ||
| FORECAST_SAMPLE_DAYS = 3 | ||
|
|
||
|
|
||
| class TestReport(unittest.TestCase): | ||
| def setUp(self): | ||
| self.eval_days = report.parse_eval_days( | ||
| eval_start=EVAL_START, eval_end=EVAL_END | ||
| ) | ||
| self.sample_days = report.parse_forecast_sample_days( | ||
| eval_days=self.eval_days, forecast_sample_days=FORECAST_SAMPLE_DAYS | ||
| ) | ||
|
|
||
| self.jobs = list( | ||
| report.ModelAnalysis( | ||
| ba=i[0], | ||
| model_date=i[1], | ||
| signal_type=SIGNAL_TYPE, | ||
| eval_start=EVAL_START, | ||
| eval_end=EVAL_END, | ||
| eval_days=self.eval_days, | ||
| sample_days=self.sample_days, | ||
| ) | ||
| for i in product(BA_LIST, MODEL_DATE_LIST) | ||
| ) | ||
|
|
||
| # Compile forecast_v_moer for each job | ||
| for job in self.jobs: | ||
| job.compile_forecast_v_moer() | ||
|
|
||
| def test_compile_forecast_v_moer(self): | ||
| for job in self.jobs: | ||
| self.assertFalse(job.moers.empty) | ||
| self.assertFalse(job.forecasts.empty) | ||
| self.assertFalse(job.forecasts_v_moers.empty) | ||
|
|
||
| def test_plot_sample_moers(self): | ||
| fig = report.plot_sample_moers(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_distribution_moers(self): | ||
| fig = report.plot_distribution_moers(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_ba_heatmaps(self): | ||
| fig = report.plot_ba_heatmaps(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_norm_mae(self): | ||
| fig = report.plot_norm_mae(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_rank_correlation(self): | ||
| fig = report.plot_rank_correlation(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_impact_forecast_metrics(self): | ||
| fig = report.plot_impact_forecast_metrics(self.jobs) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_sample_moers_single_job(self): | ||
| fig = report.plot_sample_moers([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_distribution_moers_single_job(self): | ||
| fig = report.plot_distribution_moers([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_ba_heatmaps_single_job(self): | ||
| fig = report.plot_ba_heatmaps([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_norm_mae_single_job(self): | ||
| fig = report.plot_norm_mae([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_rank_correlation_single_job(self): | ||
| fig = report.plot_rank_correlation([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
|
|
||
| def test_plot_impact_forecast_metrics_single_job(self): | ||
| fig = report.plot_impact_forecast_metrics([self.jobs[0]]) | ||
| self.assertGreater(len(fig.data), 0) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| from watttime.api import * | ||
| from watttime.tcy import TCYCalculator | ||
| from watttime.tcy import TCYCalculator | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This puts TCYCalculator in this file's namespace, permitting |
||
| from watttime.report import ModelAnalysis | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My suspicion is that this a workaround to load this into the jupyter notebook. If the jupyter notebook said |
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not using job(s) here and instead aligning ModelAnalysis with this variable. The natural alignment for the current draft would be to just name this something more like what ModelAnalysis dataset is: self.analysis_data, self.analyses, etc...
I would reserve the use of the word job for (i) uses of a parallelization package (ii) deeper down in this package (see comment there)