irie 0.0.41__py3-none-any.whl → 0.0.42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of irie might be problematic. Click here for more details.

@@ -37,7 +37,7 @@ class AssetFilter(django_filters.FilterSet):
37
37
  def filter_year(self, queryset, name, value):
38
38
  ids = {
39
39
  asset.id for asset in queryset if (
40
- asset.nbi_data and int(asset.nbi_data["NBI_BRIDGE"]["Year Built"] or 0) <= int(value) #.year
40
+ asset.nbi_data and int(asset.nbi_data["NBI_BRIDGE"].get("Year Built",0) or 0) <= int(value) #.year
41
41
  )
42
42
  }
43
43
  return queryset.filter(id__in=ids)
@@ -31,7 +31,6 @@ REFERENCES
31
31
  import math
32
32
  import json
33
33
  from scipy.stats import norm
34
- from irie.apps.events.models import EventRecord
35
34
  from irie.apps.prediction.runners import Runner, RunID
36
35
  from irie.apps.prediction.models import PredictorModel
37
36
 
@@ -181,30 +180,30 @@ def _bridge_info(nbi: dict) -> dict:
181
180
  """
182
181
  try:
183
182
  nbi_bridge = nbi.get("NBI_BRIDGE", {})
184
- nbi_superstructure = nbi.get("NBI_SUPERSTRUCTURE_DECK", {})
183
+ nbi_supers = nbi.get("NBI_SUPERSTRUCTURE_DECK", {})
185
184
 
186
- # Parse "Skew Angle"
187
- skew_angle_str = nbi_bridge.get("Skew Angle", "0")
188
- if "99" in skew_angle_str: # Handle undefined skew
185
+ # 34: "Skew Angle"
186
+ skew_angle_str = nbi_bridge.get("Skew Angle", "99")
187
+ if "99" in skew_angle_str:
189
188
  skew_angle = 0
190
189
  else:
191
190
  skew_angle = float(skew_angle_str.split(" - ")[0])
192
191
 
193
192
  return {
194
193
  "state_code": StateCodes.California,
195
- "year_built": int(nbi_bridge.get("Year Built", 0)),
196
- "skew_angle": skew_angle,
194
+ "year_built": int(nbi_bridge.get("Year Built", 0)), # 27
195
+ "skew_angle": skew_angle, # 34
197
196
  "service_type": int(
198
- nbi_bridge.get("Type of Service on Bridge Code", "0 - Unknown").split(" - ")[0]
199
- + nbi_bridge.get("Type Of Service Under Bridge Code", "0 - Unknown").split(" - ")[0]
197
+ nbi_bridge.get("Type of Service on Bridge Code", "0 - Unknown").split(" - ")[0] # 42A
198
+ + nbi_bridge.get("Type Of Service Under Bridge Code", "0 - Unknown").split(" - ")[0] # 42B
200
199
  ),
201
- "material_flag": int(nbi_superstructure.get("Main Span Material", "0 - Unknown").split(" - ")[0]),
202
- "geometry_flag": int(nbi_superstructure.get("Main Span Design", "0 - Unknown").split(" - ")[0]),
203
- "span_count": int(nbi_superstructure.get("Number of Spans in Main Unit", 0)),
204
- "approach_spans": int(nbi_superstructure.get("Number of Approach Spans", 0)),
205
- "max_span_length": float(nbi_bridge.get("Length of Maximum Span", 0.0)),
206
- "total_length": float(nbi_bridge.get("Structure Length", 0.0)),
207
- "deck_width": float(nbi_bridge.get("Deck Width - Out to Out", 0.0)),
200
+ "material_flag": int(nbi_supers.get("Main Span Material", "0 - Unknown").split(" - ")[0]), # 43A
201
+ "geometry_flag": int(nbi_supers.get("Main Span Design", "0 - Unknown").split(" - ")[0]), # 43B
202
+ "span_count": int(nbi_supers.get("Number of Spans in Main Unit", 0)), # 45
203
+ "approach_spans": int(nbi_supers.get("Number of Approach Spans", 0)), # 46
204
+ "max_span_length": float(nbi_bridge.get("Length of Maximum Span", 0.0)), # 48
205
+ "total_length": float(nbi_bridge.get("Structure Length", 0.0)), # 49
206
+ "deck_width": float(nbi_bridge.get("Deck Width - Out to Out", 0.0)), # 52
208
207
  }
209
208
  except ValueError as e:
210
209
  raise ValueError(f"Error processing NBI data: {e}")
@@ -214,12 +213,20 @@ def _bridge_info(nbi: dict) -> dict:
214
213
 
215
214
  def _hazus_curve(type: int, properties: dict, sa_03s: float, sa_10s: float, soil_type: str) -> dict:
216
215
  """
217
- Compute fragility probabilities for the four damage states and optionally generate fragility curves.
216
+ Compute fragility probabilities for the four damage states
218
217
 
219
218
  See page 7-14 of [1]
220
- Args:
219
+ See reference [3] for details
220
+ See Section 7.1.6.2 of [1] for example
221
+
222
+ Parameters
221
223
  - type (int): Bridge classification (integer from 1 to 28).
222
- - properties (dict): Dictionary containing bridge-specific properties.
224
+ - properties (dict): Dictionary containing NBI data:
225
+ - span_count (N),
226
+ - skew_angle (α),
227
+ - deck_width (W),
228
+ - max_span_length (Lmax), # 48
229
+ - total_length (L), # 49
223
230
  - pga (float): Peak Ground Acceleration (g).
224
231
  - sa_03s (float): Spectral Acceleration at 0.3 seconds (g).
225
232
  - sa_10s (float): Spectral Acceleration at 1.0 seconds (g).
@@ -227,6 +234,10 @@ def _hazus_curve(type: int, properties: dict, sa_03s: float, sa_10s: float, soil
227
234
 
228
235
  Returns:
229
236
  - dict: Fragility probabilities for Slight, Moderate, Extensive, and Complete damage states.
237
+
238
+ Note
239
+ The skew angle is defined as the angle between the centerline of a
240
+ pier and a line normal to the roadway centerline.
230
241
  """
231
242
  # Validate inputs
232
243
  required_keys = {"span_count", "skew_angle"}
@@ -242,6 +253,9 @@ def _hazus_curve(type: int, properties: dict, sa_03s: float, sa_10s: float, soil
242
253
  skew_angle = properties["skew_angle"]
243
254
 
244
255
  # Step 2: Get soil-amplified shaking parameters
256
+ # Evaluate the soil-amplified shaking at the bridge site. That is, get the peak ground acceleration
257
+ # (PGA), spectral accelerations (Sa at 0.3 seconds and Sa at 1.0 second) and the permanent ground
258
+ # deformation (in inches).
245
259
  modified_values = modify_ground_motion(soil_type, None, sa_03s, sa_10s)
246
260
  modified_sa_03s = modified_values['sa_03s']
247
261
  modified_sa_10s = modified_values['sa_10s']
@@ -23442,7 +23442,6 @@ svg.text-dark .color-background {
23442
23442
  padding-left: 0.75rem;
23443
23443
  padding-right: 0.75rem;
23444
23444
  font-weight: 500;
23445
- color: #ffffff;
23446
23445
  font-size: 0.75rem;
23447
23446
  }
23448
23447
  .navbar-vertical .navbar-nav .nav-link > i {