Commit 8b963bb3 authored by Cresson Remi's avatar Cresson Remi
Browse files

ADD: use get_bbox_wgs84_from_raster()

1 merge request!19ADD: BoundinBox class
Pipeline #34484 passed with stages
in 2 minutes and 21 seconds
Showing with 5 additions and 11 deletions
+5 -11
...@@ -13,7 +13,7 @@ parser.add_argument("--day", type=int, default=1) ...@@ -13,7 +13,7 @@ parser.add_argument("--day", type=int, default=1)
params = parser.parse_args() params = parser.parse_args()
# Get all scenes in the root_dir # Get all scenes in the root_dir
_, _, bbox = utils.get_epsg_extent_bbox(params.refimage) bbox = utils.get_bbox_wgs84_from_raster(params.refimage)
acq_date = datetime.datetime(year=params.year, month=params.month, day=params.day) acq_date = datetime.datetime(year=params.year, month=params.month, day=params.day)
downloader = TheiaDownloader(config_file=params.theia_cfg) downloader = TheiaDownloader(config_file=params.theia_cfg)
downloader.download_closest(bbox_wgs84=bbox, acq_date=acq_date, download_dir=params.download_dir) downloader.download_closest(bbox_wgs84=bbox, acq_date=acq_date, download_dir=params.download_dir)
import argparse import argparse
import gdal
from scenes import utils, Index from scenes import utils, Index
# Arguments # Arguments
...@@ -17,12 +16,9 @@ idx = Index(scenes) ...@@ -17,12 +16,9 @@ idx = Index(scenes)
# search # search
print("search roi") print("search roi")
if params.roi.lower().endswith(".tif"): bbox_fn = utils.get_bbox_wgs84_from_raster if params.roi.lower().endswith(".tif") \
gdal_ds = gdal.Open(params.roi) else utils.get_bbox_wgs84_from_vector
bbox = utils.get_bbox_wgs84_from_gdal_ds(gdal_ds=gdal_ds) matches = idx.find(bbox_wgs84=bbox_fn(params.roi))
else:
bbox = utils.get_bbox_wgs84_from_vector(params.roi)
matches = idx.find(bbox_wgs84=bbox)
print("{} scenes found.".format(len(matches))) print("{} scenes found.".format(len(matches)))
#for scene_match in matches: #for scene_match in matches:
# print(scene_match) # print(scene_match)
import argparse import argparse
import gdal
import pyotb import pyotb
from scenes import utils, Index from scenes import utils, Index
from scenes.spot import get_spot67_scenes from scenes.spot import get_spot67_scenes
...@@ -20,8 +19,7 @@ idx = Index(scenes) ...@@ -20,8 +19,7 @@ idx = Index(scenes)
# search # search
print("search roi") print("search roi")
gdal_ds = gdal.Open(params.roi) bbox = utils.get_bbox_wgs84_from_raster(params.roi)
bbox = utils.get_extent_wgs84(gdal_ds)
matches = idx.find(bbox_wgs84=bbox) matches = idx.find(bbox_wgs84=bbox)
print("{} scenes found.".format(len(matches))) print("{} scenes found.".format(len(matches)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment