accessmod/layer.py
def write(self, overwrite=False):
        """Write stack layer to disk."""
        self.fs.makedirs(os.path.dirname(self.filepath), exist_ok=True)
        if self.fs.exists(self.filepath) and not overwrite:
            raise FileExistsError(f"File {self.filepath} already exists.")

        data = self.merge()
        meta = self.meta.copy()
        meta.update(dtype="int16", compress="zstd", nodata=0)

        with self.fs.open(self.filepath, "wb") as f:
            with rasterio.open(f, "w", **meta) as dst:
                dst.write(data, 1)

        logger.info(f"Written stack layer to {self.filepath}")
Write stack layer to disk.
Write stack layer to disk.
Write stack layer to disk .
def write(self, overwrite=False):
        self.fs.makedirs(os.path.dirname(self.filepath), exist_ok=True)
        if self.fs.exists(self.filepath) and not overwrite:
            raise FileExistsError(f"File {self.filepath} already exists.")
        data = self.merge()
        meta = self.meta.copy()
        meta.update(dtype="int16", compress="zstd", nodata=0)
        with self.fs.open(self.filepath, "wb") as f:
            with rasterio.open(f, "w", **meta) as dst:
                dst.write(data, 1)
        logger.info(f"Written stack layer to {self.filepath}")
def write ( self , overwrite = False ) : self . fs . makedirs ( os . path . dirname ( self . filepath ) , exist_ok = True ) if self . fs . exists ( self . filepath ) and not overwrite : raise FileExistsError ( f"File {self.filepath} already exists." ) data = self . merge ( ) meta = self . meta . copy ( ) meta . update ( dtype = "int16" , compress = "zstd" , nodata = 0 ) with self . fs . open ( self . filepath , "wb" ) as f : with rasterio . open ( f , "w" , ** meta ) as dst : dst . write ( data , 1 ) logger . info ( f"Written stack layer to {self.filepath}" )
Write stack layer to disk.
Write stack layer to disk .
"""Write stack layer to disk."""
self
overwrite