honeybee-radiance-postprocess 0.4.335__tar.gz → 0.4.337__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.
Files changed (45) hide show
  1. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/PKG-INFO +1 -1
  2. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/postprocess.py +124 -0
  3. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess.egg-info/PKG-INFO +1 -1
  4. honeybee-radiance-postprocess-0.4.337/honeybee_radiance_postprocess.egg-info/requires.txt +2 -0
  5. honeybee-radiance-postprocess-0.4.337/requirements.txt +2 -0
  6. honeybee-radiance-postprocess-0.4.335/honeybee_radiance_postprocess.egg-info/requires.txt +0 -2
  7. honeybee-radiance-postprocess-0.4.335/requirements.txt +0 -2
  8. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/CODE_OF_CONDUCT.md +0 -0
  9. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/CONTRIBUTING.md +0 -0
  10. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/LICENSE +0 -0
  11. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/MANIFEST.in +0 -0
  12. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/README.md +0 -0
  13. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/dev-requirements.txt +0 -0
  14. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/__init__.py +0 -0
  15. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/__main__.py +0 -0
  16. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/annual.py +0 -0
  17. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/annualdaylight.py +0 -0
  18. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/annualirradiance.py +0 -0
  19. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/__init__.py +0 -0
  20. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/grid.py +0 -0
  21. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/leed.py +0 -0
  22. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/mtxop.py +0 -0
  23. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/schedule.py +0 -0
  24. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/translate.py +0 -0
  25. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/two_phase.py +0 -0
  26. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/cli/util.py +0 -0
  27. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/dynamic.py +0 -0
  28. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/electriclight.py +0 -0
  29. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/en17037.py +0 -0
  30. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/helper.py +0 -0
  31. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/leed.py +0 -0
  32. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/metrics.py +0 -0
  33. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/reader.py +0 -0
  34. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/results/__init__.py +0 -0
  35. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/results/annual_daylight.py +0 -0
  36. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/results/annual_irradiance.py +0 -0
  37. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/results/results.py +0 -0
  38. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/type_hints.py +0 -0
  39. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess/util.py +0 -0
  40. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess.egg-info/SOURCES.txt +0 -0
  41. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess.egg-info/dependency_links.txt +0 -0
  42. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess.egg-info/entry_points.txt +0 -0
  43. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/honeybee_radiance_postprocess.egg-info/top_level.txt +0 -0
  44. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/setup.cfg +0 -0
  45. {honeybee-radiance-postprocess-0.4.335 → honeybee-radiance-postprocess-0.4.337}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.335
3
+ Version: 0.4.337
4
4
  Summary: Postprocessing of Radiance results and matrices
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-radiance-postprocess
6
6
  Author: Ladybug Tools
@@ -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')
1069
+ cumulative_file.parent.mkdir(parents=True, exist_ok=True)
1070
+ np.save(cumulative_file, cumulative_array)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.335
3
+ Version: 0.4.337
4
4
  Summary: Postprocessing of Radiance results and matrices
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-radiance-postprocess
6
6
  Author: Ladybug Tools
@@ -0,0 +1,2 @@
1
+ honeybee-radiance==1.66.28
2
+ numpy>=1.21.6
@@ -0,0 +1,2 @@
1
+ honeybee-radiance==1.66.28
2
+ numpy>=1.21.6
@@ -1,2 +0,0 @@
1
- honeybee-radiance==1.66.27
2
- numpy>=1.21.6
@@ -1,2 +0,0 @@
1
- honeybee-radiance==1.66.27
2
- numpy>=1.21.6