参考文献:
《SEBAL-TIM》
pySEBAL_input_MODIS.py
代码:
import os
from osgeo import gdal, osr
import numpy as np
input_name=r'D:\DATA\ArcGIS\sabal\1.NDVI\3. mosiac\NDVI_RasterMosaic2.tif'
output_name=r'D:\DATA\ArcGIS\sabal\1.NDVI\4. convert_GEO\NDVI_RasterMosaic2_1984(2).tif'
epsg_to=4326
src_ds = gdal.Open(input_name)
# Define target SRS
dst_srs = osr.SpatialReference()
dst_srs.ImportFromEPSG(int(epsg_to))
dst_wkt = dst_srs.ExportToWkt()
#error_threshold = 0.125 # error threshold --> use same value as in gdalwarp
resampling = gdal.GRA_NearestNeighbour
# Call AutoCreateWarpedVRT() to fetch default values for target raster dimensions and geotransform
tmp_ds = gdal.AutoCreateWarpedVRT( src_ds,
None, # src_wkt : left to default value --> will use the one from source
dst_wkt,
resampling )
dst_ds = gdal.GetDriverByName('GTiff').CreateCopy(output_name, tmp_ds)
dst_ds = None
结果,与ArcGIS的工具转投影相比较:
大多数是相同的,但还是有些数值不相等
有些数值为什么不相等我还没想明白,希望看到这里的您若知道的话还请不吝赐教。