Interpolated time-series


We are trying to run your example evalscript to create interpolated time-series images.

Could you help us understand what bands_array_size and bands_array_n variables are? They create an inner-loop that names the outputs as B01_0 through B01_3 - these are driven by the bands_array_n variable (which we think is calculated as 4 in the example).

The output response in the SentinelHubRequest example is described as ‘B01’, and so doesn’t match the output described in the evalscript, and it fails with a “Output B01 requested but missing from function setup()" error.


1 Like

Hi @hughst !

Thanks for trying out the example and sorry for the issues with poorly named variables.

The idea in this script was to not put all the 36 timestamps in a single tiff, but to chunk the output in quarters. The bands_array_size should actually be named bands_chunk_size (or something more intuitive) and tells how many timestamps will be in a specific chunk. The bands_array_n is calculated from the amount of timestamps in the time series and from the provided bands_array_size parameter.

The other issue, as you’ve pointed out, is in the API, where these separate chunks have to be requested. Let me drop you some Python snippets how to generate the necessary info for the SentinelHubRequest:

import pandas as pd

n_timestamp = 36
bands = ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B11", "B12", "QM"]
dates = pd.date_range("2020-01-01", "2021-01-01", periods=n_timestamp + 1)[:-1].round("D").date

old_dict = { b: dates for b in bands }
new_dict = {}
n_timestamp_in_chunk = 9  # same as bands_array_size
for band, timestamps in old_dict.items():
    for idx, ts in enumerate(timestamps):
        col_name = f"{band}_{j // n_timestamp_in_chunk}"
        if col_name not in new_dict:
            new_dict[col_name] = []

The old_dict has bands for keys and the full timestamp array for values, while the new_dict is similar, it is split in chunks. The new_dict can then be used to construct the response in the request:

request = SentinelHubRequest(
    responses=[SentinelHubRequest.output_response(band_chunk, MimeType.TIFF) for band_chunk in new_dict.keys()],

Hope this helps! Don’t hesitate to ask if there are some further problems.