WorldCereal / ewoc_classif

The Unlicense
0 stars 0 forks source link

Brazill block cropmap error for classification version 0.4.0 #73

Open agrosu1978 opened 2 years ago

agrosu1978 commented 2 years ago

The error found in the attachment at line 1341 appears when classification processor tries to classify for cropmap the tiles 22NBM and 23MLV from Brazil branch_0000_th0_20220720_084450_ewoc-prd-k8s-node-nf-4.txt

Fahdben commented 2 years ago

I can confirm that this issue is reproductible.

2022-07-28 16:15:58.553 | ERROR    | 140000762283840:satio.utils.logs:wrapper_exitlog:96 - Error occurred while processing task with task id '22NBM_001':

Cannot merge two timeseries with different canvas shape
Traceback (most recent call last):

  File "/opt/ewoc_classif_venv/bin/ewoc_classif", line 8, in <module>
    sys.exit(run())
    │   │    └ <function run at 0x7f53d7943160>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/ewoc_classif/cli.py", line 173, in run
    main(sys.argv[1:])
    │    │   └ ['/opt/ewoc_classif_venv/bin/ewoc_classif', '22NBM', 'BRAZIL/c728b264-5c97-4f4c-81fe-1500d4c4dfbd_20090_20220321234008', '--e...
    │    └ <module 'sys' (built-in)>
    └ <function main at 0x7f53d79430d0>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/ewoc_classif/cli.py", line 150, in main
    run_classif(
    └ <function run_classif at 0x7f53d7943040>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/ewoc_classif/classif.py", line 315, in run_classif
    process_blocks(
    └ <function process_blocks at 0x7f54775ee1f0>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/ewoc_classif/classif.py", line 89, in process_blocks
    ret = run_tile(
          └ <function run_tile at 0x7f53d787ac10>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/worldcereal_products.py", line 448, in run_tile
    result = _log_run_block(tup)
             │              └ ('22NBM_001', Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Polyg...
             └ <function run_tile.<locals>._log_run_block at 0x7f53d5899820>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/satio/utils/logs.py", line 240, in wrapper_exitlog
    value = func(*args, **kwargs)
            │     │       └ {}
            │     └ (('22NBM_001', Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Poly...
            └ <function run_tile.<locals>._log_run_block at 0x7f53d5899940>
> File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/satio/utils/logs.py", line 75, in wrapper_exitlog
    value = func(*args, **kwargs)
            │     │       └ {}
            │     └ (('22NBM_001', Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Poly...
            └ <function run_tile.<locals>._log_run_block at 0x7f53d58998b0>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/worldcereal_products.py", line 428, in _log_run_block
    _run_block(outputfolder, processing_tuple)
    │          │             └ ('22NBM_001', Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Polyg...
    │          └ PosixPath('/tmp/22NBM_576b73')
    └ <function _run_block at 0x7f53d787af70>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/worldcereal_products.py", line 304, in _run_block
    chain.process(block.tile, block.bounds,
    │     │       │     │     │     └ <_collections._tuplegetter object at 0x7f53d5890cd0>
    │     │       │     │     └ Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Polygon object at 0...
    │     │       │     └ <_collections._tuplegetter object at 0x7f53d5890610>
    │     │       └ Pandas(Index=1, tile='22NBM', bounds=(210220, 689780, 220460, 700020), geometry=<shapely.geometry.polygon.Polygon object at 0...
    │     └ <function ClassificationProcessor.process at 0x7f53d73e4670>
    └ <worldcereal.processors.ClassificationProcessor object at 0x7f53ce994160>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/processors.py", line 1651, in process
    features = self.get_features(tile, bounds, epsg)
               │    │            │     │       └ 32622
               │    │            │     └ (210220, 689780, 220460, 700020)
               │    │            └ '22NBM'
               │    └ <function ClassificationProcessor.get_features at 0x7f53d73e4ee0>
               └ <worldcereal.processors.ClassificationProcessor object at 0x7f53ce994160>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/processors.py", line 1602, in get_features
    features = BlockProcessor(
               └ <class 'worldcereal.processors.BlockProcessor'>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/processors.py", line 269, in get_features
    feat = feat_handles[s](
           │            └ 'OPTICAL'
           └ {'OPTICAL': <class 'worldcereal.fp.WorldCerealOpticalFeaturesProcessor'>, 'SAR': <class 'worldcereal.fp.WorldCerealSARFeature...
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/fp.py", line 564, in compute_features
    features_20m, ts = self.compute_features_20m(ts, ts_proc,
                       │    │                    │   └ <Timeseries: (4, 36, 1024, 1024) - bands: ['B04', 'B08', 'B02', 'B03'] - s: 2020-04-26 00:00:00 - e: 2021-04-11 00:00:00 - dt...
                       │    │                    └ <Timeseries: (4, 22, 1024, 1024) - bands: ['B04', 'B08', 'B02', 'B03'] - s: 2020-04-28 23:59:59 - e: 2021-04-15 23:59:59 - dt...
                       │    └ <function L2AFeaturesProcessor.compute_features_20m at 0x7f5429f0f700>
                       └ <worldcereal.fp.WorldCerealOpticalFeaturesProcessor object at 0x7f53d1d02b80>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/fp.py", line 740, in compute_features_20m
    ts = self.load_data(resolution, timeseries=ts)
         │    │         │                      └ <Timeseries: (4, 22, 512, 512) - bands: ['B04', 'B08', 'B02', 'B03'] - s: 2020-04-28 23:59:59 - e: 2021-04-15 23:59:59 - dtyp...
         │    │         └ 20
         │    └ <function L2AFeaturesProcessor.load_data at 0x7f5429f0f310>
         └ <worldcereal.fp.WorldCerealOpticalFeaturesProcessor object at 0x7f53d1d02b80>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/fp.py", line 310, in load_data
    bands_ts = collection.load_timeseries(*bands_to_load)
               │          │                └ ['B05', 'B07', 'B11', 'B12']
               │          └ <function WorldCerealOpticalTiledCollection.load_timeseries at 0x7f53d72c6430>
               └ <worldcereal.collections.WorldCerealOpticalTiledCollection object at 0x7f53d1842af0>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/worldcereal/collections.py", line 285, in load_timeseries
    timeseries = combined_ts.merge(S2_ts, fill_missing_timestamps=True)
                 │           │     └ <unprintable Timeseries object>
                 │           └ <function Timeseries.merge at 0x7f5430bdc1f0>
                 └ <Timeseries: (2, 22, 512, 512) - bands: ['B11', 'B12'] - s: 2020-04-28 23:59:59 - e: 2021-04-15 23:59:59 - dtype: uint16>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/satio/timeseries.py", line 310, in merge
    feat = feat._merge(
           │    └ <function Timeseries._merge at 0x7f5430bdc280>
           └ <Timeseries: (2, 22, 512, 512) - bands: ['B11', 'B12'] - s: 2020-04-28 23:59:59 - e: 2021-04-15 23:59:59 - dtype: uint16>
  File "/opt/ewoc_classif_venv/lib/python3.8/site-packages/satio/timeseries.py", line 329, in _merge
    raise ValueError("Cannot merge two timeseries with "

ValueError: Cannot merge two timeseries with different canvas shape
savmickael commented 2 years ago

21MLV

Few chance to find crop over this area

kvantricht commented 2 years ago

Could you share with me the config and collection csv so I can test locally? Indeed, there not be a crop I guess, but we should be able to skip this one without an ugly error. The satio error that is raised tells us that the spatial dimensions of the time series to merge don't match. But I don't really understand where this is coming from. Need to debug to investigate.