Skip to content
Merged
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
4 changes: 2 additions & 2 deletions representative_periods/database_processing_v4_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def process_single_day_period(database: str, hours: list):

# Get a running proportion sum of DSD
df['run_sum'] = df['dsd'].cumsum()/df['dsd'].sum()
# Get the smallest DSD above thresh to zero out actual table
# Get the largest DSD whose cumulative proportion is still below the threshold
thresh_dsd = df["dsd"].loc[df["run_sum"] < utils.config["dsd_threshold"]].max()
thresh_dsd += 1e-12 # Small buffer to avoid floating point issues
thresh_dsd -= 1e-10 # Small buffer to avoid floating point issues

# There might be nothing under the threshold if using few rep days
if not pd.isna(thresh_dsd) and thresh_dsd < df["dsd"].max():
Expand Down
Loading