Created
May 23, 2021 11:44
-
-
Save bpostance/dda44bcabbfe5879c9bcd759a1b4bfb5 to your computer and use it in GitHub Desktop.
GDAL Warp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from osgeo import gdal | |
in_file = f"./modis.hdf" # raw MODIS HDF in sinusoid projection | |
out_file = f"./modis.tif" | |
# open dataset | |
dataset = gdal.Open(in_file,gdal.GA_ReadOnly) | |
subdataset = gdal.Open(dataset.GetSubDatasets()[0][0], gdal.GA_ReadOnly) | |
# gdalwarp | |
kwargs = {'format': 'GTiff', 'dstSRS': 'EPSG:4326'} | |
ds = gdal.Warp(destNameOrDestDS=out_file,srcDSOrSrcDSTab=subdataset, **kwargs) | |
del ds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment