From 1d036d0a3bd708dbf33975d784491e5093639b0e Mon Sep 17 00:00:00 2001 From: Tanushree Date: Tue, 5 Mar 2024 19:54:36 -0700 Subject: [PATCH] add code for downloading weather --- tests/models/test_models.py | 44 +- .../base_files/end_use_profiles_mapping.xlsx | Bin 0 -> 13048 bytes workflow/base_files/external_TMY3_sources.csv | 1068 +++++++++++++++++ workflow/lib/models.py | 137 ++- 4 files changed, 1210 insertions(+), 39 deletions(-) create mode 100644 workflow/base_files/end_use_profiles_mapping.xlsx create mode 100644 workflow/base_files/external_TMY3_sources.csv diff --git a/tests/models/test_models.py b/tests/models/test_models.py index 08fde548..4bcaf832 100644 --- a/tests/models/test_models.py +++ b/tests/models/test_models.py @@ -14,12 +14,11 @@ def test_model_downloads_comstock(): # folder to download models folder_name = Path(os.path.join(current_directory, 'comsstock')) # folder to configure and upload to alfalfa - alfalfa_folder = Path(os.path.join(current_directory, 'alfalfa_folder')) id = ['bldg0000001','bldg0000002'] objA = Inputs - objA.__init__(Inputs, '2023','comstock_amy2018_release_2','18', id, folder_name) + objA.__init__(Inputs, '2021','comstock_tmy3_release_1','00', id, folder_name) # remove if folder exists shutil.rmtree(folder_name, ignore_errors=True) @@ -27,31 +26,22 @@ def test_model_downloads_comstock(): objB = Models objB.download_models(objA) - - save_folder_1 = os.path.join(folder_name, id[0]) - save_folder_2 = os.path.join(folder_name, id[1]) + save_folder_1 = os.path.join(folder_name, id[0], 'models', id[0] + '.osm') + workflow_1 = os.path.join(folder_name, id[0], 'workflow.osw') + save_folder_2 = os.path.join(folder_name, id[1], 'models', id[1] + '.osm') + workflow_2 = os.path.join(folder_name, id[1], 'workflow.osw') # check if models are downloaded - assert os.path.exists(folder_name) assert os.path.exists(save_folder_1) assert os.path.exists(save_folder_2) - - shutil.rmtree(alfalfa_folder, ignore_errors=True) - - # Test Model Setup - objC = Setup - objC.create_folder(objA, alfalfa_folder) - - assert os.path.exists(os.path.join(alfalfa_folder, 'files')) - assert os.path.exists(os.path.join(alfalfa_folder, 'alfalfa_upload', id[0], 'models', f'{id[0]}.osm')) - + assert os.path.exists(workflow_1) + assert os.path.exists(workflow_2) def test_model_downloads_resstock(): current_directory = Path(__file__).resolve().parent folder_name = Path(os.path.join(current_directory, 'resstock')) - alfalfa_folder = Path(os.path.join(current_directory, 'alfalfa_folder_res')) id = ['bldg0000003','bldg0000004'] objA = Inputs @@ -62,19 +52,13 @@ def test_model_downloads_resstock(): objB = Models objB.download_models(objA) - save_folder_1 = os.path.join(folder_name, id[0]) - save_folder_2 = os.path.join(folder_name, id[1]) - assert os.path.exists(folder_name) + save_folder_1 = os.path.join(folder_name, id[0], 'models', id[0] + '.osm') + workflow_1 = os.path.join(folder_name, id[0], 'workflow.osw') + save_folder_2 = os.path.join(folder_name, id[1], 'models', id[1] + '.osm') + workflow_2 = os.path.join(folder_name, id[1], 'workflow.osw') + assert os.path.exists(save_folder_1) + assert os.path.exists(workflow_1) assert os.path.exists(save_folder_2) - - shutil.rmtree(alfalfa_folder, ignore_errors=True) - - # Test Model Setup - objC = Setup - objC.create_folder(objA, alfalfa_folder) - - assert os.path.exists(os.path.join(alfalfa_folder, 'files')) - assert os.path.exists(os.path.join(alfalfa_folder, 'alfalfa_upload',id[0], 'models', f'{id[0]}.osm')) - + assert os.path.exists(workflow_2) diff --git a/workflow/base_files/end_use_profiles_mapping.xlsx b/workflow/base_files/end_use_profiles_mapping.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..d45c14c81927aabb468475b6b00b1bb28a4966bc GIT binary patch literal 13048 zcmeIYbx<7Zwmv+#yGw9)cemgWT!Z_dGr`>y)#W&SJCwWfWhEJTJAl8-9dl;Rc%?>Q<#I-t%)fFq!9ov0mG|h9dxD=Hg z!wDG>Z}DEJ1V@VaPwGIZsuzji(}dEaJDbvNzOnQtY!P?UEg&X{Hn9*AaoVGWKOFs8 z=IU(pAQ(6itEiE!GUIgQVmL&KhYQ-l{pk_+r67V@p2*^0^_sv}D2k&UmX~L88!v?Q zhU|zv_SB;-g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