Pair#
- class Pair(reference_paths: list | str | CloudPath | Path | Product | Mosaic, secondary_paths: list | str | CloudPath | Path | Product | Mosaic = None, id: str = None, output_path: str | CloudPath | Path = None, remove_tmp: bool = True, overlap_check: GeometryCheck | str = GeometryCheck.EXTENT, contiguity_check: GeometryCheck | str = GeometryCheck.EXTENT, **kwargs)[source]#
Bases:
SetClass of two-products pair
- __init__(reference_paths: list | str | CloudPath | Path | Product | Mosaic, secondary_paths: list | str | CloudPath | Path | Product | Mosaic = None, id: str = None, output_path: str | CloudPath | Path = None, remove_tmp: bool = True, overlap_check: GeometryCheck | str = GeometryCheck.EXTENT, contiguity_check: GeometryCheck | str = GeometryCheck.EXTENT, **kwargs)[source]#
Output path of the pairs.
- clean_tmp()#
Clean the temporary directory of the current product
- clear()#
Clear this product’s cache
- get_attr(attr: str, **kwargs) Any#
Get attribute, either from kwargs or from the first product (default)
- Parameters:
attr (str) – Wanted attribute
**kwargs – Other args
- Returns:
Attribute result
- Return type:
Any
- get_band_file_name(band: BandNames, pixel_size: float = None, size: list | tuple = None, suffix: str = 'tif', **kwargs) str#
Get the filename of any band, managing windows and other args.
- get_bands_to_load(bands, out_suffix='tif', **kwargs) -> (<class 'list'>, <class 'dict'>)#
- get_first_prod() Product#
Get first product, which should be coherent with all others
- Returns:
First reference product
- Return type:
Product
- get_mosaics() list[Mosaic][source]#
Get all the products as a list.
- Returns:
Products list
- Return type:
- has_band(band: str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames) bool#
Does this moasic have products with the specified band ?
By band, we mean:
satellite band
index
DEM band
cloud band
- Parameters:
band (BandType) – EOReader band (optical, SAR, clouds, DEM)
- Returns:
True if the products has the specified band
- Return type:
- has_bands(bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames) bool#
Does this moasic have products with the specified bands ?
By band, we mean:
satellite band
index
DEM band
cloud band
See
has_bandfor a code example.- Parameters:
bands (BandsType) – EOReader bands (optical, SAR, clouds, DEM)
- Returns:
True if the products has the specified band
- Return type:
- is_homogeneous(attr: str) bool#
Check if the given attribute is the same for all products constituting the mosaic.
- load(reference_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, secondary_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, diff_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, pixel_size: float = None, diff_method: DiffMethod = DiffMethod.REFERENCE_SECONDARY, resampling: Resampling = Resampling.bilinear, **kwargs) -> (<class 'xarray.core.dataset.Dataset'>, <class 'xarray.core.dataset.Dataset'>, <class 'xarray.core.dataset.Dataset'>)[source]#
Load the bands and compute the wanted spectral indices for reference, secondary and diff.
- Parameters:
reference_bands (BandsType) – Wanted reference bands
secondary_bands (BandsType) – Wanted secondary bands
diff_bands (BandsType) – Wanted diff bands
pixel_size (float) – Pixel size of the returned Datasets. If not specified, use the pair’s pixel size.
diff_method (DiffMethod) – Difference method for the computation of diff_bands
resampling (Resampling) – Resampling method
kwargs – Other arguments used to load bands
- Returns:
Reference, secondary and diff wanted bands as xr.Datasets
- Return type:
(xr.Dataset, xr.Dataset, xr.Dataset)
- post_init(**kwargs)#
Post initialization as the set level.
- stack(reference_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, secondary_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, diff_bands: list | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames = None, pixel_size: float = None, diff_method: DiffMethod = DiffMethod.REFERENCE_SECONDARY, stack_path: str | CloudPath | Path = None, save_as_int: bool = False, **kwargs) DataArray[source]#
Stack bands and index of a pair.
- Parameters:
reference_bands (BandsType) – Bands and index combination for the reference mosaic
secondary_bands (BandsType) – Bands and index combination for the secondary mosaic
diff_bands (BandsType) – Bands and index combination for the difference between reference and secondary mosaic
pixel_size (float) – Stack pixel size. If not specified, use the pair’s pixel size.
stack_path (AnyPathStrType) – Stack path
save_as_int (bool) – Convert stack to uint16 to save disk space (and therefore multiply the values by 10.000)
**kwargs – Other arguments passed to
loadorrioxarray.to_raster()(such ascompress)
- Returns:
Stack as a DataArray
- Return type:
xr.DataArray
- condensed_name#
Mosaic condensed name, a mix based on the dates and constellations of the components of the mosaic.
- constellations#
List of unique constellations constituting the set
- crs#
CRS of the mosaic. If not provided in kwargs, using the first product’s crs.
- default_pixel_size: int#
by default it is the coarsest pixel size of the set.
- Type:
Default pixel size of the set
- has_secondary#
Does the pair have a secondary mosaic? (Pair with only one reference is allowed)
- id: str#
ID of the reference product, given by the creator of the mosaic. If not, a mix based on the dates and constellations of its components.
- nodata#
Nodata of the mosaic. If not provided in kwargs, using the first product’s nodata.
- property output: CloudPath | Path#
Output directory of the set
- Returns:
Output path of the set
- Return type:
AnyPathType
- pixel_size#
Pixel size of the set. If not provided in kwargs, using the first product’s pixel size.
- reference_id#
ID of the reference product
- reference_mosaic#
Reference mosaic (unique date and contiguous). The one on which the secondary will be aligned.
- same_constellation#
Is the mosaic constituted of the same constellation?
- same_crs#
Is the mosaic constituted of the same sensor type?
- secondary_id#
ID of the secondary product
- secondary_mosaic#
Secondary mosaic (unique date and contiguous). The one which will be aligned on the reference.