(dst_path: Union[str, pathlib.PurePath], suffix: str = ".tif")
Create temporary file.
Create temporary file.
Create temporary file .
def TemporaryRasterFile(dst_path: Union[str, pathlib.PurePath], suffix: str = ".tif"):
    """Create temporary file."""
    # For local file we should create temporary file in the same directory
    tmpdir = (
        None if not pathlib.Path(dst_path).is_file() else pathlib.Path(dst_path).parent
    )
    fileobj = tempfile.NamedTemporaryFile(dir=tmpdir, suffix=suffix, delete=False)
    fileobj.close()
    try:
        yield fileobj
    finally:
        os.remove(fileobj.name)
def TemporaryRasterFile ( dst_path : Union [ str , pathlib . PurePath ] , suffix : str = ".tif" ) : # For local file we should create temporary file in the same directory tmpdir = ( None if not pathlib . Path ( dst_path ) . is_file ( ) else pathlib . Path ( dst_path ) . parent ) fileobj = tempfile . NamedTemporaryFile ( dir = tmpdir , suffix = suffix , delete = False ) fileobj . close ( ) try : yield fileobj finally : os . remove ( fileobj . name )