Assets

AssetRegistry

class climagrid.assets.registry.AssetRegistry(path, asset_type_filter=None)[source]

Bases: object

Loads and validates a utility asset registry from CSV or GeoJSON.

Parameters:
  • path (str | Path) – Path to a CSV file (must have asset_id, lat, lon columns) or a GeoJSON file (must have asset_id and Point geometry).

  • asset_type_filter (list[str] | None) – If provided, only include assets of these types.

Example

>>> registry = AssetRegistry("my_coop_assets.csv")
>>> registry.assets.head()
property assets: GeoDataFrame
Type:

GeoDataFrame with one row per asset, CRS=EPSG

property count: int
property bounding_box: tuple[float, float, float, float]

(min_lat, max_lat, min_lon, max_lon) covering all assets.

climagrid.assets.registry.load_sample_assets()[source]

Load the bundled sample registry (33 real substations across 7 states).

Return type:

AssetRegistry

AssetEnvironmentJoiner

class climagrid.assets.joiner.AssetEnvironmentJoiner(max_distance_km=100.0)[source]

Bases: object

Joins time-series environmental data to utility asset point locations.

Strategy: nearest-neighbor match in Euclidean lat/lon space (valid for small regions, <500 km extents). For large extents consider haversine.

Parameters:

max_distance_km (float) – Reject matches farther than this distance. Points beyond this threshold will have NaN environmental values. Default 100 km.

Example

>>> registry = AssetRegistry("assets.csv")
>>> nasa = NasaPowerAdapter()
>>> env_df = nasa.fetch(bbox, start_dt, end_dt)
>>> joiner = AssetEnvironmentJoiner()
>>> result = joiner.join(registry, env_df)
>>> result.head()
join(registry, env_df, time_col='timestamp')[source]

Join environmental observations to each asset for every timestamp.

Parameters:
  • registry (AssetRegistry) – AssetRegistry with asset locations.

  • env_df (DataFrame) – DataFrame returned by any adapter’s fetch() method. Must have ‘lat’, ‘lon’, and at least one timestamp.

  • time_col (str) – Name of the timestamp column in env_df.

Returns:

One row per (asset_id, timestamp) with index columns and all environmental columns present in env_df.

Return type:

DataFrame

join_point(asset_lat, asset_lon, env_df, time_col='timestamp')[source]

Convenience method: join env data for a single lat/lon point.

Return type:

DataFrame

Parameters: