Skip to content

Commit 19ebc82

Browse files
committed
Change generate-DEM-gpkg
1 parent fdfa999 commit 19ebc82

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

s1tiling/resources/generate-gpkg/generate-DEM-gpkg.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import sys
4343
from typing import NoReturn
4444
from osgeo import ogr
45-
45+
import os
4646

4747
def _die(message: str) -> NoReturn:
4848
print(message, file=sys.stderr)
@@ -108,9 +108,13 @@ def select_columns(input_path, output_path, columns_to_keep) -> None:
108108
print(CellID)
109109
latitudeID = CellID[0:3]
110110
longitudeID = CellID[3:]
111+
fileID=f"Copernicus_DSM_10_{latitudeID}_00_{longitudeID}_00/DEM/Copernicus_DSM_10_{latitudeID}_00_{longitudeID}_00_DEM.tif"
112+
if not os.path.exists(os.path.join(pathDEM,fileID)):
113+
_die(f"{fileID!r} does not exist")
114+
111115
output_feature.SetField(
112116
"FileID",
113-
f"{longitudeID}/Copernicus_DSM_10_{latitudeID}_00_{longitudeID}_00/DEM/Copernicus_DSM_10_{latitudeID}_00_{longitudeID}_00_DEM.tif"
117+
fileID
114118
)
115119

116120
output_feature.SetGeometry(feature.GetGeometryRef())
@@ -125,10 +129,13 @@ def select_columns(input_path, output_path, columns_to_keep) -> None:
125129

126130

127131
# Chemin vers le fichier GPKG d'entrée
128-
input_file = "/work/scratch/data/koleckt/s1tiling-dev/s1tiling/s1tiling/resources/generate-gpkg/GEO1988-CopernicusDEM-RP-002_GridFile_I4.0_ESA.gpkg"
132+
input_file = "/home/il/koleckt/s1tiling/s1tiling/resources/generate-gpkg/GEO1988-CopernicusDEM-RP-002_GridFile_I6.0_ESA.gpkg"
129133

130134
# Chemin vers le fichier GPKG de sortie
131-
output_file = "/work/scratch/data/koleckt/s1tiling-dev/s1tiling/s1tiling/resources/generate-gpkg/CopernicusDEM-CNES.gpkg"
135+
output_file = "/home/il/koleckt/s1tiling/s1tiling/resources/shapefile/CopernicusDEM2023-CNES.gpkg"
136+
137+
# Chemin du DEM
138+
pathDEM="/work/datalake/static_aux/MNT/COP-DEM_GLO-30-DGED_2023_1"
132139

133140
# List of fields/columns to keep from the input dataset
134141
columns_to_keep = {"GeoCellID"}

0 commit comments

Comments
 (0)