Coverage analysis

Per-tile and per-obsid fractional coverage of dark deposits (union of fan + blotch polygons / tile pixel area). Verbatim port of Tom Ihro’s Calculate_Coverage_v2.ipynb (cells 0–28).

Per-tile coverage


source

compute_per_tile_coverage

def compute_per_tile_coverage(
    version:str='v3.1', fan:pandas.DataFrame | None=None, blotch:pandas.DataFrame | None=None, cache:bool=True,
    cache_dir:pathlib.Path | None=None
)->DataFrame:

Per-tile fractional dark-deposit coverage.

Verbatim port of Tom Ihro’s Calculate_Coverage_v2.ipynb cells 0–20. Result has columns [obsid, tile_id, Coverage]; for v3.1 it has ~64 494 rows. Cached as parquet so the (slow) Shapely union runs once per machine.

Per-obsid summary


source

compute_per_obsid_coverage

def compute_per_obsid_coverage(
    per_tile:DataFrame, with_homogeneity:bool=True
)->DataFrame:

Aggregate per-tile coverage to per-obsid summary statistics.

Verbatim port of cells 26–28 of Calculate_Coverage_v2.ipynb: mean, median, std, skew, kurtosis (and optional Homogeneity = mean / median).

Percentile summary


source

pct_summary

def pct_summary(
    coverage, # Fractional (0-1) per-tile coverage, e.g. the ``Coverage`` column of
    # :func:`compute_per_tile_coverage`. Non-finite values are ignored.
    pcts:tuple=(10, 25, 50, 75, 90, 95, 99), # Percentiles to report; default matches the values quoted in the coverage paper.
): # Indexed ``p10, p25, ..., p99, mean``, values in percent (fraction x 100).

Percentile + mean summary of a fractional-coverage series, in percent.

pct_summary(pd.Series([0.01, 0.05, 0.12, 0.25, 0.40]))

Attach per-observation metadata


source

attach_tile_metadata

def attach_tile_metadata(
    per_tile, version:str='v3.1'
):

Attach Ls, roi_name, and MY to a per-tile coverage table.

Merges the authoritative per-observation metadata (io.get_metafull for solar longitude, io.get_region_names for ROI and Mars Year) onto the per-tile table from :func:compute_per_tile_coverage, keyed on obsid.

No de-duplication is applied on the merge: if an obsid maps to more than one ROI row, the resulting tile duplication is left visible rather than silently collapsed.

Returns a copy of per_tile with added columns [Ls, roi_name, MY].

per_tile = compute_per_tile_coverage("v3.1")
attach_tile_metadata(per_tile).head()