Skip to content

Instantly share code, notes, and snippets.

@csaybar
Last active December 2, 2021 19:06
Show Gist options
  • Save csaybar/061bf67a6410b84f37718f6fd31cca3f to your computer and use it in GitHub Desktop.
Save csaybar/061bf67a6410b84f37718f6fd31cca3f to your computer and use it in GitHub Desktop.
sen2cloud dataset
import numpy as np
import matplotlib.pyplot as plt
# OBS landuse100 and landuse10, wrong values due to int16 conversion mistake.
s2folder = "/media/csaybar/Elements/minicloudsen12/point_0290/20190812T222541_20190812T222624_T59GNM"
S2L1C = np.load(f"{s2folder}/input.npy")
S2L1C_bands = ["B1", "B2", "B3","B4", "B5", "B6", "B7","B8", "B8A", "B9", "B10", "B11", "B12","VH", "VV", "angle", "CDI", "cloudshadow_direction", "elevation", "landuse100"]
S2L2A = np.load(f"{s2folder}/input2.npy")
S2L2A_bands = ["B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B8A", "B9", "B11", "B12","AOT", "WVP", "TCI_R", "TCI_G", "TCI_B", "landuse10"]
# simple viz
fig, (ax1, ax2) = plt.subplots(1, 2)
S2L1C_RGB = np.swapaxes(S2L1C[1:4,:,:][::-1,:,:], 0, 2)/10000
ax1.imshow(S2L1C_RGB)
ax1.set_title("S2 - L1C")
S2L2A_RGB = np.swapaxes(S2L2A[1:4,:,:][::-1,:,:], 0, 2)/10000
ax2.imshow(S2L2A_RGB)
ax2.set_title("S2 - L2A")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment