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.
本文标签:
版权声明:本文标题:python - How to extract Sentinel-2 RGB images at a custom spatial resolution (16mpixel) when native band resolution is 10m? - St 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736312364a1935075.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论