OpenTopography/RiverREM

Reading DEM from a URL (S3) hosted COG

Closed this issue · 1 comments

Thanks for a great package!
I tried to read a file from a URL ,as supported by rasterio. I can confirm I can access the file via plain rasterio.

When providing RiverREM with the URL input, it results in :

File ~/.conda/envs/river_rem/lib/python3.10/site-packages/riverrem/REMMaker.py:136, in REMMaker.dem(self, dem)
    133 @dem.setter
    134 def dem(self, dem):
    135     if not os.path.exists(dem):
--> 136         raise FileNotFoundError(f"Cannot find input DEM: {dem}")
    137     self._dem = dem
    138     return

Possibly allowing to pass in a URL (checking if a URL exists as below firs, maybe) may solve this:

import requests
def isvalid(url):
	return requests.head(url).status_code < 400

Thank you for the suggestion!

I have released an update (v1.0.4) to fix this issue so that now DEMs (or optional custom centerline inputs) can be input as URLs instead of local file paths.