Skip to content

Commit

Permalink
Merge pull request #101 from NREL/fix_timeseries_aggregation_bug
Browse files Browse the repository at this point in the history
Fix timeseries aggregation bug
  • Loading branch information
nmerket committed Aug 23, 2019
2 parents d4afdaa + c27f7db commit 96d7c54
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 181 deletions.
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.

0 comments on commit 96d7c54

Please sign in to comment.