def add_derived_quantity(self, name, function):
        for level in self.levels:
            for grid in level.grids:
                if name in grid.quantities:
                    raise KeyError(name + ' already exists')
                function(grid.quantities)
dataset/ETHPy150Open hyperion-rt/hyperion/hyperion/grid/amr_grid.py/AMRGrid.add_derived_quantity/original