Skip to main content

Hi. I’m new to python and EO so this could be a novice thing. I’m trying to learn about land changes. I am working on an image of a piece of land. I have a S2A all bands time-series of that piece of land shot at 10 different dates. I would like to know if s2cloudless can be used to generate cloud masks for each of those pictures? I tried understanding the example program but failed to read the images in the right way. Maybe this is novice but I couldn’t get how to import images the way it has been done using .get_data() from a local directory. Any help would be greatly appreciated. Thank you!

Any help please? 😦


Hi @prateek,


With a bit of additional coding, it is possible to perform s2cloudless on Sentinel-2 tiles. Have a look at the code in this thread for details: https://github.com/sentinel-hub/sentinel2-cloud-detector/issues/1


Thanks for the reply, @maleksandrov. This post helped me in reading the TCI images in a numpy array.


I used below code to reach until plotting previews (line 13) in the example notebook. It plotted the images but I could be wrong (fingers crossed):


`tciList = glob.glob(“C:/Name/Sentinel_2a/timeseries/TCI.png”)


tciPicArray = np.array(rnp.array(Image.open(img)) for img in tciList])


def plot_previews(data, cols=4, figsize=(15, 15)):


rows = data.shapeh0] // cols + (1 if data.shapeh0] % cols else 0)
fig, axs = plt.subplots(nrows=rows, ncols=cols, figsize=figsize)
for index, ax in enumerate(axs.flatten()):
if index < data.shapeh0]:
caption = index
ax.set_axis_off()
ax.imshow(datadindex] / 255., vmin=0.0, vmax=1.0)
ax.text(0, -2, caption, fontsize=12, color='g')
else:
ax.set_axis_off()

plot_previews(tciPicArray, cols = 2, figsize = (200,200))`


I would like to know how I can perform lines 14, 15 and 16 in example notebook for all the other bands. My time-series folder contains 512x512 pixels images in “band-dd-mm-yyyy.png” format. I have all the other band images.


Thanks in advance for your help. I know this could be something easy but I just can’t bring myself to understand the format in which AWS returns the data so that I can replicate it in my code.


Thank you!


Hi Prateek,


Have you solved this problem. I have the same problem while using s2cloudless. Could you please help me with that if you have figured it out? Thanks!


Reply