I want to resample a georeferend raster .tif file with Python using rasterio.
I found this: example
and here is a description of the resampling methods
I have to use the max method which is available in GDAL version 2.0.0 and higher. I have installed GDAL version 2.4.4 via brew on my Mac OS system.
When I run the following code (i.e. almost the example code):
raster = Path('dsm_EPSG_4839_cropped.tif') import rasterio from rasterio.enums import Resampling upscale_factor = 1/(2**5) with rasterio.open(raster) as dataset: # resample data to target shape data = dataset.read( out_shape=( dataset.count, int(dataset.height * upscale_factor), int(dataset.width * upscale_factor) ), resampling=Resampling.max ) # scale image transform transform = dataset.transform * dataset.transform.scale( (dataset.width / data.shape[-1]), (dataset.height / data.shape[-2]) )
I am getting the following error:
Segmentation fault: 11
Is there a way to determine the GDAL version the rasterio package uses? Is there a way to change that GDAL version rasterio is using?