How do I create a cloud free image in the custom script section of EO browser

I need to create a simple cloud free image in the EO browser GUI. is this possible, could I please get some example code

You can adapt the code from our custom scripts repository in EO Browser.

For this you would change the output sample type to UINT8 for visualisation purposes. You also need to set a time-span to cover the period that you would like to cover. In terms of outputs of the evaluatePixel function, you should multiply the reflectance bands by 255 to convert to UINT8 and I also recommend adding a brightening factor for better visualisation.

Here is a minimal working example for you to start from:

Yes because you need to modify the script with the different points I indicated in my previous post (converting sampleType). You shouldn’t get a black screen with my example (second link) however.

1 Like

This works great, thank you. Any ideas on how I can change tweak this to get perfect pixel? my AOI is incredibly cloudy and even with the cloud free mosaic there seems to be a few clouds. AOI

This is a common issue with areas that are cloudy, indeed! Off the top of my head, you could either:

  • try to enlarge the time-span of your request to get more chances of getting cloud-free images (if that makes sense in your case): in EO Browser, you would need to change the time-span (date range), but also line 27 in the Evalscript which is configured for 3 months (the first number corresponds to how many months you consider in the past):
    return orbitDateFrom.getTime() >= ( - 3 * 31 * 24 * 3600 * 1000);

  • try a different method for selecting the pixels in the mosaic: in the current script you are using, the getValue function fetches the first quartile of pixels in the time-series that are sorted from darkest to brightest. Maybe play around with this and fetch the darkest pixel?

This is brilliant thank you so much

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.