Evoland-Land-Monitoring-Evolution / sentinel2_superresolution

Super-resolution of 10 Sentinel-2 bands to 5-meter resolution, starting from L1C or L2A (Theia format) products.
Apache License 2.0
52 stars 7 forks source link

Error: access window out of range in Rasterio when UTM bounding box coordinates are supplied with -roi argument. #5

Closed nyinyinyanlin closed 2 months ago

nyinyinyanlin commented 2 months ago

I used the following command to process a region of interest by supplying UTM bounding box coordinates.

sentinel2_superesolution -v -i "E:\SENTINEL2A_20240419-042236-927_L2A_T46QGJ_C_V1-0.zip" -m "sentinel2_superresolution\models\carn_3x3x64g4sw_bootstrap.onnx" -o results/ --gpu -roi 745216.6293 2394189.6762 746157.4379 2395523.9138

And I have been getting errors like the one below

rasterio.errors.RasterioIOError: Read or write failed. results/test\SENTINEL2A_20240419_L2A_T46QGJ_5m_sisr.tif: Access window out of range in RasterIO(). Requested (0,130) of size 189x1000 on raster of 188x1130.

It doesn't matter if I change the size or region of bounding boxes, I keep getting this error. I am sure my data well contained the bounding box region.

jmichel-otb commented 2 months ago

The issue may be caused by incorrect rounding of the provided coordinates. The tool does not do grid-resampling, so asking for 745216.6293 2394189.6762 as the true origin is not supported (and it probably does not make sense to provide coordinates up to 1e-1 mm).

Can you try clipping your coordinates to a 10-meter phased grid :

sentinel2_superesolution -v -i "E:\SENTINEL2A_20240419-042236-927_L2A_T46QGJ_C_V1-0.zip" -m "sentinel2_superresolution\models\carn_3x3x64g4sw_bootstrap.onnx" -o results/ --gpu -roi 745210. 2394190. 746160. 2395520.
jmichel-otb commented 2 months ago

Safeguard added here : https://github.com/Evoland-Land-Monitoring-Evolution/sentinel2_superresolution/commit/83fa1ba00e3fdea82dca71bb3ba744013e98cfa3