Python osgeo.gdal.UseExceptions() Examples
The following are 4
code examples of osgeo.gdal.UseExceptions().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
osgeo.gdal
, or try the search function
.
Example #1
Source File: tools.py From buzzard with Apache License 2.0 | 5 votes |
def make_tif2(path, reso=(1., -1.), rsize=(10, 10), tl=(0., 10.), proj=SRS[0]['wkt'], channel_count=1, dtype=gdal.GDT_Float32, nodata=-32000, nodata_border_size=(0, 0, 0, 0)): """Create a tiff files""" reso = np.asarray(reso) fp = buzz.Footprint(tl=tl, rsize=rsize, size=np.abs(reso * rsize)) x, y = fp.meshgrid_raster a = x + y if nodata_border_size != 0: l, r, t, b = nodata_border_size if t != 0: a[None:t, None:None] = nodata if b != 0: a[-b:None, None:None] = nodata if l != 0: a[None:None, None:l] = nodata if r != 0: a[None:None, -r:None] = nodata LOGGER.info('TIFF ARRAY:%s\n', a) gdal.UseExceptions() driver = gdal.GetDriverByName('GTiff') dataset = driver.Create(path, int(rsize[0]), int(rsize[1]), channel_count, dtype) dataset.SetGeoTransform(fp.gt) dataset.SetProjection(proj) for i in range(channel_count): dataset.GetRasterBand(i + 1).WriteArray(a) dataset.GetRasterBand(i + 1).SetNoDataValue(nodata) dataset.FlushCache()
Example #2
Source File: util.py From wradlib with MIT License | 5 votes |
def has_geos(): pnt1 = ogr.CreateGeometryFromWkt("POINT(10 20)") pnt2 = ogr.CreateGeometryFromWkt("POINT(30 20)") ogrex = ogr.GetUseExceptions() gdalex = gdal.GetUseExceptions() gdal.DontUseExceptions() ogr.DontUseExceptions() hasgeos = pnt1.Union(pnt2) is not None if ogrex: ogr.UseExceptions() if gdalex: gdal.UseExceptions() return hasgeos
Example #3
Source File: raster_processing.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def __init__(self): # this allows GDAL to throw Python Exceptions gdal.UseExceptions()
Example #4
Source File: HSV_fusion.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def __init__(self): """ Constructor """ # this allows GDAL to throw Python Exceptions gdal.UseExceptions()