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
Append schedules to timeseries #186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach better than the previous one. See my comments below.
Also, make sure you're going through the checklist in the PR (tests, docs, etc).
buildstockbatch/base.py
Outdated
if os.path.isfile(timeseries_filepath): | ||
tsdf = pd.read_csv(timeseries_filepath, parse_dates=[0]) | ||
tsdf = pd.read_csv(timeseries_filepath, parse_dates=['Time', 'TimeDST', 'TimeUTC']) | ||
schedules = pd.read_csv(schedules_filepath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the simulation doesn't generate a schedules.csv? It looks like you'll get a file not found error. There are going to continue to be versions of OpenStudio-BuildStock that don't generate schedules.csv. This should be able to gracefully handle that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point. I will add handling for that.
buildstockbatch/base.py
Outdated
schedules['TimeDST'] = tsdf['Time'] | ||
ts_and_schedule = tsdf.merge(schedules, how='left', on='TimeDST') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to the extra hour here? Is it filled with NaN
? Is that what you want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value for 1st hour at the beginning of the daylight saving period will be discarded, and the one at the end will be duplicated. This is consistent with how Energy+ handles scheduleFiles when daylight saving time is active.
Co-authored-by: Noel Merket <noel.merket@nrel.gov>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple things:
- Do we really need all these extra files in the test folder for this feature?
- It looks like the tests are failing.
buildstockbatch/test/test_eagle.py
Outdated
compare_ts_parquets(file, results_file) | ||
|
||
# Hack to clear the temporary directory. | ||
subprocess.run(['rm', '-r', results_dir.parent.as_posix()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only work on Linux/Mac. Windows doesn't have the posix rm
command. Should use something like shutil.rmtree
for a more "python native" version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we shouldn't even need this hack because once you exit the fixture, the temporary directory should be automatically be cleared. I am trying to figure out what's going on.
shutil.rmtree didn't work on my laptop, so I tried to use rm -r. Something really weird going on.
|
It's just a lot of files that we aren't using, though. Let's remove anything from that simulations_job0 folder that isn't used for the tests. |
…ch into schedule_aggregation2
@nmerket Removed files as suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Appends schedules to the timeseries output so that it gets aggregated.
DST time-shifting adjusted during append.
Pull Request Description
description here
Checklist
Not all may apply