Abhisek92

add_crs.py

Sep 12th, 2021 (edited)
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from pathlib import Path
  2. import rasterio as rio
  3. from tqdm import tqdm
  4.  
  5. src_path = Path('multispectral_path')
  6. tiles_dir = Path("path/Tiles")
  7.  
  8. with rio.open(src_path, 'r') as src:
  9.     crs = src.meta['crs']
  10. for fp in tqdm(list(tiles_dir.glob("*.tif"))):
  11.     with rio.open(fp, 'r+') as tile:
  12.         tile.crs = crs
Add Comment
Please, Sign In to add comment