Collection¶
-
class
aeronet.dataset.raster.BandCollection(bands)[source]¶ Bases:
aeronet.dataset.raster.geoobject.GeoObjectA collection of
Bands with the same crs, transform and shape.It is intended to contain a multi-band image and associated raster masks. All the bands must have the same resolution, so if the initial images have different resolution, they must be resampled previously. Every band must be stored in a separate file; if the initial data is in one file, use
aeronet.converters.split.split()to split it to separate filesParameters: bands – list of Band or list of file paths -
crs¶ Geographic coordinate reference system of the object Returns a rasterio.CRS
-
transform¶ Transform matrix as the affine.Affine object. This transform maps pixel row/column coordinates to coordinates in the dataset’s coordinate reference system.
-
nodata¶ The value that should be interpreted as ‘No data’. May be None or a value within dtype range
-
height¶ Height of the raster data object in pixels
-
width¶ Width of the raster data object in pixels
-
count¶ (int) number of channels/bands.
-
bounds¶ Georeferenced bounds - bounding box in the CRS of the image, based on transform and shape
-
shape¶ (count, height, width); or (height, width)
Type: Dimensions of the raster in pixels, a tuple of int
-
res¶ Resolution (or ground sampling distance) along X and Y axes in units of the CRS. Tuple (x_resolution, y_resolution)
-
is_valid¶ Check if all bands have the same resolution, shape and coordinate system
-
append(other)[source]¶ Add a band to collection, checking it to be compatible by shape, transform and crs
-
sample(y, x, height, width)[source]¶ Sample memory object from BandCollection.
Parameters: - x – int, top left corner X offset in pixels
- y – int, top left corner Y offset in pixels
- width – int, width of samples in pixels
- height – int, height of samples in pixels
Returns: a new
BandCollectionSamplecontaining the specified spatial subset of the BandCollection
-
ordered(*names)[source]¶ Creates a new object, containing the specified bands in the specific order.
Parameters: *names – order of names Returns: reordered BandCollection
-
reproject(dst_crs, directory=None, interpolation='nearest')[source]¶ Reprojects every Band of the collection, see
Band.reproject()and returns a new reprojected BandCollection
-
reproject_to_utm(directory=None, interpolation='nearest')[source]¶ Alias of reproject method with automatic utm zone determining
-
resample(dst_res, directory=None, interpolation='nearest')[source]¶ Resamples every Band of the collection, see
Band.resample()and returns a new reprojected BandCollection
-
generate_samples(height, width)[source]¶ A generator for sequential sampling of the whole BandCollection, used for the windowed reading of the raster. It allows to handle and process large files without reading them at once in the memory.
Parameters: - width (int) – dimension of sample in pixels and step along X axis
- height (int) – dimension of sample in pixels and step along Y axis
Yields: BandCollectionSample – sequential samples of the specified dimensions
-
profile¶ A joint representation of the main properties
Returns: { ‘crs’: crs, ‘nodata’: nodata, ‘transform’: transform } Return type: Dict
-
-
class
aeronet.dataset.raster.BandCollectionSample(samples)[source]¶ Bases:
aeronet.dataset.raster.geoobject.GeoObjectA collection of
BandSample, which are also-
crs¶ Geographic coordinate reference system of the object Returns a rasterio.CRS
-
transform¶ Transform matrix as the affine.Affine object. This transform maps pixel row/column coordinates to coordinates in the dataset’s coordinate reference system.
-
res¶ Resolution (or ground sampling distance) along X and Y axes in units of the CRS. Tuple (x_resolution, y_resolution)
-
width¶ Width of the raster data object in pixels
-
height¶ Height of the raster data object in pixels
-
count¶ Number of bands (layers) in the collection
-
shape¶ (count, height, width); or (height, width)
Type: Dimensions of the raster in pixels, a tuple of int
-
nodata¶ The value that should be interpreted as ‘No data’. May be None or a value within dtype range
-
bounds¶ Georeferenced bounds - bounding box in the CRS of the image, based on transform and shape
-
is_valid¶ Check if all bands have the same resolution, shape and coordinate system
-
append(obj)[source]¶ Add sample to collection, checking it to be compatible by shape, transform and crs
-
reproject(dst_crs, interpolation='nearest')[source]¶ Reprojects every BandSample of the collection, see
BandSample.reproject()and returns a new reprojected BandCollectionSample
-
reproject_to_utm(interpolation='nearest')[source]¶ Alias of reproject method with automatic utm zone determining
-
resample(dst_res=None, dst_shape=None, interpolation='nearest')[source]¶ Reprojects every BandSample of the collection, see
BandSample.reproject()and returns a new reprojected BandCollectionSample
-
ordered(*names)[source]¶ Creates a new object, containing the specified bands in the specific order.
Parameters: *names – order of names Returns: reordered BandCollectionSample
-
save(directory, extension='.tif', **kwargs)[source]¶ Saves every BandSample in the specified deirectory, see
BandSample.save()
-
generate_samples(height, width)[source]¶ A generator for sequential sampling of the BandCollectionSample similar to BandCollection, used for the windowed processing of the raster data.
Parameters: - width (int) – dimension of sample in pixels and step along X axis
- height (int) – dimension of sample in pixels and step along Y axis
Yields: BandCollectionSample – sequential samples of the specified dimensions
-
profile¶ A joint representation of the main properties
Returns: { ‘crs’: crs, ‘nodata’: nodata, ‘transform’: transform } Return type: Dict
-