def read_gdal_coordinates(dataset, mode='centers', z=True):
"""Get the projected coordinates from a GDAL dataset.
Parameters
----------
dataset : gdal.Dataset
raster image with georeferencing
mode : string
either 'centers' or 'borders'
z : boolean
True to get height coordinates (zero).
Returns
-------
coordinates : :class:`numpy:numpy.ndarray`
Array of projected coordinates (x,y,z)
Examples
--------
See :ref:`notebooks/classify/wradlib_clutter_cloud_example.ipynb`.
"""
coordinates_pixel = pixel_coordinates(dataset.RasterXSize,
dataset.RasterYSize, mode)
geotransform = dataset.GetGeoTransform()
if z:
coordinates = pixel_to_map3d(geotransform, coordinates_pixel)
else:
coordinates = pixel_to_map(geotransform, coordinates_pixel)
return (coordinates)
评论列表
文章目录