admin管理员组

文章数量:1122817

I'm trying to extract a Sentinel-2 L2A dataset containing RGB images, in the span of some years, following this documentation: .html#process-api

My specifications are as follows:

  • Spatial resolution: 16m/pixel
  • RGB channels

Since the main focus lies on these 2 parameters, the following lines of code are of interest:

  • Firstly the part where the bands and satellite are specified
def get_true_color_request(time_interval, bbox, size, config):

    evalscript_true_color = """
    //VERSION=3

    function setup() {
        return {
            input: [{
                bands: ["B02", "B03", "B04"]
            }],
            output: {
                bands: 3
            }
        };
    }

    function evaluatePixel(sample) {
        return [sample.B04, sample.B03, sample.B02];
    }
     """
    return SentinelHubRequest(
        evalscript=evalscript_true_color,
        input_data=[
            SentinelHubRequest.input_data(
                data_collection=DataCollection.SENTINEL2_L2A.define_from(
                    "s2l2a", service_url=config.sh_base_url
                ),
                time_interval=time_interval,
                mosaicking_order=MosaickingOrder.LEAST_CC
            )
        ],
        responses=[SentinelHubRequest.output_response("default", MimeType.PNG)],
        bbox=bbox,
        size=size,
        config=config,
    )
  • Then, the part where the resolution is specified, for which the documentation writes: "Using the bbox_to_dimensions utility function, you can provide the desired resolution parameter of the image in meters and obtain the output image shape." And then provides the following lines of code:
resolution = 10
aoi_bbox = BBox(bbox=aoi_coords_wgs84, crs=CRS.WGS84)
aoi_size = bbox_to_dimensions(aoi_bbox, resolution=resolution)
print(f"Image shape at {resolution} m resolution: {aoi_size} pixels")

My problem lies mainly in this part of the code, because if I write resolution = 16, how will that be achieved? The bands I'll be using are B02, B03 & B04, which correspond to RGB, and for Sentinel-2A, the resolution for all 3 bands, is 10 m/pixel, as seen here.

Thing is, I actually did run the code, writing resolution = 16, and it did produce some images without any error popping up, but I’m unsure if they truly have a 16 m/pixel resolution.

本文标签: