honeybee-radiance-postprocess 0.4.227__py2.py3-none-any.whl → 0.4.228__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- honeybee_radiance_postprocess/cli/translate.py +70 -1
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/METADATA +1 -1
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/RECORD +7 -7
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/LICENSE +0 -0
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/WHEEL +0 -0
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/entry_points.txt +0 -0
- {honeybee_radiance_postprocess-0.4.227.dist-info → honeybee_radiance_postprocess-0.4.228.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,11 @@
|
|
1
1
|
"""Commands to translate objects."""
|
2
2
|
import sys
|
3
3
|
import logging
|
4
|
+
from pathlib import Path
|
5
|
+
import shutil
|
4
6
|
import numpy as np
|
5
7
|
import click
|
6
|
-
|
8
|
+
import json
|
7
9
|
|
8
10
|
from ..reader import binary_to_array
|
9
11
|
|
@@ -129,3 +131,70 @@ def binary_to_npy(mtx_file, conversion, name, output_folder):
|
|
129
131
|
sys.exit(1)
|
130
132
|
else:
|
131
133
|
sys.exit(0)
|
134
|
+
|
135
|
+
|
136
|
+
@translate.command('annual-daylight-npy-to-ill')
|
137
|
+
@click.argument(
|
138
|
+
'folder',
|
139
|
+
type=click.Path(exists=True, file_okay=False, dir_okay=True, resolve_path=True)
|
140
|
+
)
|
141
|
+
@click.option(
|
142
|
+
'--output-folder', '-of', help='Output folder. If not provided the output '
|
143
|
+
'folder will be created in the same directory as the results folder. The '
|
144
|
+
'new folder will be called results_ill.', default=None,
|
145
|
+
type=click.Path(exists=False, file_okay=False, dir_okay=True, resolve_path=True)
|
146
|
+
)
|
147
|
+
def annual_daylight_npy_to_ill(folder, output_folder):
|
148
|
+
"""Convert an annual daylight results folder to older version.
|
149
|
+
|
150
|
+
This command reads an annual daylight results folder with results saved as
|
151
|
+
npy files (NumPy), and converts the npy files to text files in the old
|
152
|
+
results folder format.
|
153
|
+
|
154
|
+
\b
|
155
|
+
Args:
|
156
|
+
folder: Results folder. This folder is an output folder of annual
|
157
|
+
daylight recipe. Folder should include grids_info.json and
|
158
|
+
sun-up-hours.txt.
|
159
|
+
"""
|
160
|
+
try:
|
161
|
+
folder = Path(folder)
|
162
|
+
static_ill_folder = folder.joinpath('__static_apertures__/default/total')
|
163
|
+
if not static_ill_folder.exists():
|
164
|
+
raise FileNotFoundError(
|
165
|
+
'No results were found for static apertures in the results '
|
166
|
+
'folder.')
|
167
|
+
grids_info_file = folder.joinpath('grids_info.json')
|
168
|
+
if not grids_info_file.exists():
|
169
|
+
raise FileNotFoundError(
|
170
|
+
'The file grids_info.json was not found in the results folder.')
|
171
|
+
sun_up_hours_file = folder.joinpath('sun-up-hours.txt')
|
172
|
+
if not sun_up_hours_file.exists():
|
173
|
+
raise FileNotFoundError(
|
174
|
+
'The file sun-up-hours.txt was not found in the results folder.')
|
175
|
+
|
176
|
+
if output_folder is None:
|
177
|
+
output_folder = folder.parent.joinpath('results_ill')
|
178
|
+
else:
|
179
|
+
output_folder = Path(output_folder)
|
180
|
+
output_folder.mkdir(parents=True, exist_ok=True)
|
181
|
+
|
182
|
+
with open(grids_info_file) as json_file:
|
183
|
+
grids_info = json.load(json_file)
|
184
|
+
|
185
|
+
for grid_info in grids_info:
|
186
|
+
full_id = grid_info['full_id']
|
187
|
+
npy_file = static_ill_folder.joinpath(f'{full_id}.npy')
|
188
|
+
|
189
|
+
array = np.load(npy_file)
|
190
|
+
output = Path(output_folder, full_id + '.ill')
|
191
|
+
np.savetxt(output, array, fmt='%.7e', delimiter='\t')
|
192
|
+
|
193
|
+
# copy grids_info and sun-up-hours
|
194
|
+
shutil.copy(grids_info_file, output_folder.joinpath('grids_info.json'))
|
195
|
+
shutil.copy(sun_up_hours_file, output_folder.joinpath('sun-up-hours.txt'))
|
196
|
+
except Exception:
|
197
|
+
_logger.exception('Converting annual daylight results folder failed.')
|
198
|
+
sys.exit(1)
|
199
|
+
else:
|
200
|
+
sys.exit(0)
|
@@ -18,12 +18,12 @@ honeybee_radiance_postprocess/cli/leed.py,sha256=o10tYnp_eRLEX7QV6jHj6cVRQA_6zYg
|
|
18
18
|
honeybee_radiance_postprocess/cli/mtxop.py,sha256=UZJnjNpPjDmShy1-Mxos4H2vTUqk_yP3ZyaC1_LLFeI,5015
|
19
19
|
honeybee_radiance_postprocess/cli/postprocess.py,sha256=GUANSqugbvalcBcvNwsASS6yyVBPlxsDMnjwpVrXpSU,29042
|
20
20
|
honeybee_radiance_postprocess/cli/schedule.py,sha256=OokuuH9_pdgkt2zFgfjBvrV2Fj1Ow1WtiGRPvpyHfNk,3884
|
21
|
-
honeybee_radiance_postprocess/cli/translate.py,sha256=
|
21
|
+
honeybee_radiance_postprocess/cli/translate.py,sha256=18zkcGeRZALJ5Z82NEB3XZ-iEX2cHyneobGWV-IXWE0,6789
|
22
22
|
honeybee_radiance_postprocess/cli/two_phase.py,sha256=O0ugIQh0MOAEl3Q8IsZU4IQ8jNPPOOfeqs5ccwlix6Q,4559
|
23
23
|
honeybee_radiance_postprocess/cli/util.py,sha256=Be9cGmYhcV2W37ma6SgQPCWCpWLLLlroxRYN_l58kY0,4077
|
24
|
-
honeybee_radiance_postprocess-0.4.
|
25
|
-
honeybee_radiance_postprocess-0.4.
|
26
|
-
honeybee_radiance_postprocess-0.4.
|
27
|
-
honeybee_radiance_postprocess-0.4.
|
28
|
-
honeybee_radiance_postprocess-0.4.
|
29
|
-
honeybee_radiance_postprocess-0.4.
|
24
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
25
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/METADATA,sha256=xh7iMof6MgmWgHextLuhQKO4tD1Q5LnKydLwVAdVjrQ,2227
|
26
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/WHEEL,sha256=unfA4MOaH0icIyIA5oH6E2sn2Hq5zKtLlHsWapZGwes,110
|
27
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/entry_points.txt,sha256=gFtVPx6UItXt27GfEZZO00eOZChJJEL6JwGSAB_O3rs,96
|
28
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/top_level.txt,sha256=4-sFbzy7ewP2EDqJV3jeFlAFx7SuxtoBBELWaKAnLdA,30
|
29
|
+
honeybee_radiance_postprocess-0.4.228.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|