Subsetting GeoTIFF with Python
You can indeed use gdal_translate
either giving the source coordinates ([-srcwin xoff yoff xsize ysize]
) or the georeferenced coordinates ([-projwin ulx uly lrx lry]
). For instance:
import os
inDS = ... # input raster
outDS = ... # output raster
lon = ... # lon of your flux tower
lat = ... # lat of your flux tower
ulx = lon - 24.5
uly = lat + 24.5
lrx = lon + 24.5
lry = lat - 24.5
translate = 'gdal_translate -projwin %s %s %s %s %s %s' %(ulx, uly, lrx, lry, inDS, outDS)
os.system(translate)