honeybee_radiance_folder.gridutil module¶
Utility functions for sensor grids folder.
- honeybee_radiance_folder.gridutil.parse_grid_info(info_file)[source]¶
Parse sensor grid information from a info json file. This information typically contains full_id, name, identifier, group and count. In the case of _model_grids_info json, it will also contain the starting line (start_ln)
- Parameters:
info_file – Path to the grid info file.
- Returns:
A list containing the information about sensor grids.
- honeybee_radiance_folder.gridutil.parse_grid_json(grid_json_file)[source]¶
Parse a grid json file and return the corresponding dictionary :param grid_json_file: Input path of the grid json file.
- Returns:
If path exists, return the grid info dictionary. Else return None.
- honeybee_radiance_folder.gridutil.redistribute_sensors(input_folder, output_folder, grid_count, min_sensor_count=2000, extension='pts', grid_info=None, verbose=False)[source]¶
Create new sensor grids folder with evenly distributed sensors.
This function creates a new folder with evenly distributed sensor grids. The folder will include a
_redist_info.json
file which has the information to recreate the original input files from this folder and the results generated based on the grids in this folder._redist_info.json
file includes an array of JSON objects. Each object has theid
or the original file and the distribution information. The distribution information includes the id of the new files that the sensors has been distributed to and the start and end line in the target file.This file is being used to restructure the data that is generated based on the newly created sensor grids.
[ { "id": "room_1", "dist_info": [ {"id": 0, "st_ln": 0, "end_ln": 175}, {"id": 1, "st_ln": 0, "end_ln": 21} ] }, { "id": "room_2", "dist_info": [ {"id": 1, "st_ln": 22, "end_ln": 135} ] } ]
- Parameters:
input_folder – Input sensor grids folder.
output_folder – A new folder to write the newly created files.
grid_count – Number of output sensor grids to be created. This number is usually equivalent to the number of processes that will be used to run the simulations in parallel.
min_sensor_count – Minimum number of sensors in each output grid. Use this number to ensure the number of sensors in output grids never gets very small. To ignore this limitation set the value to 1. This value always takes precedence over grid_count. Default: 2000.
extension – Extension of the files to collect data from. Default is
pts
for sensor files. Another common extension iscsv
for generic data sets.grid_info – Optional list of dictionaries with grid information. Use this instead of the expected _info.json file in the input_folder.
verbose – Set to True to get verbose reporting. Default: False.
- Returns:
A tuple with three elements
grid_count: Number of output sensor grids. Keep in mind that this number can be adjusted based on the min_sensor_count.
sensor_per_grid: Number of sensors in each newly created sensor grid.
out_grid_info: Grid information as written to _info.json.
- honeybee_radiance_folder.gridutil.restore_original_distribution(input_folder, output_folder, extension='pts', dist_info=None)[source]¶
Restructure files to the original distribution based on the distribution info.
- Parameters:
input_folder – Path to input folder.
output_folder – Path to the new restructured folder
extension – Extension of the files to collect data from. Default is
pts
for sensor files. Another common extension isill
for the results of daylight studies.dist_info – Path to dist_info.json file. If None, the function will try to load
_redist_info.json
file from inside the input_folder. (Default: None).