Skip to content

Commit 44a33f0

Browse files
author
Emma Ai
committed
remote vector file validation
1 parent 837dfae commit 44a33f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

odc/stats/plugins/lc_level34.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import numpy as np
88
import xarray as xr
9-
import os
109

1110
from ._registry import StatsPluginInterface, register
1211
from ._utils import rasterize_vector_mask
12+
from osgeo import gdal
1313

1414
from .l34_utils import (
1515
l4_water_persistence,
@@ -46,7 +46,9 @@ def __init__(
4646
super().__init__(**kwargs)
4747
if urban_mask is None:
4848
raise ValueError("Missing urban mask shapefile")
49-
if not os.path.exists(urban_mask):
49+
50+
file_metadata = gdal.VSIStatL(urban_mask)
51+
if file_metadata is None:
5052
raise FileNotFoundError(f"{urban_mask} not found")
5153

5254
if filter_expression is None:

0 commit comments

Comments
 (0)