diagnostics#

System diagnostics: recipe availability, geographic coverage, etc.

Functions#

find_recipes(→ pandas.DataFrame)

Find all recipes for a given entity type.

map_recipe_coverage(, ax, verbose, matplotlib.pyplot.Axes])

Map geographic coverage of recipes for a given entity type.

Module Contents#

openplaces.diagnostics.find_recipes(entity_type: str, stage: str | None = None) pandas.DataFrame#

Find all recipes for a given entity type.

Scans the recipes directory and returns a table of available recipes.

Parameters:
  • entity_type (str) – Entity type to search for (e.g. 'building', 'parcel').

  • stage (str or None) – If given, only return recipes whose stage field matches (e.g. 'ingest', 'harmonize'). Recipes without an explicit stage field are treated as 'ingest'.

Returns:

Columns: admin_id, stage, entity_type, source_id, version, n_companion_files. Sorted by admin_id then source_id. Global recipes have an empty string for admin_id.

Return type:

pd.DataFrame

openplaces.diagnostics.map_recipe_coverage(entity_type: str, figsize: tuple = (14, 7), ax: matplotlib.pyplot.Axes | None = None, verbose: bool = False) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes]#

Map geographic coverage of recipes for a given entity type.

Plots admin geometries fetched via get_admin(), layering smaller admin units on top of larger ones. Requires admin boundary data (GADM) to be ingested.

Colors encode both source (hue) and admin level (lightness): global recipes appear in a pastel shade, country-level recipes are slightly darker, state-level darker still, and so on.

Parameters:
  • entity_type (str) – Entity type to map (e.g. 'building').

  • figsize (tuple) – Figure size (width, height) in inches. Ignored when ax is given.

  • ax (matplotlib.axes.Axes or None) – Axes to plot into. A new figure is created when None.

  • verbose (bool) – Print timing for each stage.

Returns:

(fig, ax)

Return type:

tuple[plt.Figure, plt.Axes]