def process_nexus_tile()

in sdap/processors/promotevariabletoglobalattribute.py [0:0]


    def process_nexus_tile(self, nexus_tile):
        output_tile = nexusproto.DataTile_pb2.NexusTile()
        output_tile.CopyFrom(nexus_tile)

        file_path = output_tile.summary.granule
        file_path = file_path[len('file:'):] if file_path.startswith('file:') else file_path

        dimtoslice = {}
        for dimension in output_tile.summary.section_spec.split(','):
            name, start, stop = dimension.split(':')
            dimtoslice[name] = slice(int(start), int(stop))

        with Dataset(file_path) as ds:
            new_attr = output_tile.summary.global_attributes.add()
            new_attr.name = self.attribute_name
            new_attr.values.extend(
                [str(v) for v in ds[self.variable_name][[dimtoslice[dim] for dim in self.dimensioned_by]]])

        yield output_tile