Guest User

Untitled

a guest
May 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. with rasterio.open(final_list[0]) as src0:
  2. meta = src0.meta
  3.  
  4. with rasterio.open('stack.tif', 'w', **meta) as dst:
  5. for id, layer in enumerate(final_list):
  6. with rasterio.open(layer) as src1:
  7.  
  8. #the .astype(rasterio.int16) forces dtype to int16
  9. dst.write_band(id + 1, src1.read(1).astype(rasterio.int16))
  10.  
  11. ...
  12. Metadata:
  13. AREA_OR_POINT=Area
  14. Image Structure Metadata:
  15. ...
  16. Band 1 Block=3596x1 Type=Int16, ColorInterp=Gray
  17. NoData Value=-9999
  18. Band 2 Block=3596x1 Type=Int16, ColorInterp=Undefined
  19. NoData Value=-9999
  20. ...
  21.  
  22. ...
  23. Metadata:
  24. Band_1=Band 1 Reflectance
  25. Band_2=Band 2 Reflectance
  26. Band_3=Band 3 Reflectance
  27. Band_4=Band 4 Reflectance
  28. Band_5=Band 5 Reflectance
  29. Band_6=Band 7 Reflectance
  30. Band_7=Band 6 Temperature
  31. Band_8=Fmask
  32. Image Structure Metadata:
  33. ...
  34. Band 1 Block=300x1 Type=Int16, ColorInterp=Undefined
  35. NoData Value=-9999
  36. Band 2 Block=300x1 Type=Int16, ColorInterp=Undefined
  37. NoData Value=-9999
  38. ...
Add Comment
Please, Sign In to add comment