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

Postprocess timeseries fails when upgrade is not applicable to buildings #199

Closed
lixiliu opened this issue Dec 16, 2020 · 7 comments · Fixed by #230
Closed

Postprocess timeseries fails when upgrade is not applicable to buildings #199

lixiliu opened this issue Dec 16, 2020 · 7 comments · Fixed by #230
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@lixiliu
Copy link
Contributor

lixiliu commented Dec 16, 2020

####################
Traceback (most recent call last):
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/buildstockbatch/utils.py", line 61, in run_with_error_capture
return func(*args, **kwargs)
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/buildstockbatch/eagle.py", line 747, in main
batch.process_results()
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/buildstockbatch/base.py", line 779, in process_results
postprocessing.combine_results(fs, self.results_dir, self.cfg, do_timeseries=do_timeseries)
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/buildstockbatch/postprocessing.py", line 332, in combine_results
mean_mem = np.mean(dask.compute(map(get_ts_mem_usage_d, random.sample(ts_filenames, sample_size)))[0])
File "<array_function internals>", line 6, in mean
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 3373, in mean
out=out, **kwargs)
File "/shared-projects/buildstock/envs/buildstock-0.19/lib/python3.7/site-packages/numpy/core/_methods.py", line 172, in _mean
ret = ret / rcount
TypeError: unsupported operand type(s) for /: 'map' and 'int'
####################

My upgrade run is erring out on postprocessing the timeseries, because there are a couple upgrades that ended up being not applicable to my SFD only stock, for example, it's erring out on an upgrade on finished roofs because SFD do not have finished roofs. This causes:

  • 'ts_filenames':[] # because all buildings has no 'completed_status'=success
  • sample_size=0
  • and ultimately, TypeError: unsupported operand type(s) for /: 'map' and 'int'

Can we add to the script a way to skip the timeseries post-processing when an upgrade has sample_size=0?
Also, this can benefit from an upgrade applicability check/warning based on buildstock.csv in the sampling stage.

@lixiliu lixiliu added bug Something isn't working enhancement New feature or request labels Dec 16, 2020
@lixiliu lixiliu added enhancement New feature or request and removed enhancement New feature or request labels Dec 28, 2020
@lixiliu
Copy link
Contributor Author

lixiliu commented Dec 28, 2020

@afontani This is the issue I've created regarding the 0 sample error. Feel free to add your thought to it.

@afontani
Copy link
Collaborator

@lixiliu: Thanks. I was thinking about how to navigate this error in the future. Here are a couple of thoughts:

  1. Somewhere throw a warning and/or log which upgrades have 0 samples.
  2. Before the compute jobs are submitted, check the apply logic for the upgrades to see if there will be any issues with the upgrade logic
  3. Can we create a feature that only runs the upgrades with a specified baseline? I mention this because if there are 10 upgrade packages and 9 of them complete successfully, then we currently have to re-run the baseline every time we troubleshoot the upgrades.

@nmerket
Copy link
Member

nmerket commented Jan 20, 2021

Passing

baseline:
  skip_sims: true

will skip running the baseline and only do the upgrades.

@vtnate
Copy link
Contributor

vtnate commented Jan 26, 2021

@afontani I just ran into this error myself, and posted #206 before seeing this issue. I'd love to see your suggestion # 2 above implemented as part of the validation.

@nmerket
Copy link
Member

nmerket commented May 4, 2021

@lixiliu @rajeee This looks like it was fixed in #212.

if not ts_filenames:
logger.info(f"There are no timeseries files for upgrade{upgrade_id}.")
continue

Can I close this issue?

@nmerket
Copy link
Member

nmerket commented May 4, 2021

I just ran a small test with a conflicting upgrade and got this output


     _ __         _     __,              _ __
    ( /  )    o  //   /(    _/_       / ( /  )     _/_    /
     /--< , ,,  // __/  `.  /  __ _, /<  /--< __,  /  _, /
    /___/(_/_(_(/_(_/_(___)(__(_)(__/ |_/___/(_/(_(__(__/ /_
      Executing BuildStock projects with grace since 2018


INFO:2021-05-04 10:41:26:buildstockbatch.base:Base Validation Successful
DEBUG:2021-05-04 10:41:26:buildstockbatch.base:Using OpenStudio version: 2.9.1 with SHA: 3472e8b799
DEBUG:2021-05-04 10:41:27:buildstockbatch.localdocker:Pulling docker image: nrel/openstudio:2.9.1
DEBUG:2021-05-04 10:41:58:buildstockbatch.sampler.residential_quota:Sampling project_national/Usage Level...
DEBUG:2021-05-04 10:41:58:buildstockbatch.sampler.residential_quota:Sampling project_national/Orientation...
...
DEBUG:2021-05-04 10:49:05:buildstockbatch.localdocker:Compressing simulation outputs to /Users/nmerket/projects/resstock/resstock/project_national/outputs/simulation_output/simulations_job0.tar.gz
INFO:2021-05-04 10:49:10:buildstockbatch.postprocessing:Creating results_df.
INFO:2021-05-04 10:49:11:buildstockbatch.postprocessing:Collecting all the columns in timeseries parquet files.
INFO:2021-05-04 10:49:11:buildstockbatch.postprocessing:Writing /Users/nmerket/projects/resstock/resstock/project_national/outputs/results_csvs/results_up00.csv.gz
INFO:2021-05-04 10:49:12:buildstockbatch.postprocessing:Max parquet memory: 4000 MB
INFO:2021-05-04 10:49:12:buildstockbatch.postprocessing:Combining about 8 parquets together. Creating 1 groups.
INFO:2021-05-04 10:49:12:buildstockbatch.postprocessing:Created directory /Users/nmerket/projects/resstock/resstock/project_national/outputs/parquet/timeseries/upgrade=0/ for writing.
INFO:2021-05-04 10:49:14:buildstockbatch.postprocessing:Finished combining and saving timeseries for upgrade0.
INFO:2021-05-04 10:49:14:buildstockbatch.postprocessing:Writing /Users/nmerket/projects/resstock/resstock/project_national/outputs/results_csvs/results_up01.csv.gz
INFO:2021-05-04 10:49:14:buildstockbatch.postprocessing:There are no timeseries files for upgrade1.
INFO:2021-05-04 10:49:14:buildstockbatch.base:Removing intermediate files.
INFO:2021-05-04 10:49:14:buildstockbatch.postprocessing:Removing temporary files

Looks like it is working as intended.

@rajeee
Copy link
Contributor

rajeee commented May 4, 2021

@nmerket Agreed. That should fix it.

@nmerket nmerket mentioned this issue May 4, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants