Skip to main content

I am trying to do a moisture forecast using sentinel-2 for an area of interest and I’d like to get all observations from a certain data range.


Here is my current approach:


  1. I define mosaicking as TILE in my evalscript

  2. for each week, I get the image with max cloud cover less than 0.4

I get several no data images which are dark. I know this is quite expected, but is there alternate way to get all observations for the same AOI and flag the cloudy ones. This is quite important for monitoring a particular FOI.


I took a look at the area monitoring article, but the method to retrieve images are not clear to me. It would be great if you can offer my any insights on this. If I am correct, the use a similar approach like mine as well.

Hi,

Yes this sounds like expected behaviour especially in cloudier areas of the world, some weeks you will not receive an Sentinel-2 image that is not cloudy. You can request all the observations without a maximum cloud coverage but as you said you then wish to flag the images that are “cloudy”.

One approach to doing this would be to use Catalog API. For the Sentinel-2 L2A data collection, there is a property named eo:cloud_cover that returns the cloud percentage. You could use this property as a way to flag the images that are too cloudy to use.

You can also do this in your evalscript with the following:

function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = { "tiles": scenes.tiles }
}

This will return something like this:

{"tiles":e{"date":"2018-12-27T10:08:07Z","shId":563038,"cloudCoverage":54.68,"tileOriginalId":"S2B_OPER_MSI_L2A_TL_MPS__20181227T125927_A009443_T33TUL_N02.11","__idx":0,"dataPath":"s3://sentinel-s2-l2a/tiles/33/T/UL/2018/12/27/0"},{"date":"2018-12-27T10:08:03Z","shId":562930,"cloudCoverage":33.68,"tileOriginalId":"S2B_OPER_MSI_L2A_TL_MPS__20181227T125927_A009443_T33TVL_N02.11","__idx":1,"dataPath":"s3://sentinel-s2-l2a/tiles/33/T/VL/2018/12/27/0"},{"date":"2018-12-27T10:07:52Z","shId":562880,"cloudCoverage":7.81,"tileOriginalId":"S2B_OPER_MSI_L2A_TL_MPS__20181227T125927_A009443_T33TUM_N02.11","__idx":2,"dataPath":"s3://sentinel-s2-l2a/tiles/33/T/UM/2018/12/27/0"},{"date":"2018-12-27T10:07:48Z","shId":562939,"cloudCoverage":0.07,"tileOriginalId":"S2B_OPER_MSI_L2A_TL_MPS__20181227T125927_A009443_T33TVM_N02.11","__idx":3,"dataPath":"s3://sentinel-s2-l2a/tiles/33/T/VM/2018/12/27/0"}]`

From this you can get the cloud coverage percentage and choose a percentage to flag the acquisitions that you are interested in.

If there is more I can clarify, let us know!


Hi, thanks for the quick response. I am actually not sure if my approach returns all the observations. Should I use the function preProcessScenes do get all observations?

Is there an example to use Catalog api with the sentinel-hub python API. Also, if you have an example fo retrieving all observations for an FOI similar to area monitoring project, it would be great.

Also, does the cloudcoverage percentage applicable to the AOI or to the entire TILE?


Hi,

  1. The cloud coverage percentage is applicable to the entire Tile, and not the AOI.
  2. Yes, I would recommend using the preProcessScenes function to retrieve all the cloud coverage percentages for the scenes that you are requesting.
  3. In regards to getting all the data, I think you should be okay with using TILE mosaicking but I would recommend reading through the documentation on this here. There are also a few examples in this section too, showing how you can utilise the preProcessScenes function.
  4. If you don’t insert any filters Catalog API will retrieve all observations for your selected AOI and time period. For example, I made this example in Request Builder:
from sentinelhub import SentinelHubCatalog, BBox, Geometry, SHConfig, CRS, DataCollection

# Credentials
config = SHConfig()
config.sh_client_id = '<your client id here>'
config.sh_client_secret = '<your client secret here>'
config.sh_base_url = 'https://services.sentinel-hub.com'

catalog = catalog = SentinelHubCatalog(config=config)

bbox = BBox(bbox=x12.44693, 41.870072, 12.541001, 41.917096], crs=CRS.WGS84)

search_iterator = catalog.search(
DataCollection.SENTINEL2_L2A,
bbox=bbox,
time=('2023-04-11', '2023-05-11'),
)

results = list(search_iterator)

This will return all your acquisitions in JSON format for your AOI and time range. The above request will be limited to 10 returns, and it is recommended that you loop this function as the API won’t be able to handle requesting and returning large numbers of metadata records.

If you need any further assistance then let us know 👍


Thanks  , I made it work! Thanks for the help. However, I am not sure if I need to use mosaicking to get single acquisitions right?


Hi,

If you are only requesting a single acquisition in a request, then SIMPLE mosaicking is your best option. You only need to use TILE or ORBIT if your response is more than one acquisition or is a product using more than one acquisition.


Reply