def convert(self, format=None, geom=None):
        imgpath = self.image.path
        # Handle format as .tif, tif, or tif.zip
        ext = format or os.path.splitext(imgpath)[-1][1:]
        ext = os.path.splitext(ext)[0]
        driver = greenwich.driver_for_path('base.%s' % ext)
        # No conversion is needed if the original format without clipping
        # is requested.
        if not geom and imgpath.endswith(ext):
            return
        memio = MemFileIO()
        if geom:
            with greenwich.Raster(imgpath) as r:
                with r.clip(geom) as clipped:
                    clipped.save(memio, driver)
        else:
            driver.copy(imgpath, memio.name)
        self.image.file = memio
dataset/ETHPy150Open bkg/django-spillway/spillway/models.py/AbstractRasterStore.convert/original