Pr/84 - #85
Merged
Merged
Pr/84#85
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
GustModelAreaclass, which are then reused for each asset, greatly improving performance and code clarity.Performance and code improvements:
@cached_propertycalled_precomputedtoGustModelAreainwind_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.calculate_wind_gust_vectorsinasset.pyto use the precomputed spatial data fromGustModelArea._precomputed, eliminating repeated and expensive GeoPandas operations for each asset.Dependency and import changes:
geopandasimport fromasset.pysince spatial operations are now handled in the pre-computation step.cached_propertyand a constantMETERS_PER_MILEinwind_gust.pyto support the new pre-computation logic. [1] [2]