RasterProduct
- class eolab.georastertools.product.rasterproduct.RasterProduct(file: Path | str, vrt_outputdir: Path | str | None = None)[source]
Bases:
objectData model for a raster product that handles :
a raster type
the list of available bands
the path to the product
A raster product can be easily like this:
with RasterProduct("my_product_filename.zip") as product: rastertype = product.rastertype() raster = product.get_raster() # raster is an in-memory VRT that can # be opened using rasterio with rasterio.open(raster) as rst: print(rst.count) data = rst.read([1, 2, 3], masked=True) # data is a numpy masked array
A raster product handles several in-memory VRTs that must be properly released. The with statement enables this. If you want to control the clean-up of the in-memory VRTs you have to call
free_in_memory_vrts().Attributes
Dictionary of available bands.
List of available channels in the product
Product path
Whether the raster product is an archive (zip, tar, dir, ...) or a regular raster image
Dictionary of available mask bands.
Type of the raster
Methods
RasterProduct.__init__(file[, vrt_outputdir])Constructor
Free in-memory VRTs by closing all MemoryFile objects.
Extracts the timestamp of the raster
RasterProduct.get_date_string([strformat])Extracts the timestamp of the raster and returns it as a formatted string
RasterProduct.get_raster([bands, masks, ...])Gets the path to the raster corresponding to this product.
Extracts the relative orbit number of the raster
Extracts the satellite's name of the raster
Extracts the tile identifier of the raster
RasterProduct.open([bands, masks, roi])