Best way to pull 5000 km viewZenithMean raster for large area

I want to pull the 5000 km resolution values for viewZenithMean for an entire relative orbit for a specific date range. What is the best way to build that request?

I started on a python script, but before I go further I figured I would check to see if I am on the right track:

bbox = BBox(bbox=[-95.83, 46.20, -89.74, 48.95], crs=CRS.WGS84)

VIEW_ZENITH_EVALSCRIPT = """
//VERSION=3

function setup() {
  return {
    input: [{bands: ["viewZenithMean"]}],
    output: {id: "default", bands: 1, sampleType: "UINT16"}
  };
}

function evaluatePixel(sample) {
  return [sample.viewZenithMean];
}
"""

preview_request = SentinelHubRequest(
    evalscript=VIEW_ZENITH_EVALSCRIPT,
    data_folder='/tmp/mosaic_tests',
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.SENTINEL2_L2A,
            time_interval=['2020-07-13', '2020-07-13']
        )
    ],
    responses=[
        SentinelHubRequest.output_response('default', MimeType.TIFF)
    ],
    bbox=bbox,
    size=(512, get_image_dimension(bbox=bbox, width=512)), # would like to resample to 120m eventually
    config=config
)

You are most definitely on the right track! A few comments:

  • I see you edited the sampleType from AUTO to UINT16 (good call). The source format of the angular bands is FLOAT32, so UINT16 will round the values, but it all depends on the precision you need.

  • The default mosaicking parameter is SIMPLE. This means that the mosaicked image is flattened so only a single sample is passed to evaluation. You can get away with this option at mid-latitudes with a narrow time-frame, such as your example. It would be more robust to use the ORBIT option, since you are interested in a specific orbit. With ORBIT, the mosaicked image is flattened for each orbit so that there is only one sample per pixel per orbit. You could try this evalscript:

//VERSION=3

function setup() {
  return {
    input: [{bands: ["viewZenithMean"]}],
    output: {id: "default", bands: 1, sampleType: "UINT16"},
    mosaicking: "ORBIT"
  };
}

function evaluatePixel(sample) {
  // return a single orbit
  return [sample[0].viewZenithMean];
}

  • One of your comments says: “would like to resample to 120m eventually”. Below is one method with sentinelhub-py to control the size based on a resolution:
resolution = 120  # Resolution in meters
bbox = BBox(bbox=[-95.83, 46.20, -89.74, 48.95], crs=CRS.WGS84)
im_size = bbox_to_dimensions(bbox, resolution=resolution)

Then just pass the im_size variable to size.