From 1657d909bbb610ac056bd7c1e2414d901d8f0789 Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Fri, 15 Mar 2024 16:20:18 -0700 Subject: [PATCH 1/9] remove unneccesary call to sunrise/sunset estimator --- pvsystemprofiler/estimator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pvsystemprofiler/estimator.py b/pvsystemprofiler/estimator.py index e4a62b21..4f7cd89f 100644 --- a/pvsystemprofiler/estimator.py +++ b/pvsystemprofiler/estimator.py @@ -82,14 +82,13 @@ def __init__( solar_noon_method == "optimized_estimates" or daylight_method == "optimized_estimates" ): - ss = SunriseSunset() + ss = self.data_handler.daytime_analysis if solar_noon_method == "rise_set_average": self.solarnoon = avg_sunrise_sunset(self.data_matrix) elif solar_noon_method == "energy_com": self.solarnoon = energy_com(self.data_matrix) if solar_noon_method == "optimized_estimates": - ss.run_optimizer(data=self.data_matrix) self.solarnoon = np.nanmean( [ss.sunrise_estimates, ss.sunset_estimates], axis=0 ) From 6c4a0e246a7f03ce7abf4f0dd163da283bcd3d4f Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Fri, 15 Mar 2024 16:20:37 -0700 Subject: [PATCH 2/9] add hint --- solardatatools/data_handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/solardatatools/data_handler.py b/solardatatools/data_handler.py index 852c58aa..b94bd311 100644 --- a/solardatatools/data_handler.py +++ b/solardatatools/data_handler.py @@ -208,6 +208,9 @@ def run_pipeline( Authors: Bennet Meyers and Sara Miskovich, SLAC + (Tip: if you have a mosek [https://www.mosek.com/] license and have it + installed on your system, try setting solver='MOSEK' for a speedup) + This material is based upon work supported by the U.S. Department of Energy's Office of Energy Efficiency and Renewable Energy (EERE) under the Solar Energy Technologies Office Award Number 38529.\n From 1a167ee1a9906d5b8554521b6259e572f2409340 Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Fri, 15 Mar 2024 16:34:51 -0700 Subject: [PATCH 3/9] require a minimum of 20 monte carlo samples --- solardatatools/algorithms/loss_factor_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solardatatools/algorithms/loss_factor_analysis.py b/solardatatools/algorithms/loss_factor_analysis.py index b03d28ac..f006e491 100644 --- a/solardatatools/algorithms/loss_factor_analysis.py +++ b/solardatatools/algorithms/loss_factor_analysis.py @@ -164,7 +164,7 @@ def estimate_degradation_rate( f"changes: {diffs[-1][0]:.3e}, {diffs[-1][1]:.3e}, {diffs[-1][2]:.3e}" ) # check exit conditions - if counter < 10: + if counter < 20: # get at least 10 samples continue elif counter > max_samples: From ac32188f4a166f0821cbcbca7ac59fa709a40209 Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Sat, 16 Mar 2024 11:36:50 -0700 Subject: [PATCH 4/9] update labeling procedure --- solardatatools/algorithms/capacity_change.py | 23 ++++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/solardatatools/algorithms/capacity_change.py b/solardatatools/algorithms/capacity_change.py index ea60feef..1e3b2fcb 100644 --- a/solardatatools/algorithms/capacity_change.py +++ b/solardatatools/algorithms/capacity_change.py @@ -34,7 +34,7 @@ def run( quantile=1.00, w1=40e-6, # scaled weights for QSS w2=6561e-6, - solver=None + solver=None, ): if filter is None: filter = np.ones(data.shape[1], dtype=bool) @@ -43,24 +43,23 @@ def run( metric /= np.max(metric) s1, s2, s3 = l1_l1d1_l2d2p365( - metric, - use_ixs=filter, - w1=w1, - w2=w2, - solver=solver, - sum_card=True + metric, use_ixs=filter, w1=w1, w2=w2, solver=solver, sum_card=True ) else: # print('No valid values! Please check your data and filter.') return # Get capacity assignments - rounded_s1 = np.round(s1, 1) + def custom_round(x, base=0.05): + ndigits = len(str(base).split(".")[-1]) + return np.round(base * np.round(x / base), ndigits) + + rounded_s1 = custom_round(s1) set_labels = list(set(rounded_s1)) capacity_assignments = [set_labels.index(i) for i in rounded_s1] self.metric = metric - self.s1 = s1 # pwc - self.s2 = s2 # seasonal - self.s3 = s3 # linear - self.labels = capacity_assignments \ No newline at end of file + self.s1 = s1 # pwc + self.s2 = s2 # seasonal + self.s3 = s3 # linear + self.labels = capacity_assignments From 07313174448bfa9f265c548847c7f92f59d79350 Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Sat, 16 Mar 2024 11:42:49 -0700 Subject: [PATCH 5/9] limit progress bar width --- solardatatools/data_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solardatatools/data_handler.py b/solardatatools/data_handler.py index c8657c0e..5a9ac199 100644 --- a/solardatatools/data_handler.py +++ b/solardatatools/data_handler.py @@ -248,7 +248,7 @@ def run_pipeline( ###################################################################### t[0] = time() if verbose: - progress = tqdm(desc="task list", total=7) + progress = tqdm(desc="task list", total=7, ncols=80) if self.data_frame_raw is not None: # If power_col not passed, assume that the first column contains the # data to be processed From b858f071e41dd0b7f27f78e63c4520f5d1ed41d9 Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Mon, 18 Mar 2024 14:25:21 -0700 Subject: [PATCH 6/9] add figsize control --- solardatatools/algorithms/loss_factor_analysis.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/solardatatools/algorithms/loss_factor_analysis.py b/solardatatools/algorithms/loss_factor_analysis.py index f006e491..0aac8f1c 100644 --- a/solardatatools/algorithms/loss_factor_analysis.py +++ b/solardatatools/algorithms/loss_factor_analysis.py @@ -241,12 +241,14 @@ def report(self): } return out - def plot_pie(self): + def plot_pie(self, figsize=None): """ Create a pie plot of losses :return: matplotlib figure """ + if figsize is not None: + plt.figure(figsize=figsize) plt.pie( [ np.clip(-self.degradation_energy_loss, 0, np.inf), From 3eed7930c680a456e9b9def43fd9fa5e499a962e Mon Sep 17 00:00:00 2001 From: Meyers-Im Date: Mon, 18 Mar 2024 14:26:51 -0700 Subject: [PATCH 7/9] update comment --- solardatatools/algorithms/loss_factor_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solardatatools/algorithms/loss_factor_analysis.py b/solardatatools/algorithms/loss_factor_analysis.py index 0aac8f1c..c0dcc22b 100644 --- a/solardatatools/algorithms/loss_factor_analysis.py +++ b/solardatatools/algorithms/loss_factor_analysis.py @@ -165,7 +165,7 @@ def estimate_degradation_rate( ) # check exit conditions if counter < 20: - # get at least 10 samples + # get at least 20 samples continue elif counter > max_samples: # don't go over max_samples From dbfb3d13c2534b8dfe236d0642bfa41e5f39d0cc Mon Sep 17 00:00:00 2001 From: Bennet Meyers Date: Mon, 18 Mar 2024 14:39:51 -0700 Subject: [PATCH 8/9] Update requirements.txt unpin spcqe commit --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8ba81724..80a63cd4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,4 @@ osqp clarabel qss tqdm -spcqe @ git+https://github.com/cvxgrp/spcqe.git@29c72667f6f0876531f5cff0e43c2201591183e9 +spcqe @ git+https://github.com/cvxgrp/spcqe.git From 30457990f03c7d030f76aa95141b252a21dfa96c Mon Sep 17 00:00:00 2001 From: Bennet Meyers Date: Mon, 18 Mar 2024 15:04:08 -0700 Subject: [PATCH 9/9] try pinning conda for now --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 03461f00..012845d8 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -48,7 +48,7 @@ jobs: - name: Install the Conda Dependencies run: | conda config --set always_yes yes --set auto_update_conda false - conda update conda + conda install conda=24.1.2 conda install -n base conda-libmamba-solver conda install python=3.10 conda-build colorama pip ruamel ruamel.yaml rich jsonschema -c conda-forge git fetch --prune --unshallow --tags