S2L1CWCSInput error


Currently I am developing an API for crop classification, and I use S2L1CWCSInput for fetching sentinel data. It was working fine until last month. Now, when I try to create a S2L1CWCSInput object, I am getting the following error:
During execution of task S2L1CWCSInput: index -1 is out of bounds for axis 0 with size 0

This happens during this method:

def build_input(name):
if name in PRODUCTS:
return S2L1CWCSInput(
except Exception as e:
logging.exception(f"{name} exception: {e}”)

I would be really thankful if you explain the reasoning and if possible help me to devise a solution.

Best regards,
Mahin Khankishizade

Hi @tarla,

could you provide a full stack trace of your error? Could you also let us know about versions of Python packages eo-learn-io and sentinelhub that you are using?

Hello, I am using eo-learn==0.5.2 and sentinelhub==2.6.1.
from eolearn.core import EOPatch, EOTask, FeatureType, LinearWorkflow
from eolearn.geometry import VectorToRaster
from eolearn.io import S2L1CWCSInput
from sentinelhub import BBox, WcsRequest
backend_1 | /usr/local/lib/python3.7/site-packages/pyproj/crs/crs.py:55: FutureWarning: ‘+init=:’ syntax is deprecated. ‘:’ is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
backend_1 | return _prepare_from_string(" ".join(pjargs))
backend_1 | /usr/local/lib/python3.7/site-packages/sentinelhub/data_request.py:47: SHDeprecationWarning: Parameter ‘instance_id’ is deprecated and will soon removed. Use parameter ‘config’ instead
backend_1 | category=SHDeprecationWarning)
backend_1 | INFO:root:Exception: During execution of task S2L1CWCSInput: index -1 is out of bounds for axis 0 with size 0
backend_1 | During execution of task S2L1CWCSInput: index -1 is out of bounds for axis 0 with size 0
backend_1 | ERROR:aiohttp.server:Error handling request
backend_1 | Traceback (most recent call last):
backend_1 | File “/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py”, line 418, in start
backend_1 | resp = await task
backend_1 | File “/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py”, line 458, in _handle
backend_1 | resp = await handler(request)
backend_1 | File “/src/app/factory/controllers.py”, line 137, in analysis
backend_1 | res = await response_handler.prepare()
backend_1 | File “/src/app/factory/response.py”, line 191, in prepare
backend_1 | job = await self._adapter.process()
backend_1 | File “/src/app/factory/response.py”, line 66, in process
backend_1 | for name, data in self.patch.data.items():
backend_1 | AttributeError: ‘NoneType’ object has no attribute ‘data’
backend_1 | INFO:aiohttp.access: [16/Mar/2020:09:39:06 +0000] “POST /analysis HTTP/1.1” 500 244 “-” “PostmanRuntime/7.20.1”

Hm, the reason for this might be that there are no available satellite images for your requested time interval. It seems that for such special case something in S2L1CWCSInput task breaks.

I suggest that you first upgrade eo-learn and sentinelhub packages to the latest versions (that is eo-learn==0.7.3, sentinelhub==3.0.2). If that doesn’t solve the problem, let us know and we’ll have a look at S2L1CWCSInput task.

I often get this error if I request a time range/location with no Sentinel scenes.

It would be helpful if the S2L1CWCSInput task handled this problem better. I handle that error in my own code so I don’t notice it anymore though.