Catastrophic bug in the IO of eo-learn library which leads to missing band

#1

I am trying to use the example land cover classification code without modification from https://github.com/sentinel-hub/eo-learn/blob/934b4e6328706b4d44905d54e58b5fa7dc267ec1/examples/land-cover-map/SI_LULC_pipeline.ipynb. However, I found that only 5 bands were returned when 6 bands were requested to return, which is also inconsistent with the result from the example code. When I use the code for another area of interest, it is in the same situation. I am confused about this.

The result from the example code, where BANDS are of 6 bands:

EOPatch(
  data: {
    BANDS: numpy.ndarray(shape=(69, 337, 333, 6), dtype=float32)
    CLP: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NDVI: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NDWI: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NORM: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
  }
  mask: {
    CLM: numpy.ndarray(shape=(69, 337, 333, 1), dtype=uint8)
    IS_DATA: numpy.ndarray(shape=(69, 337, 333, 1), dtype=uint8)
    IS_VALID: numpy.ndarray(shape=(69, 337, 333, 1), dtype=bool)
  }
  scalar: {}
  label: {}
  vector: {}
  data_timeless: {}
  mask_timeless: {
    LULC: numpy.ndarray(shape=(337, 333, 1), dtype=uint8)
    VALID_COUNT: numpy.ndarray(shape=(337, 333, 1), dtype=int64)
  }
  scalar_timeless: {}
  label_timeless: {}
  vector_timeless: {}
  meta_info: {
    maxcc: 0.8
    service_type: 'wcs'
    size_x: '10m'
    size_y: '10m'
    time_difference: datetime.timedelta(-1, 86399)
    time_interval: <class 'list'>, length=2
  }
  bbox: BBox(((510157.61722214246, 5122327.229129893), (513489.214628833, 5125693.036780571)), crs=EPSG:32633)
  timestamp: <class 'list'>, length=69
)

and result from our execution, with BANDS of 5 bands:

EOPatch(
  data: {
    BANDS: numpy.ndarray(shape=(69, 337, 333, 5), dtype=float32)
    CLP: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NDVI: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NDWI: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
    NORM: numpy.ndarray(shape=(69, 337, 333, 1), dtype=float32)
  }
  mask: {
    CLM: numpy.ndarray(shape=(69, 337, 333, 1), dtype=bool)
    IS_DATA: numpy.ndarray(shape=(69, 337, 333, 1), dtype=bool)
    IS_VALID: numpy.ndarray(shape=(69, 337, 333, 1), dtype=bool)
  }
  scalar: {}
  label: {}
  vector: {}
  data_timeless: {}
  mask_timeless: {
    LULC: numpy.ndarray(shape=(337, 333, 1), dtype=uint8)
    VALID_COUNT: numpy.ndarray(shape=(337, 333, 1), dtype=int64)
  }
  scalar_timeless: {}
  label_timeless: {}
  vector_timeless: {}
  meta_info: {
    maxcc: 0.8
    service_type: 'wcs'
    size_x: '10m'
    size_y: '10m'
    time_difference: datetime.timedelta(-1, 86399)
    time_interval: ['2017-01-01', '2017-12-31']
  }
  bbox: BBox(((513489.214628833, 5122327.229129893), (516820.8120355235, 5125693.036780571)), crs=EPSG:32633)
  timestamp: [datetime.datetime(2017, 1, 1, 10, 4, 7), ..., datetime.datetime(2017, 12, 29, 9, 57, 10)], length=69
)
Temporal Analysis is invalid for API
#2

Dear @geoliuh18,

Please specify the following information when submitting an issue:

  • What is your eo-learn version?
  • Have you written any custom code?
  • Are you executing example notebook from github without any modifications?
  • What have you done to try and solve this issue?
  • Have you set up your Sentinel Hub account as instructed in the example?
#3

Dear anze.zupanc,

Thanks for your timely reply!

  • My eo-learn version is 0.4.2 (the newest).
    1
  • I didn’t modify any code of the example and I ran exactly the same ipynb in the official github.
  • When I tried the code in other areas by defining another AOI, the situation is the same.
  • I have registered the account on sentinel hub as instructed.

Best wishes

#4

Thanks for the feedback, but we still can’t reproduce the problem. If we execute the example notebook, we get all 6 bands as expected.

In order to debug this please do the following:

  1. Comment out the line in input cell #1
# Suppress warnings
#sys.stderr = open(os.devnull, "w")
  1. restart the kernel

  2. Add and execute the following after input cell #10 (where the EOWorkflow is defined):

import logging
logger = logging.getLogger('')
logging.getLogger('requests').setLevel(logging.DEBUG)
logging.getLogger('sentinelhub').setLevel(logging.DEBUG)

eopatch = add_data.execute(bbox=bbox_list[0], time_interval=['2017-01-01', '2017-12-31'])
  1. Copy and paste the debugging output.
#5

Dear anze.zupanc,

Thanks for your kind suggestion! I still get the same problem and the example ipynb I used is (https://github.com/sentinel-hub/eo-learn/blob/master/examples/land-cover-map/SI_LULC_pipeline.ipynb).
The debug ouput is pasted in this link (https://github.com/geoliuh18/testEOLEARN/blob/master/debugOutput). BTW, I didn’t see (#sys.stderr = open(os.devnull, “w”)) in the example code.

Best wishes

#6

The debug output didn’t point to any issue. Everything looks good. The WCS request requests the 6 bands using custom script so it’s really strange that you get only 5 bands back. Can you share the first 8 characters of your instance ID in order to check if there’s something wrong with the configuration?

Thanks and best regards,

Anze

#7

Dear Anze,

Thanks for your kindly help! The first 8 characters of my instance ID are ‘ad24598b’. And the first output eopatch is compressed in the files uploaded on https://drive.google.com/open?id=1t531Bth-8_DxMqqfnj6fmn2z7oLl58qI.

Best wishes.

#8

Dear Han Liu,

your problems have been reproduced and confirmed. The root of the problem is in your configuration of the layer, which is not the default one and has been modified. The description of the problem is described in more details here.

Best regards,
Anze

#9

Thanks for your help, Anze! Since the problem may be related, I replied in the temporal analysis stream. I would appreciate for your help.

Best regards,
Han