Skip to content

Pr/84 - #85

Merged
AadilLatif merged 5 commits into
mainfrom
pr/84
Jul 16, 2026
Merged

AadilLatif merged 5 commits into
mainfrom
pr/84

Conversation

@AadilLatif

@AadilLatif AadilLatif commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This pull request optimizes wind gust vector calculations by reducing redundant geospatial computations for each asset. The main improvement is the introduction of a pre-computation step for spatial transformations and buffers in the GustModelArea class, which are then reused for each asset, greatly improving performance and code clarity.

Performance and code improvements:

  • Added a @cached_property called _precomputed to GustModelArea in wind_gust.py, which precomputes and caches the UTM projection, wind-affected buffer area, characteristic radius, and boundary geometry for each area, so these are only calculated once per area instead of for every asset.
  • Updated calculate_wind_gust_vectors in asset.py to use the precomputed spatial data from GustModelArea._precomputed, eliminating repeated and expensive GeoPandas operations for each asset.

Dependency and import changes:

  • Removed the unused geopandas import from asset.py since spatial operations are now handled in the pre-computation step.
  • Added imports for cached_property and a constant METERS_PER_MILE in wind_gust.py to support the new pre-computation logic. [1] [2]

- Replace EPSG:3857 (Web Mercator) with estimate_utm_crs() for distance accuracy
- Replace magic number 1609 with named constant meters_per_mile = 1609.344
- Avoid mutating the original GeoDataFrame during buffer operation
- Add cached_property _precomputed to GustModelArea that computes UTM CRS,
  boundary geometry, wind-affected buffer, and characteristic radius ONCE
- calculate_wind_gust_vectors now only reprojects the asset point (via pyproj
  Transformer) instead of creating GeoDataFrames per asset
- Remove unused geopandas import from asset.py
- ~10-50x faster for multi-asset simulations
@AadilLatif
AadilLatif merged commit 5595589 into main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant