Created
May 5, 2022 08:28
-
-
Save tastatham/7305dc8f8ea5dc51da3c227fa92ed9d4 to your computer and use it in GitHub Desktop.
A list of functions for rioxarray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list_tifs(path): | |
import glob | |
tifs = [] | |
for p in glob.glob(f"{path}/*/**/*.tif", recursive=True): | |
t = p | |
if "_HS_" not in t: | |
tifs.append(t) | |
return tifs | |
def merge_tifs(tifs): | |
from rioxarray import open_rasterio, merge | |
elems = [] | |
for val in tifs: | |
rds = open_rasterio(val) | |
elems.append(rds) | |
return merge.merge_arrays(elems) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment