DRIP.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:DRIP-SLIP 作者: NASA-DEVELOP 项目源码 文件源码
def array2raster(newRasterFilename,rasterOrigin,pixelWidth,pixelHeight,array,dataType):
    array=array.astype(float)
    cols=array.shape[1]
    rows=array.shape[0]
    originX=rasterOrigin[0]
    originY=rasterOrigin[1]
    driver=gdal.GetDriverByName('GTiff')
    outRaster = driver.Create(newRasterFilename, cols, rows, 1, dataType)
    outRaster.SetGeoTransform((originX, pixelWidth, 0, originY, 0, pixelHeight))
    outband = outRaster.GetRasterBand(1)
    outband.WriteArray(array)
    outRasterSRS = osr.SpatialReference()
    outRasterSRS.ImportFromEPSG(4326)#EPSG code for Nepal only
    outRaster.SetProjection(outRasterSRS.ExportToWkt())
    outband.FlushCache()    

#gets the lat/lon extent of a raster
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号