slv.inversion.config.build_location_site_map#

slv.inversion.config.build_location_site_map(location_ids, site_config)[source]#

Build location mapper from STILT location IDs to site names.

Parses location IDs (format: “lon_lat_height”) and matches them to sites in the site_config: within 1e-5 deg (~1 m) in lat/lon and 0.5 m in height. (np.isclose’s default relative tolerance allowed ~0.0011 deg of longitude, ~95 m.)

Parameters:
  • location_ids (list[str]) – List of STILT location IDs (e.g., “-111.847672_40.766189_35”).

  • site_config (pd.DataFrame) – Site configuration with latitude/longitude columns indexed by site name.

Returns:

Mapping from location ID to site name. Unmapped IDs are omitted from the result.

Return type:

dict[str, str]

Examples

>>> loc_ids = ["-111.847672_40.766189_35", "-111.884505_40.902945_4"]
>>> site_config = load_site_config()
>>> mapper = build_location_site_map(loc_ids, site_config)
>>> mapper["-111.847672_40.766189_35"]
'wbb'