Method which does the saving

        :param eopatch: EOPatch containing the data which will be saved
        :type eopatch: EOPatch
        :param use_tmp: If `True` data will be saved to temporary file, otherwise it will be saved to intended
        (i.e. final) location
        :type use_tmp: bool

def save(self, eopatch, use_tmp=True):
        """ Method which does the saving

        :param eopatch: EOPatch containing the data which will be saved
        :type eopatch: EOPatch
        :param use_tmp: If `True` data will be saved to temporary file, otherwise it will be saved to intended
        (i.e. final) location
        :type use_tmp: bool
        """
        filename = self.tmp_filename if use_tmp else self.final_filename

        if self.feature_name is None:
            data = eopatch[self.feature_type]
            if self.feature_type.has_dict():
                data = data.get_dict()

            if self.feature_type is FeatureType.BBOX:
                data = tuple(data) + (int(data.crs.value),)
        else:
            data = eopatch[self.feature_type][self.feature_name]

        file_dir = os.path.dirname(filename)
        os.makedirs(file_dir, exist_ok=True)

        if self.compress_level:
            file_handle = gzip.GzipFile(filename, 'w', self.compress_level)
        else:
            file_handle = open(filename, 'wb')

        with file_handle as outfile:
            LOGGER.debug("Saving (%s, %s) to %s", str(self.feature_type), str(self.feature_name), filename)

            if self.file_format is FileFormat.NPY:
                np.save(outfile, data)
            elif self.file_format is FileFormat.PICKLE:
                pickle.dump(data, outfile)
            else:
                ValueError('File {} was not saved because saving in file format {} is currently not '
                           'supported'.format(filename, self.file_format))