Commit e58b90d1 authored by Julien Michel's avatar Julien Michel
Browse files

BUG: Avoid trying to read SRTM files that do not exist

parent ee65853f
......@@ -5,6 +5,7 @@
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
import os
import numpy as np
import rasterio as rio
import xarray as xr
......@@ -136,6 +137,8 @@ class SRTM:
def __build_hgt(self,
tiles: List[SRTMTileId]) -> Tuple[np.ndarray, rio.Affine]:
file_names = [f"{self.base_dir}/{t.name()}.hgt" for t in tiles]
# Screen unavailable tiles
file_names = [f for f in file_names if os.path.isfile(f)]
return merge(file_names) # type: ignore
def read_as_numpy(
......
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