Empty images when requesting Sentinel 1 (before failure )

Hello,

I want to access sentinel-1 images but for some reason I get blank image.
I use time interval before the failure (23/12/21).

This is my evalscript:

evalscript_sen1 = """
//VERSION=3

function setup() {
  return {
    input: ["VV","VH"],
    output: { bands: 2 },
    sampleType:"FLOAT32"
  };
}


function evaluatePixel(sample) {
  return [10 * Math.log((sample.VV)+0.0001) / Math.LN10 , 10 * Math.log((sample.VH)+0.0001) / Math.LN10];
}
"""


Then I have list of dates (which I generated with wms get dates functuin). I run this dates list in order to access the images by date, but all I get is blank image:


    #get dates
    wms_s1= WmsRequest(
        data_collection=DataCollection.SENTINEL1_IW,
        data_folder='fake',
        layer='BANDS-S1-IW',
        bbox=bbox,
        time=time_interval,
        width=bbox_size[0],
        height=bbox_size[1],
        image_format=MimeType.TIFF,
        time_difference=datetime.timedelta(hours=2),#get one image when there is small time differences between them
        config=config
    )
    
    dates_s1_wms=  wms_s1.get_dates()
    dates_s1=[]    
    for t in dates_s1_wms:
        new_date=t.date().strftime('%Y-%m-%d')
        dates_s1.append(new_date)
        
    for d in dates_s1:
        
        request = SentinelHubRequest(
            evalscript=evalscript_sen1,
            input_data=[
                SentinelHubRequest.input_data(
                    data_collection=DataCollection.SENTINEL1_IW,          
                    time_interval=time_interval,          
                    other_args={"dataFilter": {"mosaickingOrder": "mostRecent","resolution": "HIGH"},"processing": {"backCoeff": "GAMMA0_TERRAIN","orthorectify": True,"demInstance": "MAPZEN","upsampling": "BICUBIC","downsampling": "BICUBIC"}}
                ),
            ],
            responses=[
        SentinelHubRequest.output_response('default', MimeType.TIFF),
            ],
            bbox=bbox,
            size=bbox_size,
            config=config
        )
        
        response = request.get_data() 


        plt.imshow(response[0][:,:,1])
        
        plt.show()

When i plot the response I get blank image:
image

I couldn’t find yet where is the mistake, could you please help me to understand where is the problem?

Best

Reut

Hi @reutkeller

I believe there are two possible issues:
a) your requests are all done using time_interval (input_data parameter of the SentinelHubRequest), while they should use date from wms
b) when you parse date from get_dates(), you take away just date (year-month-day), so your SentinelHubRequest should reflect that, in pseudocode: time_interval = [d, d+1 day])

I’ve tweaked a bit your snippet, so that CatalogAPI is used instead of WMS (to get available dates), and uses utility function to parse dates:

from sentinelhub import (
    BBox, CRS, Geometry,
    SentinelHubRequest, DataCollection,
    SentinelHubCatalog, 
    MimeType,
    parse_time, bbox_to_dimensions, to_utm_bbox
)

import matplotlib.pyplot as plt
import datetime as dt

time_interval = dt.date(2021,12,15), dt.date(2021,12,31)

catalog = SentinelHubCatalog(config=config)

tiles = list(catalog.search(
    collection=DataCollection.SENTINEL1_IW,
    time=time_interval,
    bbox=bbox
))

dates = [parse_time(t['properties']['datetime']) for t in tiles]

n_cols = 3
n_rows = len(dates)//n_cols

fig, axes = plt.subplots(ncols=n_cols, nrows=n_rows, figsize=(n_cols*8, n_rows*8))

for date, ax in zip(dates, axes.flatten()):
    request = SentinelHubRequest(
        evalscript=evalscript_sen1,
        input_data=[
            SentinelHubRequest.input_data(
                data_collection=DataCollection.SENTINEL1_IW,          
                time_interval=date,          
                other_args={"dataFilter": {"mosaickingOrder": "mostRecent","resolution": "HIGH"},"processing": {"backCoeff": "GAMMA0_TERRAIN","orthorectify": True,"demInstance": "MAPZEN","upsampling": "BICUBIC","downsampling": "BICUBIC"}}
            ),
        ],
        responses=[SentinelHubRequest.output_response('default', MimeType.TIFF),],
        bbox=bbox,
        size=bbox_to_dimensions(bbox, 40)
    )

    response = request.get_data()[0]
    ax.imshow(response[:,:,0])
    ax.set_title(d.isoformat())

Using your evalscript, this is what I get:

(The first image has data only in the top left corner; if you add dataMask to your evalscript you’d be able to see where data is available clearly.)

1 Like

Thank you for your answer!
for soe reason/ I keep getting the error

ValueError: Configuration parameters ‘sh_client_id’ and ‘sh_client_secret’ have to be set in order to authenticate with Sentinel Hub service

so I can’t really run this. this is despite definning these keys at the beginning (and it works when I run the first problematic script with data fusion script)

Do you have any idea why would it happen?

thank you a lot for your answer :slight_smile:
Reut

Try passing config to SentinelHubRequest like you did in your snippet. I see it is missing in my snippet.

now it runs but still getting blank images:

image

Edited:
just to add mroe information : when I retrieve the tile and click on the thumbnail link it display an image, so seems like the tile is there , but I can’t put the finger on why the respond is an empty array.

I don’t know. My suggestion would be to try with some other evalscript, or add dataMask, just to make sure there is data in your bounding box (e.g. you are not on the border of the orbit).

with other evalscript it works (fusion data between sentinel 1 and 2) . very weird