Skip to content

Commit

Permalink
Fix egrid data if name not in properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfleischer committed Oct 21, 2024
1 parent eb37a5c commit 890299b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/emcommon/metrics/footprint/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ async def get_egrid_region(coords: list[float, float], year: int) -> str | None:
return None
region_feature = get_feature_containing_point(coords, geojson)
if region_feature is not None:
return region_feature['properties']['name']
properties = region_feature['properties']
region_name = properties.get('name') or properties.get('SUBRGN')
if region_name:
return region_name
Log.warn(f"An eGRID region was not found for coords {coords} in year {year}.")
return None

Expand Down

0 comments on commit 890299b

Please sign in to comment.