improve PRISMA L1 import

Issue #1015 resolved
Andreas Janz created an issue

Like for the L2D import, also support other subdatasets:

Comments (9)

  1. Andreas Janz reporter

    Pixel error matrix values are:
    0=pixel ok
    1=DEF ECTIV E PIXEL from KDP
    2=pixel in saturati on.
    3= lower radiom etric confide nce
    4= pixel at NaN or Inf
    (PRISMA Product Specifications_Is2_3.docx, page 130)

  2. Andreas Janz reporter

    Cloud mask categories are:
    0= not cloudy pixel
    1= cloudy pixel
    10 = not of all previous classification
    255 = error

    (PRISMA Product Specifications_Is2_3.docx, page 132)

  3. Andreas Janz reporter

    Sun glint mask values:
    0 for not sun glint
    1 for sun glint
    10 = for not of all previous classification
    255 = error

  4. Andreas Janz reporter

    Land cover mask values:
    0 for water pixel
    1 for snow pixel (and ice)
    2 for not-vegetated land pixel :bare soil)
    3 for crop and rangeland pixel
    4 for forst pixel
    5 for wetland pixel
    6 for not-vegetated land pixel :urban component
    10 = for not of all previous classification
    255 = error

  5. Andreas Janz reporter

    Reading PRISMA L1 data with GDAL API is very slow because of the dump BIP interleaved storage.

    Takes 25 minutes with GDAL API, but only 10 seconds with h5py API.

    Unfortunately, some users had problems with h5py, so we first try to read with h5py, but fall back to GDAL if that fails:

    def utilsReadAsArray(dataset: gdal.Dataset, filename, key: str, feedback: QgsProcessingFeedback):
        # We first try to read PRISMA data with the h5py API, which is super fast.
        # Only if that fails, we use GDAL API, which is super slow, because of the dump BIP interleave storage.
    
        try:
            import h5py
            with h5py.File(filename, 'r') as file:
                array = file[key][()]
        except:
            traceback.print_exc()
            feedback.pushWarning(
                'Reading data with h5py API failed. Fall back to GDAL API, which is very slow on PRISMA BIP '
                f'interleaved data: {dataset.GetDescription()}'
            )
            array = dataset.ReadAsArray()
        return array
    

  6. Andreas Janz reporter

    Removed the Bad Band Thresholding, because we only have few pad pixel. We basically only see image strips, e.g.

  7. Log in to comment