Band¶
-
class
aeronet.dataset.raster.Band(fp)[source]¶ Bases:
aeronet.dataset.raster.geoobject.GeoObjectFilesystem object Band - Rasterio DatasetReader wrapper.
The Band provides access to a georeferenced raster file placed in the filesystem. It stores all the necessary metadata and allows to read the raster data on request
The majority of properties are inherited from rasterio DatasetReader.
-
bounds¶ The lower left and upper right bounds of the dataset in the units of its coordinate reference system.
Returns: (lower left x, lower left y, upper right x, upper right y) Return type: Tuple (float, float, float, float)
-
count¶ (int) number of channels/bands.
Type: Returns
-
crs¶ Geographic coordinate reference system of the object
Returns: rasterio.CRS object
-
dtype¶ Numerical type of the data stored in raster
Type: Returns Type: numpy.dtype
-
generate_samples(width, height)[source]¶ Yield Sample`s with defined grid :param width: dimension of sample in pixels and step along `X axis :param height: dimension of sample in pixels and step along Y axis
Returns: Generator object
-
height¶ Height of the raster data object
Returns: (int) image height in pixels.
-
meta¶ The basic metadata of the associated rasterio DatasetReader
-
name¶ Name of the file associated with the Band, without extension.
-
nodata¶ The value that should be interpreted as ‘No data’. May be None or a value within dtype range
-
numpy()[source]¶ Read all the raster data into memory
Returns: BandSample representing the whole Band
-
reproject_to(other: aeronet.dataset.raster.geoobject.GeoObject, fp=None, interpolation='nearest')[source]¶ Reprojects self to match exactly the other. This function ensures that the raster size, crs and transform will be the same, allowing them to be merged into one BandCollection. If the intial raster exceeds the other in coverage, it will be cut, and if it is insufficient or displaced, it will be zero-padded.
It aims to overpass the rounding problem which may cause an image to be misaligned with itself after a different series of transforms.
If the images are far from each other, the warning will be shown, because the raster may be zero due to severe misalignment. :param other: the Band with the parameters to fit to :param fp: specifies where to save new Band; if None, a temporary file is created :param interpolation: interpolation type parameter, defaults to Nearest Neighbor.
Returns: new reprojected and resampled Band
-
reproject_to_utm(fp=None, interpolation='nearest')[source]¶ Alias of reproject method with automatic Band utm zone determining
-
res¶ Resolution or ground sampling distance along X and Y axes.
Returns: (x_resolution, y_resolution) Return type: Tuple [int, int]
-
resample(dst_res, fp=None, interpolation='nearest')[source]¶ Change spatial resolution of the
Parameters: - dst_res –
- fp –
- interpolation –
Returns:
-
same(other)[source]¶ Compare bands by crs, transform, width, height.
Returns: True if all match, False otherwise
-
sample(y, x, height, width, **kwargs)[source]¶ Read sample of the Band to memory.
The sample is defined by its size and position in the raster, without respect to the georeference. In case if the sample coordinates spread out of the image boundaries, the image is padded with nodata value.
Parameters: - x – pixel horizontal coordinate of left top corner of the sample
- y – pixel vertical coordinate of left top corner of the sample
- width – spatial dimension of sample in pixels
- height – spatial dimension of sample in pixels
Returns: BandSample object
-
shape¶ (count, height, width); or (height, width)
Type: A tuple of int
-
transform¶ Affine transform matrix This transform maps pixel row/column coordinates to coordinates in the dataset’s coordinate reference system.
Returns: affine.Affine object
-
width¶ Width of the raster data object
Returns: (int) image width in pixels.
-
-
class
aeronet.dataset.raster.BandSample(name, raster, crs, transform, nodata=0)[source]¶ Bases:
aeronet.dataset.raster.geoobject.GeoObjectA wrapper over numpy array representing an in-memory georeferenced raster image.
It implements all the interfaces of the GeoObject, and stores the raster data in memory
-
bounds¶ The lower left and upper right bounds of the dataset in the units of its coordinate reference system.
Returns: (lower left x, lower left y, upper right x, upper right y) Return type: Tuple (float, float, float, float)
-
count¶ (int) number of channels/bands.
Type: Returns
-
crs¶ Geographic coordinate reference system of the object
Returns: rasterio.CRS object
-
dtype¶
-
generate_samples(width, height)[source]¶ Yield Sample`s with defined grid :param width: dimension of sample in pixels and step along `X axis :param height: dimension of sample in pixels and step along Y axis
Returns: Generator object
-
height¶ Height of the raster data object
Returns: (int) image height in pixels.
-
name¶
-
nodata¶ The value that should be interpreted as ‘No data’. May be None or a value within dtype range
-
reproject_to_utm(interpolation='nearest')[source]¶ Alias of reproject method with automatic Band utm zone determining
-
res¶ Resolution or ground sampling distance along X and Y axes.
Returns: (x_resolution, y_resolution) Return type: Tuple [int, int]
-
same(other)[source]¶ Compare if samples have same resolution, crs and shape.
This means that the samples represent the same territory (like different spectral channels of the same image) and can be processed together as collection.
Parameters: other – BandSample object to compare with Returns: True if the BandSamples match in shape and georeference
-
sample(y, x, height, width)[source]¶ Subsample of Sample with specified:
x, y - pixel coordinates of left top corner width, height - spatial dimension of sample in pixels
Returns: Sample object
-
shape¶ (count, height, width); or (height, width)
Type: A tuple of int
-
transform¶ Affine transform matrix This transform maps pixel row/column coordinates to coordinates in the dataset’s coordinate reference system.
Returns: affine.Affine object
-
width¶ Width of the raster data object
Returns: (int) image width in pixels.
-