def dynamic_exists(self, labels, progress=None): """ Checks for dynamic mesh existence. Returns: { label: path or None, ... } """ labels = toiter(labels) checks = [self.compute_filename(label) for label in labels] cloudpath = self.meta.join(self.meta.meta.cloudpath, self.meta.mesh_path, 'dynamic') progress = progress if progress is not None else self.config.progress results = CloudFiles(cloudpath, progress=progress, green=self.config.green, secrets=self.config.secrets).exists(checks) output = {} for filepath, exists in results.items(): label = int(os.path.basename(filepath).split(':')[0]) # strip :0 output[label] = filepath if exists else None return output
def exists(self, bbox, mip=None): if mip is None: mip = self.config.mip bbox = Bbox.create(bbox, self.meta.bounds(mip), bounded=True) realized_bbox = bbox.expand_to_chunk_size( self.meta.chunk_size(mip), offset=self.meta.voxel_offset(mip)) realized_bbox = Bbox.clamp(realized_bbox, self.meta.bounds(mip)) cloudpaths = chunknames(realized_bbox, self.meta.bounds(mip), self.meta.key(mip), self.meta.chunk_size(mip), protocol=self.meta.path.protocol) exists = CloudFiles(self.meta.cloudpath, progress=self.config.progress, secrets=self.config.secrets).exists(cloudpaths) if len(self.lru): for k, v in exists.items(): if v == False: self.lru.pop(k, None) return exists