def _get_ids_from_cutout(
self, cutout_fcn, resource, resolution, corner, extent,
t_range=[0, 1], version=0):
"""
Do a cutout and return the unique ids within the specified region.
0 is never returned as an id.
Args:
cutout_fcn (function): SpatialDB's cutout method. Provided for naive search of ids in sub-regions
resource (project.BossResource): Data model info based on the request or target resource
resolution (int): the resolution level
corner ((int, int, int)): xyz location of the corner of the region
extent ((int, int, int)): xyz extents of the region
t_range (optional[list[int]]): time range, defaults to [0, 1]
version (optional[int]): Reserved for future use. Defaults to 0
Returns:
(numpy.array): unique ids in a numpy array.
"""
cube = cutout_fcn(resource, corner, extent, resolution, t_range)
id_arr = np.unique(cube.data)
# 0 is not a valid id.
id_arr_no_zero = np.trim_zeros(id_arr, trim='f')
return id_arr_no_zero
评论列表
文章目录