Skip to content

API reference

earthcarekit.site

Ground site utilities.

Notes

This module does not depend on other internal modules.


Site dataclass

Class representing a fixed geographic site (or ground station) with associated metadata.

Attributes:

Name Type Description
latitude float

Latitude of the site in decimal degrees.

longitude float

Longitude of the site in decimal degrees.

name str

Short name or identifier of the site.

long_name str

Full descriptive name of the site.

aliases list[str]

Alternative names or identifiers for the site.

altitude float

Altitude of the site in meters above sea level.

cloudnet_name str | None

Identifier string used in CloudNet file names, or None if not applicable.

Source code in earthcarekit/site/_site.py
@dataclass(frozen=True)
class Site:
    """Class representing a fixed geographic site (or ground station) with associated metadata.

    Attributes:
        latitude (float): Latitude of the site in decimal degrees.
        longitude (float): Longitude of the site in decimal degrees.
        name (str): Short name or identifier of the site.
        long_name (str): Full descriptive name of the site.
        aliases (list[str]): Alternative names or identifiers for the site.
        altitude (float): Altitude of the site in meters above sea level.
        cloudnet_name (str | None): Identifier string used in CloudNet file names, or None if not applicable.
    """

    latitude: float
    """Latitude of the site in decimal degrees."""
    longitude: float
    """Longitude of the site in decimal degrees."""
    name: str = ""
    """Short name or identifier of the site."""
    long_name: str = ""
    """Full descriptive name of the site."""
    aliases: list[str] = field(default_factory=list)
    """Alternative names or identifiers for the site."""
    altitude: float = 0.0
    """Altitude of the site in meters above sea level."""
    cloudnet_name: str | None = None
    """Identifier string used in CloudNet file names, or None if not applicable."""

    @property
    def coordinates(self) -> tuple[float, float]:
        """Geodetic coordinates of the ground site (lat,lon)."""
        return (self.latitude, self.longitude)

aliases class-attribute instance-attribute

aliases: list[str] = field(default_factory=list)

Alternative names or identifiers for the site.

altitude class-attribute instance-attribute

altitude: float = 0.0

Altitude of the site in meters above sea level.

cloudnet_name class-attribute instance-attribute

cloudnet_name: str | None = None

Identifier string used in CloudNet file names, or None if not applicable.

coordinates property

coordinates: tuple[float, float]

Geodetic coordinates of the ground site (lat,lon).

latitude instance-attribute

latitude: float

Latitude of the site in decimal degrees.

long_name class-attribute instance-attribute

long_name: str = ''

Full descriptive name of the site.

longitude instance-attribute

longitude: float

Longitude of the site in decimal degrees.

name class-attribute instance-attribute

name: str = ''

Short name or identifier of the site.

get_site

get_site(site: SiteLike) -> Site

Retruns ground site data based on name and raises ValueError if no matching ground site is found and TypeError.

Source code in earthcarekit/site/_registry.py
def get_site(site: SiteLike) -> Site:
    """Retruns ground site data based on name and raises `ValueError` if no matching ground site is found and `TypeError`."""
    if isinstance(site, Site):
        return site
    if not isinstance(site, str):
        raise TypeError(
            f"{get_site.__name__}() Expected type `{str.__name__}` but got `{type(site).__name__}` (name={site})"
        )

    site_cleaned = "".join(filter(str.isalnum, site.lower()))

    try:
        return SITES[site_cleaned]
    except KeyError as e:
        gss = [gs.name for gs in _SITE_LIST]
        error_msg = f"""No matching ground site found: '{site}'. Supported site names are: '{gss[0]}', {"', '".join(gss[1:-1])}', and '{gss[-1]}'."""
        raise ValueError(error_msg) from e