def get_dataset(self, key, info=None, out=None, xslice=None, yslice=None):
        """Load a dataset
        """
        if key in self.cache:
            return self.cache[key]
        # Type dictionary
        typedict = {"af": "flash_accumulation",
                    "afa": "accumulated_flash_area",
                    "afr": "flash_radiance",
                    "lgr": "radiance",
                    "lef": "radiance",
                    "lfl": "radiance"}

        # Get lightning data out of NetCDF container
        logger.debug("Key: {}".format(key.name))
        # Create reference grid
        grid = np.full((self.nlines, self.ncols), np.NaN)
        # Set slices to full disc extent
        if xslice is None:
            xslice = slice(0, self.ncols, None)
        if yslice is None:
            yslice = slice(0, self.nlines, None)
        logger.debug("Slices - x: {}, y: {}".format(xslice, yslice))
        # Get product values
        values = self.nc[typedict[key.name]]
        rows = self.nc['row']
        cols = self.nc['column']
        logger.debug('[ Number of values ] : {}'.format((len(values))))
        logger.debug('[Min/Max] : <{}> / <{}>'.format(np.min(values),
                                                      np.max(values)))
        # Convert xy coordinates to flatten indices
        ids = np.ravel_multi_index([rows, cols], grid.shape)
        # Replace NaN values with data
        np.put(grid, ids, values)

        # Correct for bottom left origin in LI row/column indices.
        rotgrid = np.flipud(grid)
        logger.debug('Data shape: {}, {}'.format(yslice, xslice))
        # Rotate the grid by 90 degree clockwise
        rotgrid = np.rot90(rotgrid, 3)
        logger.warning("LI data has been rotated to fit to reference grid. \
                        Works only for test dataset")
        # Slice the gridded lighting data
        slicegrid = rotgrid[yslice, xslice]
        # Mask invalid values
        ds = np.ma.masked_where(np.isnan(slicegrid), slicegrid)
        # Create dataset object
        out.data[:] = np.ma.getdata(ds)
        out.mask[:] = np.ma.getmask(ds)
        out.info.update(key.to_dict())

        return(out)
Load a dataset