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

Sampler and Workflow Refactor #187

Merged
merged 27 commits into from Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9e78479
refactoring sampler classes
nmerket Oct 8, 2020
d53d81d
passing args to samplers, making downselect a sampler
nmerket Oct 12, 2020
f54e575
mostly fixing validation
nmerket Oct 26, 2020
eba42ae
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Nov 12, 2020
674bd94
minor formatting change in tests
nmerket Nov 12, 2020
91183bf
rearranging workflow generator
nmerket Nov 14, 2020
89ff745
fixing style issues
nmerket Nov 16, 2020
0ab2afc
saving my place after a long absence
nmerket Dec 14, 2020
40a64dc
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Dec 14, 2020
a093f8a
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Jan 4, 2021
19c909e
passing n_datapoints into create_osw
nmerket Jan 4, 2021
a491894
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Jan 4, 2021
5ed38ca
fixing workflow generator tests
nmerket Jan 4, 2021
beabfd0
fixing tests
nmerket Jan 5, 2021
03f3b6f
changes to project_resstock_national.yml for testing
nmerket Jan 11, 2021
29ee6a2
fixing eagle errors
nmerket Jan 12, 2021
b68a1b1
fixing testing mock errors
nmerket Jan 12, 2021
331a251
documentation, migration guide, and changelog
nmerket Jan 22, 2021
d3f6d10
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Jan 22, 2021
e4a5349
Merge remote-tracking branch 'origin/develop' into sampler_workflow_r…
nmerket Jan 28, 2021
2f12c9e
cleaning up a few more OpenStudio-BuildStock to resstock references
nmerket Jan 28, 2021
7a1232b
updating example project files
nmerket Jan 28, 2021
639cfbf
adding sample_file key
nmerket Feb 8, 2021
3b44c8f
pinning to pyarrow<3
nmerket Feb 8, 2021
a993964
yaml file updates for Eric
nmerket Feb 8, 2021
9fa36be
Comments on intentional bad inputs
ejhw Feb 9, 2021
c671702
Reorder downselect args
ejhw Feb 9, 2021
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
31 changes: 17 additions & 14 deletions aws_demo_project.yml
@@ -1,33 +1,36 @@
schema_version: 0.2
stock_type: residential
schema_version: '0.3'
buildstock_directory: ../resstock # Relative to this file or absolute
project_directory: project_national # Relative to buildstock_directory
output_directory: ../demo_test_outputs
weather_files_url: https://data.nrel.gov/system/files/128/ResStock_TMY3.zip
ejhw marked this conversation as resolved.
Show resolved Hide resolved

baseline:
n_datapoints: 4 # Comment this line out if using a custom buildstock csv file
n_buildings_represented: 133172057 # Total number of residential dwelling units in contiguous United States, including unoccupied units, resulting from acensus tract level query of ACS 5-yr 2016 (i.e. 2012-2016), using this script: https://github.com/NREL/resstock-estimation/blob/master/sources/spatial/tsv_maker.py.
sampling_algorithm: quota # The default resstock sampling algorithm - use precomputed if using the precomputed_sample option

sampler:
type: residential_quota # change to residential_quota_downselect to do downselect
args:
n_datapoints: 4
# resample: false # Uncomment and set specify logic you you want to downselect to a subset of the building stock
# logic:
# - Geometry Building Type RECS|Single-Family Detached
# - Vacancy Status|Occupied
ejhw marked this conversation as resolved.
Show resolved Hide resolved

workflow_generator:
type: residential_default
args:
timeseries_csv_export:
reporting_frequency: Hourly
include_enduse_subcategories: true

upgrades:
- upgrade_name: Triple-Pane Windows
options:
- option: Windows|Low-E, Triple, Non-metal, Air, L-Gain
# apply_logic:
costs:
- value: 45.77
multiplier: Window Area (ft^2)
lifetime: 30
timeseries_csv_export:
reporting_frequency: Hourly
include_enduse_subcategories: true

# downselect: # Uncomment and set specify logic you you want to downselect to a subset of the building stock
# resample: true
# logic:
# - Geometry Building Type RECS|Single-Family Detached
# - Vacancy Status|Occupied

aws:
# The job_identifier must be unique, start with alpha, not include dashes, and limited to 10 chars
Expand Down
9 changes: 6 additions & 3 deletions buildstockbatch/__version__.py
@@ -1,9 +1,12 @@
import datetime as dt


__title__ = 'buildstockbatch'
__description__ = 'Executing BuildStock projects on batch infrastructure.'
__url__ = 'http://github.com/NREL/buildstockbatch'
__version__ = '0.19'
__schema_version__ = '0.2'
__version__ = '0.20'
__schema_version__ = '0.3'
__author__ = 'Noel Merket'
__author_email__ = 'noel.merket@nrel.gov'
__license__ = 'BSD-3'
__copyright__ = 'Copyright 2020 The Alliance for Sustainable Energy'
__copyright__ = 'Copyright {} The Alliance for Sustainable Energy'.format(dt.date.today().year)
12 changes: 5 additions & 7 deletions buildstockbatch/aws/aws.py
Expand Up @@ -40,7 +40,7 @@
from buildstockbatch.base import ValidationError
from buildstockbatch.aws.awsbase import AwsJobBase
from buildstockbatch import postprocessing
from ..utils import log_error_details
from ..utils import log_error_details, get_project_configuration

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1661,7 +1661,7 @@ def __init__(self, project_filename):

@staticmethod
def validate_instance_types(project_file):
cfg = AwsBatch.get_project_configuration(project_file)
cfg = get_project_configuration(project_file)
aws_config = cfg['aws']
boto3_session = boto3.Session(region_name=aws_config['region'])
ec2 = boto3_session.client('ec2')
Expand Down Expand Up @@ -1772,10 +1772,7 @@ def run_batch(self):
"""

# Generate buildstock.csv
if 'downselect' in self.cfg:
buildstock_csv_filename = self.downselect()
else:
buildstock_csv_filename = self.run_sampling()
buildstock_csv_filename = self.sampler.run_sampling()

# Compress and upload assets to S3
with tempfile.TemporaryDirectory() as tmpdir, tempfile.TemporaryDirectory() as tmp_weather_dir:
Expand Down Expand Up @@ -1837,6 +1834,7 @@ def run_batch(self):
with open(job_json_filename, 'w') as f:
json.dump({
'job_num': i,
'n_datapoints': n_datapoints,
'batch': batch,
}, f, indent=4)
array_size = i
Expand Down Expand Up @@ -1981,7 +1979,7 @@ def run_job(cls, job_id, bucket, prefix, job_name, region):
sim_id = f'bldg{building_id:07d}up{upgrade_id:02d}'

# Create OSW
osw = cls.create_osw(cfg, sim_id, building_id, upgrade_idx)
osw = cls.create_osw(cfg, jobs_d['n_datapoints'], sim_id, building_id, upgrade_idx)
with open(os.path.join(sim_dir, 'in.osw'), 'w') as f:
json.dump(osw, f, indent=4)

Expand Down