Skip to content

Make classification layers (SCL, cloud masks) a full multiscale pyramid #274

Open

Description

@emmanuelmathot

The reflectance pyramid has 6 levels (r10m–r720m), a multiscales block, and sharded chunks. conditions/mask/l2a_classification has only r20m and r60m, no multiscales block, one chunk per array, and no flag attributes. Thus a client can read SCL, but it cannot tile it at low zoom levels, and it cannot find the meaning of each class.

Tasks:

  • Write r120m, r360m and r720m for l2a_classification (and the other classification masks). Use classification resampling (_coarsen_variable already supports it).
  • Write a multiscales block on l2a_classification. MultiscaleMeta(..., resampling_method="average") is hard-coded (s2_multiscale.py L864). Make the resampling method a parameter, and use nearest (or mode) for classification.
  • Use the same chunking and sharding as reflectance (spatial_chunk and sharding) for every raster group on x/y, not create_original_encoding.
  • Add CF flag_values and flag_meanings to scl, as quality/mask has flag_masks and flag_meanings.
  • Add classification:classes to the SCL asset in the STAC item.
  • Add a test that opens SCL at every level with titiler's GeoZarrReader.

Activity

  1. added
    enhancementNew feature or request
    multiscalesMultiscale pyramids and overviews
    sentinel-2Sentinel-2 MSI products (L1C, L2A)
    sample-serviceRoadmap with EODC for the EOPF Sentinel Zarr Samples Service (#277)
    on Sep 28, 2026
  2. shollendEODC commented on Oct 8, 2026

    @shollendEODC
    Collaborator

    i adressed this topic in a pre-PR to investigate how easy/difficult it would be to add the associated logic. Its currently available here: https://github.com/shollendEODC/data-model/tree/integrate/cpm-geozarr-main-feat-generic-conversion-s2-cld-snw-scl-MS and is branched off of 039f38c

    Based on your task list i defined the code and implemented it, samples can be accessed here: aws s3 --profile eodc-cm --no-sign-request ls s3://continuous-integration/eopf-geozarr/branches/cpm-geozarr-main-feat-generic-conversion-s2-cld-snw-scl-MS/

    Write r120m, r360m and r720m for l2a_classification (and the other classification masks). Use classification resampling (_coarsen_variable already supports it).

    This should work, given the restructuring of the code into a generic_multiscales(...) function

    Write a multiscales block on l2a_classification. MultiscaleMeta(..., resampling_method="average") is hard-coded (s2_multiscale.py L864). Make the resampling method a parameter, and use nearest (or mode) for classification.

    MultiscaleMeta is not used, as the type validation of MultiscalesAttrs and LayoutObject should be enough. resampling_method is now extracted and used as a parameter.

    Use the same chunking and sharding as reflectance (spatial_chunk and sharding) for every raster group on x/y, not create_original_encoding.

    chunking and sharding is derived from create_uniform_encoding(...) which should satisfy this demand.

    Add CF flag_values and flag_meanings to scl, as quality/mask has flag_masks and flag_meanings.

    these are added, altough i noticed differences between l2a_classification/20m and l2a_classification/60m, which carry different metadata (seems to be passed down from cpm?)

    here it might be relevant to note, that the l1c_classification variable b00 triggers the average handling for coarsening, as the current flagging system detects variables starting with b as reflectance. This should be adapted from my pint of view..

    Add classification:classes to the SCL asset in the STAC item.

    Should this not be done in eopf-stac? Seems more logical to me.

    add a test that opens SCL at every level with titiler's GeoZarrReader.

    This should be done outside of this repo right? Tests should be added, but only focus on eopf-geozarr logic

    This is not a PR yet, just an aggregation of insigths to report progress and trigger discussions. The current development on the branch is also not complete yet, especially the tests need to be modified and adapted.

  3. shollendEODC commented on Oct 13, 2026

    @shollendEODC
    Collaborator

    PR opened in #313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmultiscalesMultiscale pyramids and overviewssample-serviceRoadmap with EODC for the EOPF Sentinel Zarr Samples Service (#277)sentinel-2Sentinel-2 MSI products (L1C, L2A)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions