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

Append schedules to timeseries #186

Merged
merged 13 commits into from Oct 21, 2020
Merged

Append schedules to timeseries #186

merged 13 commits into from Oct 21, 2020

Conversation

rajeee
Copy link
Contributor

@rajeee rajeee commented Oct 5, 2020

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

  • Code changes (must work)
  • Tests exercising your feature/bug fix (check coverage report on CircleCI build -> Artifacts)
  • All other unit tests passing
  • Update validation for project config yaml file changes
  • Update existing documentation
  • Run a small batch run to make sure it all works (local is fine, unless an Eagle specific feature)
  • Add to the changelog_dev.rst file and propose migration text in the pull request

Copy link
Member

@nmerket nmerket left a 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).

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)
Copy link
Member

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.

Copy link
Contributor Author

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 Show resolved Hide resolved
Comment on lines 253 to 254
schedules['TimeDST'] = tsdf['Time']
ts_and_schedule = tsdf.merge(schedules, how='left', on='TimeDST')
Copy link
Member

@nmerket nmerket Oct 6, 2020

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?

Copy link
Contributor Author

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.

@rajeee rajeee requested a review from nmerket October 12, 2020 15:02
Copy link
Member

@nmerket nmerket left a 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.

compare_ts_parquets(file, results_file)

# Hack to clear the temporary directory.
subprocess.run(['rm', '-r', results_dir.parent.as_posix()])
Copy link
Member

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.

Copy link
Contributor Author

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.

@rajeee
Copy link
Contributor Author

rajeee commented Oct 14, 2020

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.
  1. We don't need all of them for this particular test, but, I thought those would be a good reference set of test files to have since they are what the raw result from simulation looks like. So, they will come in handy to test any feature (now or in future) that processes the raw result.
  2. Working on it.

@rajeee rajeee requested a review from nmerket October 15, 2020 15:54
@nmerket
Copy link
Member

nmerket commented Oct 19, 2020

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.
1. We don't need all of them for this particular test, but, I thought those would be a good reference set of test files to have since they are what the raw result from simulation looks like. So, they will come in handy to test any feature (now or in future) that processes the raw result.

2. Working on it.

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.

@rajeee
Copy link
Contributor Author

rajeee commented Oct 19, 2020

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.
1. We don't need all of them for this particular test, but, I thought those would be a good reference set of test files to have since they are what the raw result from simulation looks like. So, they will come in handy to test any feature (now or in future) that processes the raw result.

2. Working on it.

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.

@nmerket Removed files as suggested.

Copy link
Member

@nmerket nmerket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@rajeee rajeee merged commit f17c57a into develop Oct 21, 2020
@rajeee rajeee deleted the schedule_aggregation2 branch October 21, 2020 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants