Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • scenes scenes
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 9
    • Issues 9
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

La forge institutionnelle d'INRAE étant en production depuis le 10 juin 2025, nous vous invitons à y créer vos nouveaux projets.

  • umr-tetisumr-tetis
  • scenesscenes
  • Merge requests
  • !27
An error occurred while fetching the assigned milestone of the selected merge_request.

Index search vector

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Cresson Remi requested to merge index_search_vector into develop 3 years ago
  • Overview 0
  • Commits 16
  • Pipelines 15
  • Changes 17
Compare
  • version 14
    ab94a7a6
    3 years ago

  • version 13
    ea4813b4
    3 years ago

  • version 12
    7c29f143
    3 years ago

  • version 11
    20dacf74
    3 years ago

  • version 10
    7a1743d7
    3 years ago

  • version 9
    ed3ab122
    3 years ago

  • version 8
    ab6b2b05
    3 years ago

  • version 7
    2d52842e
    3 years ago

  • version 6
    8fedd0f5
    3 years ago

  • version 5
    4a404419
    3 years ago

  • version 4
    9803a96b
    3 years ago

  • version 3
    467f7c6b
    3 years ago

  • version 2
    3f5c42c4
    3 years ago

  • version 1
    7dab39d4
    3 years ago

  • develop (base)

and
  • latest version
    899ef8d9
    16 commits, 3 years ago

  • version 14
    ab94a7a6
    15 commits, 3 years ago

  • version 13
    ea4813b4
    14 commits, 3 years ago

  • version 12
    7c29f143
    13 commits, 3 years ago

  • version 11
    20dacf74
    12 commits, 3 years ago

  • version 10
    7a1743d7
    11 commits, 3 years ago

  • version 9
    ed3ab122
    10 commits, 3 years ago

  • version 8
    ab6b2b05
    9 commits, 3 years ago

  • version 7
    2d52842e
    8 commits, 3 years ago

  • version 6
    8fedd0f5
    7 commits, 3 years ago

  • version 5
    4a404419
    6 commits, 3 years ago

  • version 4
    9803a96b
    5 commits, 3 years ago

  • version 3
    467f7c6b
    4 commits, 3 years ago

  • version 2
    3f5c42c4
    3 commits, 3 years ago

  • version 1
    7dab39d4
    2 commits, 3 years ago

17 files
+ 513
− 374

    Preferences

    File browser
    Compare changes
apps/s2_download.py
+ 2
− 2
  • View file @ 899ef8d9

  • Edit in single-file editor

  • Open in Web IDE


import argparse
from scenes import TheiaDownloader, utils
from scenes import TheiaDownloader, raster
import datetime
# Arguments
@@ -13,7 +13,7 @@ parser.add_argument("--day", type=int, default=1)
params = parser.parse_args()
# Get all scenes in the root_dir
bbox = utils.get_bbox_wgs84_from_raster(params.refimage)
bbox = raster.get_bbox_wgs84(params.refimage)
acq_date = datetime.datetime(year=params.year, month=params.month, day=params.day)
downloader = TheiaDownloader(config_file=params.theia_cfg)
downloader.download_closest(bbox_wgs84=bbox, acq_date=acq_date, download_dir=params.download_dir)
apps/search.py
+ 2
− 3
  • View file @ 899ef8d9

  • Edit in single-file editor

  • Open in Web IDE


import argparse
from scenes import load_scenes, Index, utils
from scenes import load_scenes, Index, raster, vector
# Arguments
parser = argparse.ArgumentParser(description="Search scenes intesecting an ROI",)
@@ -16,8 +16,7 @@ idx = Index(scenes)
# search
print("Search roi")
bbox_fn = utils.get_bbox_wgs84_from_raster if params.roi.lower().endswith(".tif") \
else utils.get_bbox_wgs84_from_vector
bbox_fn = raster.get_bbox_wgs84 if params.roi.lower().endswith(".tif") else vector.get_bbox_wgs84
matches = idx.find(bbox_wgs84=bbox_fn(params.roi))
print(f"{len(matches)} scenes found.")
for i, scene_match in enumerate(matches):
scenes/__init__.py
+ 1
− 1
  • View file @ 899ef8d9

  • Edit in single-file editor

  • Open in Web IDE


@@ -7,4 +7,4 @@ __version__ = "1.0.1"
from .core import load_scenes, save_scenes # noqa: 401
from .indexation import Index # noqa: 401
from .download import TheiaDownloader # noqa: 401
from .bbox import BoundingBox # noqa: 401
from .spatial import BoundingBox # noqa: 401
scenes/bbox.py deleted 100644 → 0
+ 0
− 40
  • View file @ 67619431

"""
This module provides the bounding box class.
"""
class BoundingBox:
"""
The bounding box class
"""
def __init__(self, xmin, xmax, ymin, ymax):
"""
Args:
xmin: Lower value on the x-axis
xmax: Higher value on the x-axis
ymin: Lower value on the y-axis
ymax: Higher value on the y-axis
"""
self.xmin = xmin
self.xmax = xmax
self.ymin = ymin
self.ymax = ymax
def union(self, other):
"""
Return a new bounding box resulting in the union of self and other
Args:
other: another bounding box
Returns:
a new bounding box
"""
return BoundingBox(xmin=min(self.xmin, other.xmin),
xmax=max(self.xmax, other.xmax),
ymin=min(self.ymin, other.ymin),
ymax=max(self.ymax, other.ymax))
def __str__(self):
return f"[{self.xmin}, {self.ymax}, {self.xmax}, {self.ymin}]"
scenes/core.py
+ 30
− 16
  • View file @ 899ef8d9

  • Edit in single-file editor

  • Open in Web IDE


@@ -6,11 +6,12 @@ import pickle
from abc import ABC, abstractmethod
import datetime
import pyotb
from scenes import utils
from scenes.vector import ogr_open
def save_scenes(scenes_list, pickle_file):
"""Use pickle to save scenes
"""
Use pickle to save scenes
Args:
scenes_list: a list of Scene instances
@@ -21,7 +22,8 @@ def save_scenes(scenes_list, pickle_file):
def load_scenes(pickle_file):
"""Use pickle to load scenes
"""
Use pickle to load scenes
Args:
pickle_file: pickle file
@@ -34,7 +36,8 @@ def load_scenes(pickle_file):
class Source(pyotb.Output):
"""Source class.
"""
Source class.
Holds common operations on image sources (e.g. drill, resample, extract an ROI, etc.)
Inherits from pyotb.Output
@@ -61,7 +64,8 @@ class Source(pyotb.Output):
self._app_stack = [] # list of otb applications or output to keep trace
def new_source(self, *args):
"""Return a new Source instance with new apps added at the end of the pipeline.
"""
Return a new Source instance with new apps added at the end of the pipeline.
Args:
*args: list of pyotb.app instances to append to the existing pipeline
@@ -75,7 +79,8 @@ class Source(pyotb.Output):
return Source(root_imagery=self.root_imagery, out=self._app_stack[-1], parent=self)
def drilled(self, msk_vec_file, inside=True, nodata=0):
"""Return the source drilled from the input vector data.
"""
Return the source drilled from the input vector data.
The default behavior is that the hole is made inside the polygon.
This can be changed setting the "inside" parameter to False.
@@ -89,7 +94,7 @@ class Source(pyotb.Output):
drilled source
"""
if utils.open_vector_layer(msk_vec_file):
if ogr_open(msk_vec_file):
# Vector data not empty
rasterization = pyotb.Rasterization({"in": msk_vec_file,
"im": self,
@@ -100,7 +105,8 @@ class Source(pyotb.Output):
return self # Nothing but a soft copy of the source
def masked(self, binary_mask, nodata=0):
"""Return the source masked from an uint8 binary raster (0 or 1..255).
"""
Return the source masked from an uint8 binary raster (0 or 1..255).
Pixels are set to "nodata" where the mask values are 0.
@@ -119,7 +125,8 @@ class Source(pyotb.Output):
return self.new_source(binary_mask, manage_nodata)
def resample_over(self, ref_img, interpolator="bco", nodata=0):
"""Return the source superimposed over the input image
"""
Return the source superimposed over the input image
Args:
ref_img: reference image
@@ -137,7 +144,8 @@ class Source(pyotb.Output):
return self.new_source(ref_img, superimpose)
def clip_over_img(self, ref_img):
"""Return the source clipped over the ROI specified by the input image extent
"""
Return the source clipped over the ROI specified by the input image extent
Args:
ref_img: reference image
@@ -152,7 +160,8 @@ class Source(pyotb.Output):
return self.new_source(ref_img, extract_roi)
def clip_over_vec(self, ref_vec):
"""Return the source clipped over the ROI specified by the input vector extent
"""
Return the source clipped over the ROI specified by the input vector extent
Args:
ref_vec: reference vector data
@@ -166,7 +175,8 @@ class Source(pyotb.Output):
"mode.fit.vec": ref_vec}))
def reproject(self, epsg, interpolator="bco"):
"""Reproject the source into the specified EPSG
"""
Reproject the source into the specified EPSG
Args:
epsg: EPSG (int)
@@ -185,7 +195,8 @@ class Source(pyotb.Output):
class Imagery(ABC):
"""Imagery class.
"""
Imagery class.
This class carry the base image source, and additional generic stuff common to all sensors imagery.
@@ -201,7 +212,8 @@ class Imagery(ABC):
class Scene(ABC):
"""Scene class.
"""
Scene class.
The class carries all the metadata from the scene, and can be used to retrieve its imagery.
The get_imagery() function is abstract and must be implemented in child classes.
@@ -225,7 +237,8 @@ class Scene(ABC):
@abstractmethod
def get_imagery(self, **kwargs):
"""Must be implemented in child classes.
"""
Must be implemented in child classes.
Args:
**kwargs: Imagery options
@@ -236,7 +249,8 @@ class Scene(ABC):
"""
def get_metadata(self):
"""Enable one instance to be used with print()
"""
Enable one instance to be used with print()
Returns:
metadata dict
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 Participants
Reference:
Source branch: index_search_vector

Menu

Explore Projects Groups Topics Snippets