Skip to main content

Hello!


I have just begun working with EO Learn and was following the example code located here: https://github.com/sentinel-hub/eo-learn/blob/master/examples/water-monitor/WaterMonitorWorkflow.ipynb


I have trimmed it down just to search imagery, add_ndwi, and do the cloud detection. However, I am getting the following error: AttributeError: During execution of task S2L1CWCSInput: ‘NoneType’ object has no attribute ‘CONFIG_PARAMS’


I am working in Spyder.


input_task = S2L1CWCSInput(‘TRUE-COLOR-S2-L1C’, resx=‘20m’, resy=‘20m’, maxcc=0.5, instance_id=None)

add_ndwi = S2L1CWCSInput(‘NDWI’)


cloud_classifier = get_s2_pixel_cloud_detector(average_over=2, dilation_size=1, all_bands=False)


cloud_det = AddCloudMaskTask(cloud_classifier, ‘BANDS-S2CLOUDLESS’, cm_size_y=‘160m’, cm_size_x=‘160m’,

cmask_feature=‘CLM’, cprobs_feature=‘CLP’, instance_id=None)


workflow = LinearWorkflow(input_task, add_ndwi, cloud_det)

time_interval = d‘2016-01-01’,‘2018-08-31’]

dam_bbox = BBox(bbox=,19.10818927, -34.08851246, 19.30962163, -33.977424140000004], crs=CRS.WGS84)


result = workflow.execute({

input_task: {

‘bbox’: dam_bbox,

‘time_interval’: time_interval

},

})


patch = list(result.values())}-1]


Any help would be greatly appreciated!


Thanks!

Sasha

Hi Sasha,


You need to set your instance ID, either in the script by replacing None, or in your sentinelhub.config file. For more info on how to do this via command line check here. Otherwise declare a instance_id=<your_instance_id> in the script and set instance_id=instance_id in both S2L1CWCSInput tasks and in AddCloudMaskTask.


Thank you for your reply but unfortunately I have the same error. I’ve set it both in the command line and in the script itself.


instance_id = ‘iheartcats’ #not the actual instance id


input_task = S2L1CWCSInput(‘TRUE-COLOR-S2-L1C’, resx=‘20m’, resy=‘20m’, maxcc=0.5, instance_id=instance_id)

add_ndwi = S2L1CWCSInput(‘NDWI’,instance_id=instance_id)


cloud_classifier = get_s2_pixel_cloud_detector(average_over=2, dilation_size=1, all_bands=False)


cloud_det = AddCloudMaskTask(cloud_classifier, ‘BANDS-S2CLOUDLESS’, cm_size_y=‘160m’, cm_size_x=‘160m’,

cmask_feature=‘CLM’, cprobs_feature=‘CLP’, instance_id=instance_id)


#in command line

(base) C:\users\snasonova>sentinelhub.config --show

{

“instance_id”: “iheartcats”,

“aws_access_key_id”: “”,

“aws_secret_access_key”: “”,

“ogc_base_url”: “https://services.sentinel-hub.com/ogc/”,

“geopedia_wms_url”: “http://service.geopedia.world/”,

“geopedia_rest_url”: “https://www.geopedia.world/rest/”,

“aws_metadata_url”: “https://roda.sentinel-hub.com/”,

“aws_s3_l1c_bucket”: “sentinel-s2-l1c”,

“aws_s3_l2a_bucket”: “sentinel-s2-l2a”,

“opensearch_url”: “http://opensearch.sentinel-hub.com/resto/api/collections/Sentinel2/”,

“max_wfs_records_per_query”: 100,

“max_opensearch_records_per_query”: 500,

“default_start_date”: “1985-01-01”,

“max_download_attempts”: 4,

“download_sleep_time”: 5,

“download_timeout_seconds”: 120

}

Configuration file location: c:\users\snasonova\appdata\local\continuum\anaconda3\lib\site-packages\sentinelhub\config.json


OK. That is odd, as I did run your code snippet with our instance id and got the correct data.


Are you getting the same error when adding the instance_id?


Oh! I restarted Spyder and tried it again, and this is what I get now:


DownloadFailedException: During execution of task S2L1CWCSInput: Failed to download from:
https://services.sentinel-hub.com/ogc/wcs/<instance_id>?SERVICE=wcs&MAXCC=50.0&ShowLogo=False&Transparent=True&BBOX=-34.08851246%2C19.10818927%2C-33.977424140000004%2C19.30962163&FORMAT=image%2Ftiff%3Bdepth%3D32f&CRS=EPSG%3A4326&TIME=2016-01-17T08%3A50%3A33%2F2016-01-17T08%3A50%3A33&RESX=20m&RESY=20m&COVERAGE=TRUE-COLOR-S2-L1C&REQUEST=GetCoverage&VERSION=1.1.2

with HTTPError:

400 Client Error: Bad Request for url: https://services.sentinel-hub.com/ogc/wcs/<instance_id>?SERVICE=wcs&MAXCC=50.0&ShowLogo=False&Transparent=True&BBOX=-34.08851246%2C19.10818927%2C-33.977424140000004%2C19.30962163&FORMAT=image%2Ftiff%3Bdepth%3D32f&CRS=EPSG%3A4326&TIME=2016-01-17T08%3A50%3A33%2F2016-01-17T08%3A50%3A33&RESX=20m&RESY=20m&COVERAGE=TRUE-COLOR-S2-L1C&REQUEST=GetCoverage&VERSION=1.1.2

Server response: “Layer TRUE-COLOR-S2-L1C not found”


Thank you so much for your help!


No problem. You would probably need to change the layer name from your configuration dashboard.

The python-template configuration should have all layers needed to run the examples.


Got it! Thanks again, this is very fun. I have another, unrelated question. Can you please point me to some documentation on how to use EO-Learn with data that’s stored locally?


Edit:

Actually, sorry I am still having trouble. I am getting the same error. Server response: “Layer BANDS-S2-L1C not found”. I’ve tried a couple of different layer names.


Hi Sasha,

can you write first two blocks of the instance ID (e.g. 00650d51-63e0) so that we see, what is happening.

Looking at your account I notice you do not have any configuration active at the moment. Perhaps this is an issue?


Ok, so I just changed it to this: fbf61faf-2164 and the code ran but I have no output. Is that right?


Edit: I did it! Thank you. Also, I asked earlier, but is there any documentation on off-line use?


Good to hear that it works.


As for the off-line use, you can save the downloaded eo-patches to disk and load them in other workflows for further processing.


If you wanted to load into eo-learn other data-sources data stored locally, you’d have to implement a task that reads the file and extracts the AOI corresponding to the patch BBox. For instance, if you wanted to read a geo-tiff file, you could use rasterio. Implementation of such task is in our back-log, but haven’t had time to do it yet.


I have the same issue “Layer TRUE-COLOR-S2-L1C not found”. My instance-id starts with 4cffe1a5-1e19. @sasha.nasonova, Did you create new account to resolve this?


Have found the solution. New configuration should be created.


I was a bit confused with this part and tried to change layers in existing(previous) configuration




devis.peressutti:


You would probably need to change the layer name from your configuration




Reply