Support de STAC
Base
- Publication scene --> STAC Item (cf. https://pystac.readthedocs.io/en/stable/tutorials/how-to-create-stac-catalogs.html):
-
rendre bbox similaire à rasterio -
ajouter footprint (doit être similaire à rasterio)
-
- Instanciation de scenes à partir de catalogue STAC
-
instancier un object Scene
à partir d'un STAC Item
-
A investiguer
-
Genericité de l'API STAC pour faire des recherches par bbox et date -
Mapping générique STAC Item --> SensorScene permettant l'ajout de multiples fournisseurs pour un capteur donné
Scene
Refonte des constructeurs de classes Avant
classDiagram
Scene <|-- Spot67Scene
Scene <|-- Sentinel2SceneBase
Sentinel2SceneBase <|-- Sentinel22AScene
Sentinel2SceneBase <|-- Sentinel23AScene
Scene : __init__(acquisition_date, epsg, extent_wgs84)
Scene : datetime acquisition_date
Scene : list extent_wgs84
Scene : int epsg
Scene : BoundingBox bbox_wgs84
Spot67Scene : __init__(dim_xs, dim_pan)
Spot67Scene : Spot67Source get_xs(reflectance)
Spot67Scene : Spot67Source get_pan(reflectance)
Spot67Scene : list extent_wgs84_xs
Spot67Scene : list extent_wgs84_pan
Spot67Scene : float sun_az
Spot67Scene : float sun_elev
Spot67Scene : str cld_msk_file_xs
Spot67Scene : str cld_msk_file_pan
Spot67Scene : str roi_msk_file_xs
Spot67Scene : str roi_msk_file_pan
Sentinel2SceneBase : __init__(archive, tag)
Sentinel2SceneBase : str archive
Sentinel2SceneBase : str tag
Sentinel22AScene : __init__(archive)
Sentinel22AScene : Sentinel22ASource get_10m_bands()
Sentinel22AScene : Sentinel22ASource get_20m_bands()
Sentinel22AScene: str clm_r1_msk_file
Sentinel22AScene: str edg_r1_msk_file
Sentinel22AScene: str clm_r2_msk_file
Sentinel22AScene: str edg_r2_msk_file
Sentinel23AScene : __init__(archive)
Sentinel23AScene : Sentinel23ASource get_10m_bands()
Sentinel23AScene : Sentinel23ASource get_20m_bands()
Sentinel23AScene: str flg_r1_msk_file
Sentinel23AScene: str flg_r2_msk_file
Après
Scenes
classDiagram
Scene <|-- Spot67Base
Spot67Base <|-- Spot67DRS
Spot67Base <|-- Spot67IGN
Scene <|-- Sentinel2Base
Sentinel2Base <|-- Sentinel2Theia2A
Sentinel2Base <|-- Sentinel2Theia3A
Sentinel2Base <|-- Sentinel2MPC2A
Scene : __init__(acquisition_date, epsg, extent_wgs84)
Scene : datetime acquisition_date
Scene : list extent_wgs84
Scene : int epsg
Scene : BoundingBox bbox_wgs84
Scene : dict[str, str] sources_paths
Spot67Base : __init__(src_xs, src_pan)
Spot67Base : list extent_wgs84_xs
Spot67Base : list extent_wgs84_pan
Sentinel2Base : __init__(assets_dict)
Sentinel2Base : class SourceClass
Sources
classDiagram
Source <|-- Spot67DRSSource
Source <|-- Sentinel2Source
Sentinel2Source <|-- Sentinel2Theia2ASource
Sentinel2Source <|-- Sentinel2Theia3ASource
Spot67DRSSource: reflectance(kwargs)
Spot67DRSSource: cld_msk_drilled(nodata)
Sentinel2Source: msk_drilled(msk_dict, exp, nodata)
Sentinel2Theia2ASource: get_cld_drilled(nodata)
Sentinel2Theia3ASource: get_flg_drilled(keep_flags_values, nodata)
Use cases
Local ADS-DRS Spot-6/7 products (DIMAP format)
sc = scenes.spot.from_dimaps(dim_xs='/path/to/DIM_SPOT6_XS_..._1.XML',
dim_pan='/path/to/DIM_SPOT6_P_..._1.XML')
print(sc.sources)
['xs', 'p', 'cld_msk', 'xs_cld_msk', 'pan_cld_msk']
Remote ADS-DRS Spot-6/7 products from Dinamis STAC catalog
scs = scenes.stac.search(url = "https://stacapi.147.100.200.143.nip.io"
collections = ["Spot-6-7-DRS-collection"],
bbox_wgs84=bbox)
print(scs[0].sources)
['xs', 'p', 'cld_msk', 'xs_cld_msk', 'pan_cld_msk']
Remote IGN Spot-6/7 orthos from Dinamis STAC catalog
scs = scenes.stac.search(url = "https://stacapi.147.100.200.143.nip.io"
collections = ["Spot-6-7-IGN-collection"],
bbox_wgs84=bbox)
print(scs[0].sources)
['xs', 'p']
Sentinel-2 Level 2A from Microsoft Planetary Computer
mpc_scs = scenes.stac.search(url="https://planetarycomputer.microsoft.com/api/stac/v1",
collections=["sentinel-2-l2a"],
bbox_wgs84=bbox)
print(mpc_scs[0].sources)
['10m_bands', '20m_bands', '60m_bands']
Sentinel-2 Level 2A from Theia
theia_scs = scenes.theia.search(level="2A",
bbox_wgs84=bbox)
print(theia_scs[0].sources)
['10m_bands', '20m_bands', '60m_bands', '10m_CLM', '20m_CLM', '10m_EDG', '20m_EDG']
Sentinel-2 Level 3A from Theia
theia_scs = scenes.theia.search(level="3A",
bbox_wgs84=bbox)
print(theia_scs[0].sources)
['10m_bands', '20m_bands', '60m_bands', '10m_FLG', '20m_FLG']
Howto
approche pragmatique
-
add get_10m_CLM
,get_20m_CLM
,get_10m_FLG
,get_20m_FLG
,get_10m_EDG
,get_20m_EDG
inSentinel2Source
-
add get_cld_msk
andget_xs_cld_msk
,get_pan_cld_msk
inSpot67DRSSource
-
add optional band indices in get_10m_bands
andget_20m_bands
inSentinel2Scene
-
utiliser sources_paths
pour garder les paths (urls, uris, filenames) des assets disponibles, summarizer cela dans les metadatas automatiquement (suppression des surcharges deget_metadata
dans les classes héritant deScene
)
idee, trop compliqué à mettre en place
- single Source class
- add
capabilities
attribute toSource
: list of all inherited capabilities (e.g.['drilled', 'masked', 'resample_over', 'clip_over_img', 'clip_over_vec', 'reproject']
for any basicSource
) - implement dynamic sources get (use a dict to store sources)