voxcity.simulator_gpu.domain.Domain =================================== .. py:class:: voxcity.simulator_gpu.domain.Domain(nx: int, ny: int, nz: int, dx: float = 1.0, dy: float = 1.0, dz: float = 1.0, origin: Tuple[float, float, float] = (0.0, 0.0, 0.0), origin_lat: Optional[float] = None, origin_lon: Optional[float] = None, rotation_angle: float = 0) 3D computational domain for solar radiation simulation. The domain uses a regular grid aligned with VoxCity indices: - x (first index i/u): Row direction, increases toward North - y (second index j/v): Column direction, increases toward East - z (third index k): Vertical, increases Ground to Sky .. attribute:: nx, ny, nz Number of grid cells in each direction .. attribute:: dx, dy, dz Grid spacing in meters .. attribute:: origin (x, y, z) coordinates of domain origin .. py:attribute:: nx .. py:attribute:: ny .. py:attribute:: nz .. py:attribute:: dx :value: 1.0 .. py:attribute:: dy :value: 1.0 .. py:attribute:: dz :value: 1.0 .. py:attribute:: origin :value: (0.0, 0.0, 0.0) .. py:attribute:: origin_lat .. py:attribute:: origin_lon .. py:attribute:: rotation_angle :value: 0 .. py:attribute:: x_min :value: 0.0 .. py:attribute:: x_max .. py:attribute:: y_min :value: 0.0 .. py:attribute:: y_max .. py:attribute:: z_min :value: 0.0 .. py:attribute:: z_max .. py:attribute:: cell_volume :value: 1.0 .. py:attribute:: topo_top .. py:attribute:: is_solid .. py:attribute:: is_tree .. py:attribute:: lad .. py:attribute:: plant_top .. py:attribute:: n_surfaces .. py:method:: set_flat_terrain(height: float = 0.0) Set flat terrain at given height. .. py:method:: initialize_terrain(height: float = 0.0) Alias for set_flat_terrain. .. py:method:: set_terrain_from_array(terrain_height: numpy.ndarray) Set terrain from 2D numpy array of heights. :param terrain_height: 2D array (nx, ny) of terrain heights in meters .. py:method:: add_building(x_range: Optional[Tuple[int, int]] = None, y_range: Optional[Tuple[int, int]] = None, z_range: Optional[Tuple[int, int]] = None, *, x_start: Optional[int] = None, x_end: Optional[int] = None, y_start: Optional[int] = None, y_end: Optional[int] = None, height: Optional[float] = None) Add a rectangular building to the domain. Can be called with either range tuples or individual parameters: :param x_range: (i_start, i_end) grid indices :param y_range: (j_start, j_end) grid indices :param z_range: (k_start, k_end) grid indices Or with keyword arguments: x_start, x_end: X grid indices y_start, y_end: Y grid indices height: Building height in meters (z_range computed from this) .. py:method:: set_lad_from_array(lad_array: numpy.ndarray) Set Leaf Area Density from 3D numpy array. :param lad_array: 3D array (nx, ny, nz) of LAD values (m^2/m^3) .. py:method:: set_from_voxel_data(voxel_data: numpy.ndarray, tree_code: int = -2, solid_codes: Optional[list] = None) Set domain from a 3D voxel data array. :param voxel_data: 3D numpy array with voxel class codes :param tree_code: Class code for trees (default -2) :param solid_codes: List of codes that are solid (default: all non-zero except tree_code) .. py:method:: add_tree_box(x_range: Tuple[int, int], y_range: Tuple[int, int], z_range: Tuple[int, int], lad_value: float = 1.0) Add a box-shaped tree canopy region to the domain. This is a simpler alternative to add_tree() for rectangular tree regions. :param x_range: Grid index ranges (start, end) :param y_range: Grid index ranges (start, end) :param z_range: Grid index ranges (start, end) :param lad_value: Leaf Area Density value (m^2/m^3) .. py:method:: add_tree(center: Optional[Tuple[float, float]] = None, height: Optional[float] = None, crown_radius: Optional[float] = None, crown_height: Optional[float] = None, trunk_height: Optional[float] = None, max_lad: float = 1.0, *, center_x: Optional[float] = None, center_y: Optional[float] = None, lad: Optional[float] = None) Add a simple tree with cylindrical trunk and spherical crown. :param center: (x, y) position in meters :param height: Total tree height in meters (optional, computed from crown+trunk) :param crown_radius: Radius of crown in meters :param crown_height: Height of crown sphere in meters :param trunk_height: Height of trunk (no leaves) in meters :param max_lad: Maximum LAD at crown center Or with keyword arguments: center_x, center_y: Position in meters lad: Alias for max_lad .. py:method:: get_cell_indices(point: voxcity.simulator_gpu.solar.core.Point3) -> taichi.math.ivec3 Get grid cell indices for a point. .. py:method:: get_cell_center(i: taichi.i32, j: taichi.i32, k: taichi.i32) -> voxcity.simulator_gpu.solar.core.Point3 Get center coordinates of grid cell. .. py:method:: is_inside(point: voxcity.simulator_gpu.solar.core.Point3) -> taichi.i32 Check if point is inside domain. .. py:method:: is_cell_solid(i: taichi.i32, j: taichi.i32, k: taichi.i32) -> taichi.i32 Check if cell is solid (building or terrain). .. py:method:: get_max_dist() -> float Get maximum ray distance (domain diagonal). .. py:method:: get_lad(i: taichi.i32, j: taichi.i32, k: taichi.i32) -> taichi.f32 Get LAD value at cell.