honeybee-radiance-postprocess 0.4.336__tar.gz → 0.4.338__tar.gz
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-0.4.336 → honeybee-radiance-postprocess-0.4.338}/PKG-INFO +1 -1
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/grid.py +44 -4
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/postprocess.py +124 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/PKG-INFO +1 -1
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/CODE_OF_CONDUCT.md +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/CONTRIBUTING.md +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/LICENSE +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/MANIFEST.in +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/README.md +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/dev-requirements.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/__init__.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/__main__.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/annual.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/annualdaylight.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/annualirradiance.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/__init__.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/leed.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/mtxop.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/schedule.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/translate.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/two_phase.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/cli/util.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/dynamic.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/electriclight.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/en17037.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/helper.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/leed.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/metrics.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/reader.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/results/__init__.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/results/annual_daylight.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/results/annual_irradiance.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/results/results.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/type_hints.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess/util.py +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/SOURCES.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/dependency_links.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/entry_points.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/requires.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/honeybee_radiance_postprocess.egg-info/top_level.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/requirements.txt +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/setup.cfg +0 -0
- {honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/setup.py +0 -0
@@ -31,7 +31,28 @@ def grid():
|
|
31
31
|
'. Alternatively, the command will look for a _redist_info.json file inside the '
|
32
32
|
'folder.', type=click.Path(file_okay=True, dir_okay=False, resolve_path=True)
|
33
33
|
)
|
34
|
-
|
34
|
+
@click.option(
|
35
|
+
'--output-extension', '-oe',
|
36
|
+
help='Output file extension. This is only used if as_text is set to True. '
|
37
|
+
'Otherwise the output extension will be npy.', default='ill', type=click.STRING
|
38
|
+
)
|
39
|
+
@click.option(
|
40
|
+
'--as-text', '-at',
|
41
|
+
help='Set to True if the output files should be saved as text instead of '
|
42
|
+
'NumPy files.', default=False, type=click.BOOL
|
43
|
+
)
|
44
|
+
@click.option(
|
45
|
+
'--fmt',
|
46
|
+
help='Format for the output files when saved as text.', default='%.2f',
|
47
|
+
type=click.STRING
|
48
|
+
)
|
49
|
+
@click.option(
|
50
|
+
'--delimiter',
|
51
|
+
help='Delimiter for the output files when saved as text.',
|
52
|
+
type=click.Choice(['space', 'tab']), default='tab'
|
53
|
+
)
|
54
|
+
def merge_grid_folder(input_folder, output_folder, extension, dist_info,
|
55
|
+
output_extension, as_text, fmt, delimiter):
|
35
56
|
"""Restructure files in a distributed folder.
|
36
57
|
|
37
58
|
\b
|
@@ -46,7 +67,9 @@ def merge_grid_folder(input_folder, output_folder, extension, dist_info):
|
|
46
67
|
# handle optional case for Functions input
|
47
68
|
if dist_info and not Path(dist_info).is_file():
|
48
69
|
dist_info = None
|
49
|
-
restore_original_distribution(
|
70
|
+
restore_original_distribution(
|
71
|
+
input_folder, output_folder, extension, dist_info, output_extension,
|
72
|
+
as_text, fmt, delimiter)
|
50
73
|
except Exception:
|
51
74
|
_logger.exception('Failed to restructure data from folder.')
|
52
75
|
sys.exit(1)
|
@@ -122,7 +145,8 @@ def merge_metrics_folder(input_folder, output_folder, dist_info, grids_info):
|
|
122
145
|
|
123
146
|
|
124
147
|
def restore_original_distribution(
|
125
|
-
input_folder, output_folder, extension='npy', dist_info=None
|
148
|
+
input_folder, output_folder, extension='npy', dist_info=None,
|
149
|
+
output_extension='ill', as_text=False, fmt='%.2f', delimiter='tab'):
|
126
150
|
"""Restructure files to the original distribution based on the distribution info.
|
127
151
|
|
128
152
|
It will assume that the files in the input folder are NumPy files. However,
|
@@ -137,6 +161,12 @@ def restore_original_distribution(
|
|
137
161
|
studies.
|
138
162
|
dist_info: Path to dist_info.json file. If None, the function will try to load
|
139
163
|
``_redist_info.json`` file from inside the input_folder. (Default: None).
|
164
|
+
output_extension: Output file extension. This is only used if as_text
|
165
|
+
is set to True. Otherwise the output extension will be ```npy``.
|
166
|
+
as_text: Set to True if the output files should be saved as text instead
|
167
|
+
of NumPy files.
|
168
|
+
fmt: Format for the output files when saved as text.
|
169
|
+
delimiter: Delimiter for the output files when saved as text.
|
140
170
|
"""
|
141
171
|
if not dist_info:
|
142
172
|
_redist_info_file = Path(input_folder, '_redist_info.json')
|
@@ -178,7 +208,17 @@ def restore_original_distribution(
|
|
178
208
|
|
179
209
|
out_array = np.concatenate(out_arrays)
|
180
210
|
# save numpy array, .npy extension is added automatically
|
181
|
-
|
211
|
+
if not as_text:
|
212
|
+
np.save(output_file, out_array)
|
213
|
+
else:
|
214
|
+
if output_extension.startswith('.'):
|
215
|
+
output_extension = output_extension[1:]
|
216
|
+
if delimiter == 'tab':
|
217
|
+
delimiter = '\t'
|
218
|
+
elif delimiter == 'space':
|
219
|
+
delimiter = ' '
|
220
|
+
np.savetxt(output_file.with_suffix(f'.{output_extension}'),
|
221
|
+
out_array, fmt=fmt, delimiter=delimiter)
|
182
222
|
|
183
223
|
|
184
224
|
def restore_original_distribution_metrics(
|
@@ -949,3 +949,127 @@ def annual_irradiance_metrics(
|
|
949
949
|
sys.exit(1)
|
950
950
|
else:
|
951
951
|
sys.exit(0)
|
952
|
+
|
953
|
+
|
954
|
+
@post_process.command('convert-to-binary')
|
955
|
+
@click.argument(
|
956
|
+
'input-matrix', type=click.Path(exists=True, file_okay=True, resolve_path=True)
|
957
|
+
)
|
958
|
+
@click.option(
|
959
|
+
'--minimum', type=float, default='-inf', help='Minimum range for values to be '
|
960
|
+
'converted to 1.'
|
961
|
+
)
|
962
|
+
@click.option(
|
963
|
+
'--maximum', type=float, default='+inf', help='Maximum range for values to be '
|
964
|
+
'converted to 1.'
|
965
|
+
)
|
966
|
+
@click.option(
|
967
|
+
'--include-max/--exclude-max', is_flag=True, help='A flag to include the maximum '
|
968
|
+
'threshold itself. By default the threshold value will be included.', default=True
|
969
|
+
)
|
970
|
+
@click.option(
|
971
|
+
'--include-min/--exclude-min', is_flag=True, help='A flag to include the minimum '
|
972
|
+
'threshold itself. By default the threshold value will be included.', default=True
|
973
|
+
)
|
974
|
+
@click.option(
|
975
|
+
'--comply/--reverse', is_flag=True, help='A flag to reverse the selection logic. '
|
976
|
+
'This is useful for cases that you want to all the values outside a certain range '
|
977
|
+
'to be converted to 1. By default the input logic will be used as is.', default=True
|
978
|
+
)
|
979
|
+
@click.option(
|
980
|
+
'--name', '-n', help='Name of output file.', default='binary',
|
981
|
+
show_default=True
|
982
|
+
)
|
983
|
+
@click.option(
|
984
|
+
'--output-folder', '-of', help='Output folder.', default='.',
|
985
|
+
type=click.Path(exists=False, file_okay=False, dir_okay=True, resolve_path=True)
|
986
|
+
)
|
987
|
+
def convert_matrix_to_binary(
|
988
|
+
input_matrix, minimum, maximum, include_max, include_min, comply, name, output_folder
|
989
|
+
):
|
990
|
+
"""Postprocess a Radiance matrix and convert it to 0-1 values.
|
991
|
+
|
992
|
+
\b
|
993
|
+
This command is useful for translating Radiance results to outputs like
|
994
|
+
sunlight hours. Input matrix must be in ASCII or binary format. The input
|
995
|
+
Radiance file must have a header.
|
996
|
+
|
997
|
+
Args:
|
998
|
+
input-matrix: A Radiance matrix file.
|
999
|
+
"""
|
1000
|
+
array = binary_to_array(input_matrix)
|
1001
|
+
minimum = float(minimum)
|
1002
|
+
maximum = float(maximum)
|
1003
|
+
try:
|
1004
|
+
if include_max and include_min:
|
1005
|
+
boolean_array = (array >= minimum) & (array <= maximum)
|
1006
|
+
elif not include_max and not include_min:
|
1007
|
+
boolean_array = (array > minimum) & (array < maximum)
|
1008
|
+
elif include_max and not include_min:
|
1009
|
+
boolean_array = (array > minimum) & (array <= maximum)
|
1010
|
+
elif not include_max and include_min:
|
1011
|
+
boolean_array = (array >= minimum) & (array < maximum)
|
1012
|
+
|
1013
|
+
if not comply:
|
1014
|
+
# this will invert the boolean array
|
1015
|
+
boolean_array = ~boolean_array
|
1016
|
+
|
1017
|
+
binary_array = boolean_array.astype(int)
|
1018
|
+
output_file = Path(output_folder, name)
|
1019
|
+
output_file.parent.mkdir(parents=True, exist_ok=True)
|
1020
|
+
np.save(output_file, binary_array)
|
1021
|
+
except Exception:
|
1022
|
+
_logger.exception('Failed to convert the input file to binary format.')
|
1023
|
+
sys.exit(1)
|
1024
|
+
else:
|
1025
|
+
sys.exit(0)
|
1026
|
+
|
1027
|
+
|
1028
|
+
@post_process.command('direct-sun-hours')
|
1029
|
+
@click.argument(
|
1030
|
+
'input-matrix', type=click.Path(exists=True, file_okay=True, resolve_path=True)
|
1031
|
+
)
|
1032
|
+
@click.option(
|
1033
|
+
'--divisor', type=float, default=1, help='An optional number, that the summed '
|
1034
|
+
'row will be divided by. For example, this can be a timestep, which can be used '
|
1035
|
+
'to ensure that a summed row of irradiance yields cumulative radiation over '
|
1036
|
+
'the entire time period of the matrix.'
|
1037
|
+
)
|
1038
|
+
@click.option(
|
1039
|
+
'--output-folder', '-of', help='Output folder.', default='.',
|
1040
|
+
type=click.Path(exists=False, file_okay=False, dir_okay=True, resolve_path=True)
|
1041
|
+
)
|
1042
|
+
def direct_sun_hours(
|
1043
|
+
input_matrix, divisor, output_folder
|
1044
|
+
):
|
1045
|
+
"""Postprocess a Radiance matrix to direct sun hours and cumulative direct
|
1046
|
+
sun hours.
|
1047
|
+
|
1048
|
+
\b
|
1049
|
+
This command will convert values in the Radiance matrix file to 0-1 values.
|
1050
|
+
The output will be a direct sun hours file, and a cumulative direct sun hours
|
1051
|
+
file where the values are the summed values for each row.
|
1052
|
+
|
1053
|
+
Args:
|
1054
|
+
input-matrix: A Radiance matrix file.
|
1055
|
+
"""
|
1056
|
+
array = binary_to_array(input_matrix)
|
1057
|
+
|
1058
|
+
try:
|
1059
|
+
boolean_array = (array > 0) & (array <= np.inf)
|
1060
|
+
|
1061
|
+
direct_sun_hours_array = boolean_array.astype(int)
|
1062
|
+
cumulative_array = direct_sun_hours_array.sum(axis=1) / divisor
|
1063
|
+
|
1064
|
+
direct_sun_hours_file = Path(output_folder, 'direct_sun_hours')
|
1065
|
+
direct_sun_hours_file.parent.mkdir(parents=True, exist_ok=True)
|
1066
|
+
np.save(direct_sun_hours_file, direct_sun_hours_array)
|
1067
|
+
|
1068
|
+
cumulative_file = Path(output_folder, 'cumulative.res')
|
1069
|
+
cumulative_file.parent.mkdir(parents=True, exist_ok=True)
|
1070
|
+
np.savetxt(cumulative_file, cumulative_array, fmt='%.2f')
|
1071
|
+
except Exception:
|
1072
|
+
_logger.exception('Failed to convert the input file to direct sun hours.')
|
1073
|
+
sys.exit(1)
|
1074
|
+
else:
|
1075
|
+
sys.exit(0)
|
{honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/CODE_OF_CONDUCT.md
RENAMED
File without changes
|
{honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/CONTRIBUTING.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/dev-requirements.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{honeybee-radiance-postprocess-0.4.336 → honeybee-radiance-postprocess-0.4.338}/requirements.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|