honeybee-radiance-postprocess 0.4.554__tar.gz → 0.4.591__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 (65) hide show
  1. honeybee_radiance_postprocess-0.4.591/CUPY.MD +88 -0
  2. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/PKG-INFO +20 -6
  3. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/dev-requirements.txt +5 -4
  4. honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess/__init__.py +36 -0
  5. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/annual.py +2 -8
  6. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/annualdaylight.py +2 -10
  7. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/annualirradiance.py +0 -1
  8. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/breeam/breeam.py +1 -6
  9. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/abnt.py +1 -6
  10. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/datacollection.py +3 -7
  11. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/grid.py +3 -7
  12. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/merge.py +3 -7
  13. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/mtxop.py +1 -6
  14. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/postprocess.py +86 -9
  15. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/translate.py +2 -7
  16. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/two_phase.py +1 -6
  17. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/util.py +2 -1
  18. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/viewfactor.py +3 -7
  19. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/well.py +1 -1
  20. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/data_type.py +2 -6
  21. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/electriclight.py +1 -6
  22. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/en17037.py +1 -6
  23. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/helper.py +41 -21
  24. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/ies/lm.py +1 -6
  25. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/ies/lm_schedule.py +1 -6
  26. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/leed/leed.py +1 -8
  27. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/leed/leed_schedule.py +1 -6
  28. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/metrics.py +80 -46
  29. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/reader.py +1 -7
  30. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/results/annual_daylight.py +2 -9
  31. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/results/annual_irradiance.py +1 -6
  32. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/results/results.py +240 -24
  33. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/type_hints.py +2 -6
  34. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/util.py +4 -14
  35. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/well/well.py +63 -10
  36. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess.egg-info/PKG-INFO +20 -6
  37. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess.egg-info/SOURCES.txt +1 -1
  38. honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess.egg-info/requires.txt +3 -0
  39. honeybee_radiance_postprocess-0.4.591/requirements.txt +3 -0
  40. honeybee_radiance_postprocess-0.4.591/setup.cfg +4 -0
  41. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/setup.py +6 -3
  42. honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess/well/__init__.py +0 -1
  43. honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess.egg-info/requires.txt +0 -2
  44. honeybee_radiance_postprocess-0.4.554/requirements.txt +0 -2
  45. honeybee_radiance_postprocess-0.4.554/setup.cfg +0 -10
  46. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/CODE_OF_CONDUCT.md +0 -0
  47. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/CONTRIBUTING.md +0 -0
  48. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/LICENSE +0 -0
  49. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/MANIFEST.in +0 -0
  50. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/README.md +0 -0
  51. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/__main__.py +0 -0
  52. {honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess → honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess/breeam}/__init__.py +0 -0
  53. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/__init__.py +0 -0
  54. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/breeam.py +0 -0
  55. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/leed.py +0 -0
  56. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/cli/schedule.py +0 -0
  57. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/dynamic.py +0 -0
  58. {honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess/breeam → honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess/ies}/__init__.py +0 -0
  59. {honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess/ies → honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess/leed}/__init__.py +0 -0
  60. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/results/__init__.py +0 -0
  61. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess/vis_metadata.py +0 -0
  62. {honeybee_radiance_postprocess-0.4.554/honeybee_radiance_postprocess/leed → honeybee_radiance_postprocess-0.4.591/honeybee_radiance_postprocess/well}/__init__.py +0 -0
  63. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess.egg-info/dependency_links.txt +0 -0
  64. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess.egg-info/entry_points.txt +0 -0
  65. {honeybee_radiance_postprocess-0.4.554 → honeybee_radiance_postprocess-0.4.591}/honeybee_radiance_postprocess.egg-info/top_level.txt +0 -0
@@ -0,0 +1,88 @@
1
+ # CuPy installation guide
2
+
3
+ ## :white_check_mark: CuPy requirements
4
+
5
+ * You have an NVIDIA GPU.
6
+ * Your GPU's compute capability is supported by CuPy.
7
+ * You have a suitable CUDA Toolkit installed (matching the CuPy package variant).
8
+ * Your GPU driver supports the CUDA version you intend to use.
9
+
10
+ ## :wrench: Compute Capability
11
+
12
+ ### What is Compute Capability
13
+ Compute capability is a number that describes the feature set and performance characteristics of your NVIDIA GPU architecture.
14
+
15
+ CuPy supports GPUs with compute capability ≥ 3.0.
16
+
17
+ Examples:
18
+ * NVIDIA GTX 1080 → Compute Capability **6.1**.
19
+ * NVIDIA GTX 2080 → Compute Capability **7.5**.
20
+ * NVIDIA RTX 3080 → Compute Capability **8.6**.
21
+ * NVIDIA RTX 4090 → Compute Capability **8.9**.
22
+ * NVIDIA RTX 5090 → Compute Capability **12.0**.
23
+
24
+ You can find the compute capability of your GPU [here](https://developer.nvidia.com/cuda-gpus). If you have an older GPU, such as the GTX 10 series or older, please check [this](https://developer.nvidia.com/cuda-legacy-gpus) list.
25
+
26
+ If you are still not sure about your compute capability, you can query it through CuPy once it is installed:
27
+
28
+ ```python
29
+ import cupy as cp
30
+
31
+ print(cp.cuda.Device().compute_capability)
32
+ ```
33
+
34
+ This prints the major index and minor index as a string, e.g., '75' for version 7.5.
35
+
36
+ ## :toolbox: CUDA Toolkit
37
+
38
+ ### What is CUDA Toolkit
39
+ The CUDA Toolkit provides the underlying CUDA libraries, runtime, and compiler that CuPy uses to run GPU code. CuPy depends on a matching CUDA Toolkit and GPU driver that supports your GPU.
40
+
41
+ ### Picking the correct CUDA version
42
+
43
+ You can find the CUDA version supported by your GPU driver by executing [nvidia-smi](https://docs.nvidia.com/deploy/nvidia-smi/index.html) in the command prompt.
44
+
45
+ ```
46
+ C:\Users\USERNAME>nvidia-smi
47
+ +-----------------------------------------------------------------------------------------+
48
+ | NVIDIA-SMI 581.80 Driver Version: 581.80 CUDA Version: 13.0 |
49
+ +-----------------------------------------+------------------------+----------------------+
50
+ ```
51
+
52
+ Please note that the CUDA version reported by nvidia-smi is not the installed version of the CUDA Toolkit; it is the latest API compatible version for your GPU driver. If your GPU driver is not up to date you might not see the latest CUDA version.
53
+
54
+ ### Installing CUDA Toolkit
55
+
56
+ You can download the latest version of CUDA Toolkit [here](https://developer.nvidia.com/cuda-downloads). If your GPU driver does not support the latest version, you can select a compatible version in the [archive](https://developer.nvidia.com/cuda-toolkit-archive).
57
+
58
+ ## :package: Installing CuPy
59
+
60
+ CuPy provides prebuilt binary wheels tied to CUDA versions. You should install the wheel matching your installed CUDA Toolkit.
61
+
62
+ | CUDA Toolkit | Command |
63
+ | ------------------- | ------------------------ |
64
+ | CUDA 13.x | pip install cupy-cuda13x |
65
+ | CUDA 12.x | pip install cupy-cuda12x |
66
+ | CUDA 11.x (>= 11.2) | pip install cupy-cuda11x |
67
+
68
+ ## :question: FAQ
69
+
70
+ ### Can I use CuPy with an AMD GPU?
71
+
72
+ If you have an AMD GPU please read [this](https://docs.cupy.dev/en/stable/install.html#using-cupy-on-amd-gpu-experimental).
73
+
74
+ ### How can I tell if honeybee-radiance-process is using CuPy and not NumPy?
75
+
76
+ honeybee-radiance-postprocess will print a line that tells you if CuPy is being used. You should see something like this:
77
+
78
+ `Using CuPy (13.6.0) for GPU (NVIDIA GeForce RTX 3080) acceleration in honeybee-radiance-postprocess.`
79
+
80
+ If CuPy *is* installed but fails during initialization honeybee-radiance-postprocess will fall back to NumPy. If this happens you should see a statement similar to this:
81
+
82
+ `Failed to load CuPy successfully. Falling back to NumPy (1.26.4) in honeybee-radiance-postprocess`
83
+
84
+ ## :warning: Common Errors
85
+
86
+ `FileNotFoundError: Could not find module 'nvrtc64_130_0.dll' (or one of its dependencies). Try using the full path with constructor syntax.`
87
+
88
+ This is possibly caused by a mismatch between the CUDA Toolkit version and the CuPy version, e.g., cupy-cuda13x and CUDA Toolkit 12.9.
@@ -1,20 +1,34 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.554
3
+ Version: 0.4.591
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
7
7
  Author-email: info@ladybug.tools
8
8
  License: GPLv3
9
- Classifier: Programming Language :: Python :: 2.7
10
- Classifier: Programming Language :: Python :: 3.6
9
+ Classifier: Programming Language :: Python :: 3.7
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
11
15
  Classifier: Programming Language :: Python :: Implementation :: CPython
12
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
16
  Classifier: Operating System :: OS Independent
14
17
  Description-Content-Type: text/markdown
15
18
  License-File: LICENSE
16
- Requires-Dist: honeybee-radiance==1.66.190
19
+ Requires-Dist: honeybee-radiance==1.66.221
17
20
  Requires-Dist: numpy<2.0.0
21
+ Requires-Dist: cupy-cuda12x==13.6.0
22
+ Dynamic: author
23
+ Dynamic: author-email
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: requires-dist
31
+ Dynamic: summary
18
32
 
19
33
  [![Build Status](https://github.com/ladybug-tools/honeybee-radiance-postprocess/actions/workflows/ci.yaml/badge.svg)](https://github.com/ladybug-tools/honeybee-radiance-postprocess/actions)
20
34
  [![Coverage Status](https://coveralls.io/repos/github/ladybug-tools/honeybee-radiance-postprocess/badge.svg?branch=master)](https://coveralls.io/github/ladybug-tools/honeybee-radiance-postprocess)
@@ -5,10 +5,10 @@ sphinx-bootstrap-theme==0.8.1
5
5
  sphinxcontrib-fulltoc==1.2.0
6
6
  sphinxcontrib-websupport==2.0.0;python_version>='3.6'
7
7
  sphinx-click==6.0.0;python_version>='3.6'
8
- twine==5.1.1;python_version>='3.6'
9
- wheel==0.44.0;python_version>='3.6'
10
- setuptools==75.1.0;python_version>='3.6'
11
- importlib-metadata==8.5.0;python_version>='3.6'
8
+ twine==6.1.0;python_version>='3.6'
9
+ wheel==0.45.1;python_version>='3.6'
10
+ setuptools==80.9.0;python_version>='3.6'
11
+ build==1.3.0;python_version>='3.6'
12
12
  pytest==4.6.9;python_version<'3.0'
13
13
  Sphinx==1.8.5;python_version<'3.0'
14
14
  sphinxcontrib-websupport==1.1.2;python_version<'3.0'
@@ -16,4 +16,5 @@ sphinx-click==4.4.0;python_version<'3.0'
16
16
  twine==1.13.0;python_version<'3.0'
17
17
  wheel==0.38.1;python_version<'3.0'
18
18
  setuptools==44.1.0;python_version<'3.0'
19
+ build==0.1.0;python_version<'3.0'
19
20
  importlib-metadata==2.0.0;python_version<'3.0'
@@ -0,0 +1,36 @@
1
+ """honeybee-radiance-postprocess library."""
2
+ import sys
3
+
4
+ IS_GPU = False
5
+
6
+ if sys.version_info >= (3, 0):
7
+ try:
8
+ import cupy as np
9
+ np.arange(1)
10
+ IS_GPU = True
11
+ try:
12
+ device_id = np.cuda.runtime.getDevice()
13
+ device_props = np.cuda.runtime.getDeviceProperties(device_id)
14
+ device_name = device_props['name'].decode()
15
+ except Exception:
16
+ device_name = 'Unknown GPU'
17
+
18
+ msg = (
19
+ 'Using CuPy ({}) for GPU ({}) acceleration in '
20
+ 'honeybee-radiance-postprocess.'
21
+ ).format(np.__version__, device_name)
22
+ sys.stderr.write(msg)
23
+
24
+ except ModuleNotFoundError:
25
+ import numpy as np
26
+
27
+ except Exception as e:
28
+ import numpy as np
29
+ msg = (
30
+ 'Failed to load CuPy successfully. '
31
+ 'Help: https://github.com/ladybug-tools/honeybee-radiance-postprocess/blob/master/CUPY.md. '
32
+ 'Falling back to NumPy ({}) in honeybee-radiance-postprocess: {}'
33
+ ).format(np.__version__, e)
34
+ sys.stderr.write(msg)
35
+
36
+ IS_CPU = not IS_GPU
@@ -1,16 +1,10 @@
1
1
  """Shared functions for post-processing annual results."""
2
2
  from typing import Union
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
9
3
 
10
4
  from ladybug.analysisperiod import AnalysisPeriod
11
- from .util import filter_array
12
5
 
13
- is_cpu = not is_gpu
6
+ from . import np
7
+ from .util import filter_array
14
8
 
15
9
 
16
10
  def occupancy_schedule_8_to_6(
@@ -1,15 +1,6 @@
1
- """Functions for post-processing annual daylight outputs.
2
-
3
- Note: These functions will most likely be moved to a separate package in the near future.
4
- """
1
+ """Functions for post-processing annual daylight outputs."""
5
2
  import json
6
3
  import os
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
4
 
14
5
  from ladybug.color import Colorset
15
6
  from ladybug.datatype.fraction import Fraction
@@ -17,6 +8,7 @@ from ladybug.legend import LegendParameters
17
8
  from honeybee_radiance.postprocess.annual import filter_schedule_by_hours, \
18
9
  _process_input_folder
19
10
 
11
+ from . import np
20
12
  from .metrics import da_array2d, cda_array2d, udi_array2d, \
21
13
  udi_lower_array2d, udi_upper_array2d
22
14
  from .util import filter_array
@@ -1,5 +1,4 @@
1
1
  """Functions for post-processing annual irradiance outputs."""
2
-
3
2
  from ladybug.datatype.energyflux import EnergyFlux
4
3
  from ladybug.datatype.energyintensity import EnergyIntensity
5
4
  from ladybug.legend import LegendParameters
@@ -2,16 +2,11 @@
2
2
  from typing import Union
3
3
  from pathlib import Path
4
4
  import json
5
- try:
6
- import cupy as np
7
- is_gpu = True
8
- except ImportError:
9
- is_gpu = False
10
- import numpy as np
11
5
 
12
6
  from honeybee.model import Model
13
7
  from honeybee_radiance.writer import _filter_by_pattern
14
8
 
9
+ from .. import np
15
10
  from ..results.annual_daylight import AnnualDaylight
16
11
 
17
12
 
@@ -4,18 +4,13 @@ import sys
4
4
  import logging
5
5
  from pathlib import Path
6
6
  import click
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from honeybee.model import Model
15
9
  from honeybee.room import Room
16
10
  from ladybug_geometry.geometry3d.face import Face3D
17
11
  from ladybug_geometry.geometry3d.pointvector import Vector3D
18
12
 
13
+ from .. import np
19
14
  from ..vis_metadata import _abnt_nbr_15575_daylight_levels_vis_metadata
20
15
 
21
16
 
@@ -1,21 +1,17 @@
1
1
  """Commands to work with data collections."""
2
2
  import sys
3
3
  import logging
4
+ import json
4
5
  from pathlib import Path
5
6
  import click
6
- import json
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
13
7
 
14
8
  from ladybug.datacollection import HourlyContinuousCollection, \
15
9
  HourlyDiscontinuousCollection
16
10
  from ladybug.header import Header
17
11
  from ladybug.datautil import collections_to_csv
18
12
 
13
+ from .. import np
14
+
19
15
 
20
16
  _logger = logging.getLogger(__name__)
21
17
 
@@ -1,17 +1,13 @@
1
1
  """honeybee radiance postprocess grid commands."""
2
- import click
3
2
  import sys
4
3
  import logging
5
4
  import json
6
5
  from pathlib import Path
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance_postprocess.reader import binary_to_array
9
+
10
+ from .. import np
15
11
  from ..annualdaylight import _annual_daylight_vis_metadata
16
12
 
17
13
  _logger = logging.getLogger(__name__)
@@ -1,18 +1,14 @@
1
1
  """honeybee radiance postprocess merge commands."""
2
- import click
3
2
  import sys
4
3
  import logging
5
4
  import json
6
5
  from pathlib import Path
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance_postprocess.reader import binary_to_array
15
9
 
10
+ from .. import np
11
+
16
12
  _logger = logging.getLogger(__name__)
17
13
 
18
14
 
@@ -3,13 +3,8 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import click
6
- try:
7
- import cupy as np
8
- is_gpu = True
9
- except ImportError:
10
- is_gpu = False
11
- import numpy as np
12
6
 
7
+ from .. import np
13
8
  from ..reader import binary_to_array, ascii_to_array
14
9
 
15
10
  _logger = logging.getLogger(__name__)
@@ -5,21 +5,15 @@ import os
5
5
  import logging
6
6
  import json
7
7
  import click
8
- try:
9
- import cupy as np
10
- is_gpu = True
11
- except ImportError:
12
- is_gpu = False
13
- import numpy as np
14
8
 
15
9
  from ladybug.location import Location
16
10
  from ladybug.wea import Wea
17
- from honeybee_radiance_postprocess.results.annual_daylight import AnnualDaylight
18
- from honeybee_radiance_postprocess.results.annual_irradiance import AnnualIrradiance
11
+ from honeybee_radiance_postprocess.results import AnnualDaylight, AnnualIrradiance
19
12
  from honeybee_radiance_postprocess.metrics import da_array2d, cda_array2d, \
20
13
  udi_array2d, udi_lower_array2d, udi_upper_array2d
21
14
  from honeybee_radiance_postprocess.reader import binary_to_array
22
15
 
16
+ from .. import np
23
17
  from ..annual import occupancy_schedule_8_to_6
24
18
  from ..dynamic import DynamicSchedule
25
19
  from ..en17037 import en17037_to_folder
@@ -505,6 +499,89 @@ def annual_to_data(
505
499
  sys.exit(0)
506
500
 
507
501
 
502
+ @post_process.command('annual-statistics')
503
+ @click.argument(
504
+ 'folder',
505
+ type=click.Path(exists=True, file_okay=False, dir_okay=True, resolve_path=True)
506
+ )
507
+ @click.option(
508
+ '--hoys-file', '-h', help='Path to an HOYs file. Values must be separated by '
509
+ 'new line. If not provided the data will not be filtered by HOYs.',
510
+ type=click.Path(exists=False, file_okay=True, dir_okay=False, resolve_path=True)
511
+ )
512
+ @click.option(
513
+ '--states', '-st', help='A JSON file with a dictionary of states. If states '
514
+ 'are not provided the default states will be used for any aperture groups.',
515
+ default=None, show_default=True,
516
+ type=click.Path(exists=False, file_okay=True, dir_okay=False, resolve_path=True)
517
+ )
518
+ @click.option(
519
+ '--grids-filter', '-gf', help='A pattern to filter the grids.', default='*',
520
+ show_default=True
521
+ )
522
+ @click.option(
523
+ '--total/--direct', is_flag=True, default=True, help='Switch between total '
524
+ 'and direct results. Default is total.'
525
+ )
526
+ @click.option(
527
+ '--sensor/--timestep', is_flag=True, default=True, help='Switch between results '
528
+ 'for each sensor or timestep. Default is sensor.'
529
+ )
530
+
531
+ @click.option(
532
+ '--sub-folder', '-sf', help='Optional relative path for subfolder to write output '
533
+ 'statistics files.', default='statistics'
534
+ )
535
+ def annual_statistics(
536
+ folder, hoys_file, states, grids_filter, total, sensor, sub_folder
537
+ ):
538
+ """Get annual statistics (average, median, minimum, maximum, cumulative).
539
+
540
+ \b
541
+ Args:
542
+ folder: Results folder. This folder is an output folder of annual daylight
543
+ recipe. Folder should include grids_info.json and sun-up-hours.txt. The
544
+ command uses the list in grids_info.json to find the result files for each
545
+ sensor grid.
546
+ """
547
+ try:
548
+ if hoys_file:
549
+ with open(hoys_file) as hoys:
550
+ hoys = [float(h) for h in hoys.readlines()]
551
+ else:
552
+ hoys = []
553
+
554
+ if states:
555
+ states = DynamicSchedule.from_json(states)
556
+
557
+ res_type = 'total' if total is True else 'direct'
558
+
559
+ axis = 1 if sensor is True else 0
560
+
561
+ study_info_file = Path(folder).joinpath('study_info.json')
562
+ if study_info_file.exists():
563
+ with open(study_info_file) as file:
564
+ study_info = json.load(file)
565
+ study_type = study_info.get('study_type', 'annual-daylight')
566
+ else:
567
+ study_type = 'annual-daylight'
568
+
569
+ if study_type == 'annual-daylight':
570
+ results = AnnualDaylight(folder)
571
+ elif study_type == 'annual-irradiance':
572
+ results = AnnualIrradiance(folder)
573
+ else:
574
+ raise ValueError(f'Unknown study type: {study_type}.')
575
+ results.annual_statistics_to_folder(
576
+ sub_folder, hoys=hoys, states=states, grids_filter=grids_filter,
577
+ res_type=res_type, axis=axis)
578
+ except Exception:
579
+ _logger.exception('Failed to calculate annual statistics.')
580
+ sys.exit(1)
581
+ else:
582
+ sys.exit(0)
583
+
584
+
508
585
  @post_process.command('point-in-time')
509
586
  @click.argument(
510
587
  'folder',
@@ -1030,7 +1107,7 @@ def convert_matrix_to_binary(
1030
1107
  if not comply:
1031
1108
  # this will invert the boolean array
1032
1109
  boolean_array = ~boolean_array
1033
-
1110
+
1034
1111
  binary_array = boolean_array.astype(int)
1035
1112
  output_file = Path(output_folder, name)
1036
1113
  output_file.parent.mkdir(parents=True, exist_ok=True)
@@ -3,15 +3,10 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import shutil
6
- import click
7
6
  import json
8
- try:
9
- import cupy as np
10
- is_gpu = True
11
- except ImportError:
12
- is_gpu = False
13
- import numpy as np
7
+ import click
14
8
 
9
+ from .. import np
15
10
  from ..reader import binary_to_array
16
11
  from ..util import get_delimiter
17
12
 
@@ -3,13 +3,8 @@ import sys
3
3
  import logging
4
4
  from pathlib import Path
5
5
  import click
6
- try:
7
- import cupy as np
8
- is_gpu = True
9
- except ImportError:
10
- is_gpu = False
11
- import numpy as np
12
6
 
7
+ from .. import np
13
8
  from ..reader import binary_to_array, ascii_to_array
14
9
 
15
10
  _logger = logging.getLogger(__name__)
@@ -1,7 +1,8 @@
1
- from ladybug.analysisperiod import AnalysisPeriod
2
1
  from datetime import datetime
3
2
  import copy
4
3
 
4
+ from ladybug.analysisperiod import AnalysisPeriod
5
+
5
6
 
6
7
  def get_hoys(start_date, start_time, end_date, end_time, timestep, leap_year):
7
8
  """Return list of hours from start date, star hour, end date and end hour.
@@ -1,15 +1,9 @@
1
1
  """Commands to compute view factors to geometry."""
2
- import click
3
2
  import os
4
3
  import sys
5
4
  import logging
6
5
  import math
7
- try:
8
- import cupy as np
9
- is_gpu = True
10
- except ImportError:
11
- is_gpu = False
12
- import numpy as np
6
+ import click
13
7
 
14
8
  from honeybee_radiance.config import folders
15
9
 
@@ -20,6 +14,8 @@ from ladybug.futil import preparedir
20
14
 
21
15
  from honeybee_radiance_postprocess.reader import binary_to_array
22
16
 
17
+ from .. import np
18
+
23
19
  _logger = logging.getLogger(__name__)
24
20
 
25
21
 
@@ -83,7 +83,7 @@ def well_daylight_vis(output_folder):
83
83
  metric_info_dict = {
84
84
  'L01': {
85
85
  'type': 'VisualizationMetaData',
86
- 'data_type': GenericType('sDA200,40%', '').to_dict(),
86
+ 'data_type': GenericType('sDA150,50%', '').to_dict(),
87
87
  'unit': '',
88
88
  'legend_parameters': pass_fail_lpar.to_dict()
89
89
  },
@@ -1,11 +1,7 @@
1
1
  """Functions for NumPy data type (dtype)."""
2
2
  from typing import Tuple
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
3
+
4
+ from . import np
9
5
 
10
6
 
11
7
  def smallest_integer_dtype(array: np.ndarray) -> np.signedinteger:
@@ -1,11 +1,6 @@
1
1
  """Functions for post-processing daylight outputs into electric lighting schedules."""
2
2
  from typing import List
3
- try:
4
- import cupy as np
5
- is_gpu = True
6
- except ImportError:
7
- is_gpu = False
8
- import numpy as np
3
+ from . import np
9
4
 
10
5
 
11
6
  def array_to_dimming_fraction(
@@ -2,17 +2,12 @@
2
2
  from typing import Union
3
3
  from pathlib import Path
4
4
  import json
5
- try:
6
- import cupy as np
7
- is_gpu = True
8
- except ImportError:
9
- is_gpu = False
10
- import numpy as np
11
5
 
12
6
  from ladybug.color import Colorset
13
7
  from ladybug.datatype.fraction import Fraction
14
8
  from ladybug.legend import LegendParameters
15
9
 
10
+ from . import np
16
11
  from .results.annual_daylight import AnnualDaylight
17
12
  from .dynamic import DynamicSchedule
18
13
  from .metrics import da_array2d