sentinel-hub / eo-learn

Earth observation processing framework for machine learning in Python
https://eo-learn.readthedocs.io/en/latest/
MIT License
1.13k stars 300 forks source link

[HELP] ImportError: cannot import name 'S2L1CWCSInput' from 'eolearn.io' #361

Closed Dwat2505 closed 2 years ago

Dwat2505 commented 2 years ago

I am trying to run the following code. However, I am getting an import error. I have read the documentation and I can't a single reference of S2L1WCSInput. Can someone suggest how this code can be written w.r.to the current updates in eo-learn ?

from eolearn.io import S2L1CWCSInput, SentinelHubInputTask, S2L2AWCSInput

input_task = S2L2AWCSInput('BANDS-S2-L1C', resx='10m', resy='10m', maxcc=0.8)
add_l2a = S2L2AWCSInput(layer='BANDS-S2-L2A')
true_color  = S2L1CWCSInput('TRUE-COLOR-S2-L1C')
SENT_SAT_CLASSICATIONS = S2L2AWCSInput("SCENE_CLASSIFICATION")
batic commented 2 years ago

Hi @Dwat2505

Please have a look at examples in the docs, e.g. task for Sentinel-2 L1C data or task for L2A + SCL data.

Dwat2505 commented 2 years ago

Hi @Dwat2505

Please have a look at examples in the docs, e.g. task for Sentinel-2 L1C data or task for L2A + SCL data.

The examples don't cover true_color, add_l2a and SENT_SAT_CLASSIFICATIONS. Any suggestions for those ?

batic commented 2 years ago

true_color is either a combination of bands B02, B03, B04 (in reverse order to get RGB image), or an evalscript (e.g. true color, for which you'd use SentinelHubEvalscriptTask, like done in the example here). Anyway, in first task (example for L1C data) you already have the necessary bands to construct a true-color image.

add_l2a is now a SentinelHubInputTask for L2A data, as shown in this example. In the example the tasks also retrieves the scene classification bands' data.

If you want to store these bands in separate features, it should be rather easy to construct them, e.g.:

eopatch.data['RGB'] = eopatch.data['L1C_data'][:,:,:,(3,2,1)]
Dwat2505 commented 2 years ago

Alright, Thanks for the example and references.