|
9 | 9 | import asf_search
|
10 | 10 | from boto3 import client
|
11 | 11 | from s1_orbits import fetch_for_scene
|
12 |
| -from shapely.geometry import Polygon, shape |
| 12 | +from shapely.geometry import shape |
| 13 | +from shapely.geometry.base import BaseGeometry |
13 | 14 |
|
14 | 15 |
|
15 | 16 | S3 = client('s3')
|
@@ -115,7 +116,7 @@ def get_earthdata_credentials() -> tuple[str, str]:
|
115 | 116 | )
|
116 | 117 |
|
117 | 118 |
|
118 |
| -def download_raw_granule(granule_name: str, output_dir: Path, unzip: bool = False) -> tuple[Path, Polygon]: |
| 119 | +def download_raw_granule(granule_name: str, output_dir: Path, unzip: bool = False) -> tuple[Path, BaseGeometry]: |
119 | 120 | """Download a S1 granule using asf_search. Return its path
|
120 | 121 | and buffered extent.
|
121 | 122 |
|
@@ -155,26 +156,6 @@ def download_raw_granule(granule_name: str, output_dir: Path, unzip: bool = Fals
|
155 | 156 | return out_path, bbox
|
156 | 157 |
|
157 | 158 |
|
158 |
| -def get_bbox(granule_name: str) -> tuple[Path, Polygon]: |
159 |
| - """Get the buffered extent from asf_search. |
160 |
| -
|
161 |
| - Args: |
162 |
| - granule_name: Name of the granule to download |
163 |
| -
|
164 |
| - Returns: |
165 |
| - bbox: the buffered extent polygon |
166 |
| - """ |
167 |
| - granule_name = granule_name.split('.')[0] |
168 |
| - |
169 |
| - if not granule_name.endswith('-RAW'): |
170 |
| - granule_name += '-RAW' |
171 |
| - |
172 |
| - result = asf_search.granule_search([granule_name])[0] |
173 |
| - bbox = shape(result.geojson()['geometry']) |
174 |
| - |
175 |
| - return bbox |
176 |
| - |
177 |
| - |
178 | 159 | def download_orbit(granule_name: str, output_dir: Path) -> Path:
|
179 | 160 | """Download a S1 orbit file. Prefer using the ESA API,
|
180 | 161 | but fallback to ASF if needed.
|
|
0 commit comments