Stack Exchange
Extracting part of raster with smaller raster using GDAL
I have a raster file with the extent of
[-169.04000663757324, 42.95999826798774, -54.3399982452392, 9.76000022888184]
I want to extract part of this raster by bounding box of
(-148.966066831209, 64.22028035980699, -148.32886683120898, 64.444380359807)
Is there any way to do that?

Read the documentation of gdal_translate and/or gdalwarp.

from osgeo import gdal
from osgeo.gdal import gdalconst
import geopandas as gpd

inputpath = r'input_path_raster' # Original raster

outputpath = r'output_path_raster' # Save new raster

# Choose your values for minx, miny, maxx, maxy

minx = -148.966066831209
miny = 64.22028035980699
maxx = -148.32886683120898
maxy = 64.444380359807



# First option to cut the raster

cut = gdal.Warp(destNameOrDestDS = outputpath, 
                srcDSOrSrcDSTab  = inputpath,
                outputBounds     = (minx, miny, maxx, maxy),
                cropToCutline    = True,
                format           = "GTiff",
                dstSRS           = "EPSG:32635",
                outputType       = gdalconst.GDT_UInt16) # Choose the data type format

cut = None

# Second option to cut the raster

cut = gdal.Warp(destNameOrDestDS = outputpath, 
                srcDSOrSrcDSTab  = inputpath,
                outputBounds     = (minx, miny, maxx, maxy),
                cropToCutline    = True,
                copyMetadata     = True)

cut = None

