#NEWLINE# def make_raster( in_ds , fn , data , data_type , nodata = None ) : #NEWLINE# #INDENT# 'Create a one-band GeoTIFF.\n\n    in_ds     - datasource to copy projection and geotransform from\n    fn        - path to the file to create\n    data      - NumPy array containing data to write\n    data_type - output data type\n    nodata    - optional NoData value\n    ' #NEWLINE# driver = gdal . GetDriverByName ( 'GTiff' ) #NEWLINE# out_ds = driver . Create ( fn , in_ds . RasterXSize , in_ds . RasterYSize , 1 , data_type ) #NEWLINE# out_ds . SetProjection ( in_ds . GetProjection ( ) ) #NEWLINE# out_ds . SetGeoTransform ( in_ds . GetGeoTransform ( ) ) #NEWLINE# out_band = out_ds . GetRasterBand ( 1 ) #NEWLINE# if ( nodata is not None ) : #NEWLINE# #INDENT# out_band . SetNoDataValue ( nodata ) #NEWLINE# #UNINDENT# out_band . WriteArray ( data ) #NEWLINE# out_band . FlushCache ( ) #NEWLINE# out_band . ComputeStatistics ( False ) #NEWLINE# return out_ds