SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import gdal
  3. import matplotlib.pyplot as plt
  4.  
  5. dataset2 = gdal.Open('/Users/SPH_1_RGB.tif')
  6. band_1 = dataset2.GetRasterBand(1).ReadAsArray()
  7. band_2 = dataset2.GetRasterBand(2).ReadAsArray()
  8. band_3 = dataset2.GetRasterBand(3).ReadAsArray()
  9. array_RGB = np.dstack((band_1, band_2, band_3))
  10. fig = plt.figure(1)
  11. ax1 = fig.add_axes([0.0, 0.0, 0.89, 1.0])
  12. ax1.imshow(array_RGB)
  13. plt.xticks(())
  14. plt.yticks(())
  15.  
  16. # [left, bottom, width, height]
  17. ax2 = fig.add_axes([0.0, 0.0, 0.89, 1.0])
  18. ax2.set_title('Chlorophyll_a')
  19. dataset = gdal.Open('/Users/SPH_1_Grayscale.tif')
  20. band = dataset.GetRasterBand(1)
  21. array0 = band.ReadAsArray(0, 0, band.XSize, band.YSize)
  22. array_Gray = np.ma.masked_where(array0 == 0.0, array0)
  23. im = ax2.imshow(array_Gray, interpolation='nearest', cmap='jet')
  24.  
  25. cbaxes = fig.add_axes([0.9, 0.25, 0.02, 0.5])
  26. cbar = plt.colorbar(im, orientation="vertical", cax=cbaxes)
  27. plt.xticks(())
  28. plt.yticks(())
  29. plt.savefig('/Users/SPH_1_Overlap.jpg', dpi=300, bbox_inches='tight')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top