Skip to content

Commit

Permalink
Merge pull request #126 from slacgismo/dev
Browse files Browse the repository at this point in the history
Minor user experience improvements
  • Loading branch information
pluflou authored Mar 18, 2024
2 parents 0b19543 + 3045799 commit 0b673ff
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pvsystemprofiler/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 11 additions & 12 deletions solardatatools/algorithms/capacity_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
self.s1 = s1 # pwc
self.s2 = s2 # seasonal
self.s3 = s3 # linear
self.labels = capacity_assignments
8 changes: 5 additions & 3 deletions solardatatools/algorithms/loss_factor_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def estimate_degradation_rate(
f"changes: {diffs[-1][0]:.3e}, {diffs[-1][1]:.3e}, {diffs[-1][2]:.3e}"
)
# check exit conditions
if counter < 10:
# get at least 10 samples
if counter < 20:
# get at least 20 samples
continue
elif counter > max_samples:
# don't go over max_samples
Expand Down Expand Up @@ -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),
Expand Down
5 changes: 4 additions & 1 deletion solardatatools/data_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -245,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
Expand Down

0 comments on commit 0b673ff

Please sign in to comment.