Features

List of main features

Spatial and temporal indexation

Perform a query in space (WGS84 bounding box) and time (optional) with an RTree indexation structure.

scenes = drs.get_spot67_scenes(root_dir)  # drs contains helpers to deal with Spot 6/7 geosud collections
idx = indexation.Index(scenes)            # spatial/temporal index
matches = idx.find(bbox_wgs84=bbox)       # Returns scenes list. Query can include dt_min/dt_max datetime
for one_scene in matches:                 # Print matching scenes info
  print(one_scene)

Imagery access

Use cases

XS image in TOA

toa = scene.get_imagery(reflectance="toa")  # imagery instance
xs = toa.get_xs()                           # source instance
exp = "(im1b4-im1b1)/(im1b4+im1b1)"
ndvi = pyotb.bandmath(exp=exp, il=[xs])     # pyotb.app using the source
ndvi.write("ndvi.tif")

Pansharpened XS image in TOA, masked with cloud mask, over a ROI:

toa = scene.get_imagery(reflectance="toa")  # imagery instance
pxs = toa.get_pxs()                         # source instance (1)
drilled = pxs.drilled()                     # source instance (2)
ref_img = "/tmp/S2A_2020...._FRE_10m.tif"
subset = drilled.clip_over_img(ref_img)     # source instance (3)
subset.write("subset.tif")

Superimpose an image:

toa = scene.get_imagery(reflectance="toa")  # imagery instance
superimposed = toa.resample_over(ref_img)   # source instance
superimposed.write("superimposed.tif")

Classes

classDiagram

    Scene <|-- Spot67Scene
    Scene <|-- Sentinel2SceneBase
    Sentinel2SceneBase <|-- Sentinel22AScene
    Sentinel2SceneBase <|-- Sentinel23AScene

    Scene --*  Imagery: root_scene
    Imagery <|-- Spot67Imagery
    Imagery <|-- Sentinel2ImageryBase
    Sentinel2ImageryBase <|-- Sentinel22AImagery
    Sentinel2ImageryBase <|-- Sentinel23AImagery
    
    Imagery --*  Source: root_imagery
    Source <|-- Spot67Source 
    Source <|-- Sentinel2Source
    Sentinel2Source <|-- Sentinel22ASource 
    Sentinel2Source <|-- Sentinel23ASource 

    class Scene{
        +datetime acquisition_date
        +int epsg
        +bbox_wgs84
        +get_metadata()
        +__repr__()
    }

    class Spot67Scene{
        +float azimuth_angle
        +float azimuth_angle_across
        +float azimuth_angle_along
        +float incidence_angle
        +float sun_azimuth_angle
        +float sun_elev_angle
        +Spot67Imagery get_imagery()
        +get_metadata()
    }
    
    class Sentinel2SceneBase{
        +__init__(archive, tag)
        +get_file()
        +get_band()
        +get_metadata()
    }

    class Sentinel22AScene{
        +__init__(archive)
        +str clm_r1_msk_file
        +str clm_r2_msk_file
        +str edg_r1_msk_file
        +str edg_r2_msk_file
        +Sentinel2AImagery get_imagery()
        +get_metadata()
    }
    
    class Sentinel23AScene{
        +__init__(archive)
        +str flg_r1_msk_file
        +str flg_r2_msk_file
        +Sentinel3AImagery get_imagery()
        +get_metadata()  
    }
    
    class Source{
        +__init__(root_imagery, out, parent=None)
        +Imagery root_imagery
        +Source parent
        +Source drilled(msk_vec_file, nodata=0)
        +Source cld_msk_drilled(nodata=0)
        +Source resample_over(ref_img, interpolator="nn", nodata=0)
        +Source clip_over_img(ref_img)
        +Source clip_over_vec(ref_vec)
        +Source new_source(*args)
    }
    
    class Spot67Source{
        +Source cld_msk_drilled(nodata=0)
    }
    
    class Sentinel2Source{
        +R1_SIZE
        +R2_SIZE
        +Source msk_drilled(msk_dict, exp, nodata=0)
    }
    
    class Sentinel22ASource{
        +Source cld_msk_drilled(nodata=0)
    }
    
    class Sentinel23ASource{
        +Source flg_msk_drilled(keep_flags_values=(3, 4), nodata=0)
    }
    
    class Imagery{
        +__init__(root_scene)
        +Scene root_scene
    }

    class Spot67Imagery{
        +__init__(root_scene)
        +Source get_pxs()
        +Source get_pan()
        +Source get_xs()
    }
    
    class Sentinel2ImageryBase{
        +_concatenate_10m_bands()
        +_concatenate_20m_bands()
    }
    
    class Sentinel22AImagery{
        +get_10m_bands()
        +get_20m_bands()
    }

    class Sentinel23AImagery{
        +get_10m_bands()
        +get_20m_bands()
    }