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

Sorting results by building_id #332

Merged
merged 2 commits into from Dec 1, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions buildstockbatch/postprocessing.py
Expand Up @@ -446,7 +446,6 @@ def combine_results(fs, results_dir, cfg, do_timeseries=True):
else:
logger.info(f"There are no timeseries files for upgrade {Path(upgrade_folder).name}.")

if do_timeseries:
# Sort the columns
all_ts_cols_sorted = ['building_id'] + sorted(x for x in all_ts_cols if x.startswith('time'))
all_ts_cols.difference_update(all_ts_cols_sorted)
Expand Down Expand Up @@ -474,11 +473,11 @@ def combine_results(fs, results_dir, cfg, do_timeseries=True):
logger.info(f"Processing upgrade {upgrade_id}. ")
df = dask.compute(results_df_groups.get_group(upgrade_id))[0]
logger.info(f"Obtained results_df for {upgrade_id} with {len(df)} datapoints. ")
df.sort_index(inplace=True)
df.rename(columns=to_camelcase, inplace=True)
df = clean_up_results_df(df, cfg, keep_upgrade_id=True)
del df['upgrade']
df.set_index('building_id', inplace=True)
df.sort_index(inplace=True)
schema = None
partition_df = df[df_partition_columns].copy()
partition_df.rename(columns={df_c: c for df_c, c in zip(df_partition_columns, partition_columns)},
Expand Down
9 changes: 8 additions & 1 deletion docs/changelog/changelog_dev.rst
Expand Up @@ -35,4 +35,11 @@ Development Changelog
Adds a validation step to verify the ApplyUpgrade measure has enough
options specified to support the upgrades in the current project file.
Instructs the user how to add more options to the ApplyUpgrade measure
if not.
if not.

.. change::
:tags: bugfix
:pullreq: 332
:tickets: 331

Sort the results by ``building_id``.