Skip to content

sentinel_2

This module contains Enums for Sentinel-2 on Copernicus Data Space Ecosystem (CDSE).

CopernicusS2Collection #

Bases: str, Enum

Copernicus Sentinel-2 Collections.

__str__ #

__str__() -> str

Returns the collection name as a string.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
39
40
41
def __str__(self) -> str:
    """Returns the collection name as a string."""
    return f"{self.value}"

__repr__ #

__repr__() -> str

Returns the band name as a string.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
43
44
45
def __repr__(self) -> str:
    """Returns the band name as a string."""
    return f"{self.value}"

CopernicusS2Resolution #

Bases: int, Enum

Copernicus Sentinel-2 Resolutions in meters.

__str__ #

__str__() -> str

Returns the resolution as a string with 'm' suffix.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
55
56
57
def __str__(self) -> str:
    """Returns the resolution as a string with 'm' suffix."""
    return f"{self.value}m"

__repr__ #

__repr__() -> str

Returns the band name as a string.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
59
60
61
def __repr__(self) -> str:
    """Returns the band name as a string."""
    return f"{self.value}"

CopernicusS2Band #

Bases: str, Enum

Copernicus Sentinel-2 Bands for Level-2A.

The value of each member corresponds to the asset key for the band. Base band names (e.g., 'B02') default to their native resolution. Explicit resolution members (e.g., 'B02_20m') are also provided.

base_name property #

base_name: str

Returns the base name of the band (e.g., 'B02').

native_res property #

native_res: int

Returns the native resolution of the band in meters.

Defaults to 10m if band base name is not recognized.

at_res #

at_res(resolution: int | CopernicusS2Resolution) -> str

Returns the asset key for this band at the specified resolution.

Parameters:

Name Type Description Default
resolution int | CopernicusS2Resolution

The resolution to get the key for (e.g., 20 or CopernicusS2Resolution.R20M).

required

Returns:

Type Description
str

The asset key string (e.g., 'B02_20m').

Source code in src/geospatial_tools/copernicus/sentinel_2.py
174
175
176
177
178
179
180
181
182
183
184
185
def at_res(self, resolution: int | CopernicusS2Resolution) -> str:
    """
    Returns the asset key for this band at the specified resolution.

    Args:
        resolution: The resolution to get the key for (e.g., 20 or CopernicusS2Resolution.R20M).

    Returns:
        The asset key string (e.g., 'B02_20m').
    """
    res_val = resolution.value if isinstance(resolution, CopernicusS2Resolution) else resolution
    return f"{self.base_name}_{res_val}m"

__str__ #

__str__() -> str

Returns the band name as a string.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
187
188
189
def __str__(self) -> str:
    """Returns the band name as a string."""
    return f"{self.value}"

__repr__ #

__repr__() -> str

Returns the band name as a string.

Source code in src/geospatial_tools/copernicus/sentinel_2.py
191
192
193
def __repr__(self) -> str:
    """Returns the band name as a string."""
    return f"{self.value}"