Skip to content

Commit

Permalink
Merge pull request #66 from WorldCereal/develop
Browse files Browse the repository at this point in the history
Prepare 0.6.2 release
  • Loading branch information
Fahdben authored Jan 31, 2022
2 parents 1f6f3dc + b5ae519 commit 6961bee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ewoc_dag/bucket/creodias.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def download_s2_prd(
Returns:
Path: Path to the S2 product
"""
out_dirpath = out_dirpath / prd_id.split(".")[0]
out_dirpath = out_dirpath / prd_id
out_dirpath.mkdir(exist_ok=True)
s2_prd_info = S2PrdIdInfo(prd_id)
s2_bucket_prefix = "Sentinel-2/MSI/"
Expand Down
21 changes: 16 additions & 5 deletions src/ewoc_dag/srtm_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
""" DAG for SRTM 1s and 3s tiles
"""
import logging
import zipfile
from pathlib import Path
from typing import List
import zipfile

import requests
from eotile.eotile_module import main

from ewoc_dag.bucket.creodias import CreodiasBucket
from ewoc_dag.bucket.ewoc import EWOCAuxDataBucket


logger = logging.getLogger(__name__)


Expand All @@ -26,9 +25,11 @@ def get_srtm_from_s2_tile_id(
:param source: Source where to retrieve the srtm 1s data
:param resolution: 1s or 3s for respectively 30m and 90m srtm
"""
get_srtm_tiles(
get_srtm1s_ids(s2_tile_id), out_dirpath, source=source, resolution=resolution
)
if resolution == "1s":
srtm_tile_ids = get_srtm1s_ids(s2_tile_id)
elif resolution == "3s":
srtm_tile_ids = get_srtm3s_ids(s2_tile_id)
get_srtm_tiles(srtm_tile_ids, out_dirpath, source=source, resolution=resolution)


def get_srtm_tiles(
Expand Down Expand Up @@ -111,3 +112,13 @@ def get_srtm1s_ids(s2_tile_id: str) -> List[str]:
"""
res = main(s2_tile_id, dem=True, overlap=True, no_l8=True, no_s2=True)
return list(res[2].id)


def get_srtm3s_ids(s2_tile_id: str) -> List[str]:
"""
Get srtm 3s id for an S2 tile
:param s2 tile_id:
:return: List of srtm ids
"""
res = main(s2_tile_id, srtm5x5=True, overlap=True, no_l8=True, no_s2=True)
return list(res[3]["id"].values)

0 comments on commit 6961bee

Please sign in to comment.