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

Fix timeseries aggregation bug #101

Merged
merged 2 commits into from Aug 23, 2019
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
18 changes: 12 additions & 6 deletions buildstockbatch/postprocessing.py
Expand Up @@ -155,17 +155,23 @@ def get_factor(folder):

if type(inp1) is str:
full_path = f"{inp1}/run/enduse_timeseries.parquet"
with fs.open(full_path, 'rb') as f:
file1 = pd.read_parquet(f, engine='pyarrow').set_index('Time')
file1 = file1 * get_factor(inp1)
try:
with fs.open(full_path, 'rb') as f:
file1 = pd.read_parquet(f, engine='pyarrow').set_index('Time')
file1 = file1 * get_factor(inp1)
except ResourceNotFound:
file1 = pd.DataFrame() # if the timeseries file is missing, set it to empty dataframe
else:
file1 = inp1

if type(inp2) is str:
full_path = f"{inp2}/run/enduse_timeseries.parquet"
with fs.open(full_path, 'rb') as f:
file2 = pd.read_parquet(f, engine='pyarrow').set_index('Time')
file2 = file2 * get_factor(inp2)
try:
with fs.open(full_path, 'rb') as f:
file2 = pd.read_parquet(f, engine='pyarrow').set_index('Time')
file2 = file2 * get_factor(inp2)
except ResourceNotFound:
file2 = pd.DataFrame()
else:
file2 = inp2

Expand Down
2 changes: 1 addition & 1 deletion buildstockbatch/test/test_base.py
Expand Up @@ -49,7 +49,7 @@ def test_missing_simulation_output_report_applicable(basic_residential_project_f
up01_parquet = os.path.join(results_dir, 'parquet', 'upgrades', 'upgrade=1', 'results_up01.parquet')
assert(os.path.exists(up01_parquet))
df = pd.read_parquet(up01_parquet, engine='pyarrow')
assert((~df['simulation_output_report.applicable']).any())
assert(not df['simulation_output_report.applicable'].any())


def test_combine_files_flexible(basic_residential_project_file):
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified buildstockbatch/test/test_results/results_csvs/results_up01.csv.gz
Binary file not shown.

Large diffs are not rendered by default.

This file was deleted.

Binary file not shown.
@@ -0,0 +1 @@
Failed Workflow 2019-04-17 17:32:31 +0000

This file was deleted.