Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: differentiate Participation Rate (system) vs Conditional Participation Rate #59

Open
chrisbc opened this issue Aug 1, 2024 · 1 comment
Labels
API for project filtering solvis-graphql-api for project filtering

Comments

@chrisbc
Copy link
Member

chrisbc commented Aug 1, 2024

Currently the API is providing just the Conditional Participation Rate, which is usually much lower and may be misleading

# some solvis code for comparison
# get ruptures passing through a named parent fault(s)
TARGET_FAULTS = ['Opotiki 3', 'Calypso 2']
ruptures = helper.ruptures_for_parent_fault_names(TARGET_FAULTS) 

# get rupture fault sections (rs) with rates for those ruptures
df0 = solution.rs_with_rupture_rates
rupture_sections_df = df0[df0["Rupture Index"].isin(ruptures)]

opo_section = 1426 # Opotiki 3, Subsection 2
cal_section = 217  # Calypso 2, Subsection 1
df0 = solution.rs_with_rupture_rates

print("rate.sum() filtered by section ID: `Participation Rate` (all ruptures in the system)")
print(f'Opotiki rate: {df0[df0.section==opo_section]["rate_weighted_mean"].sum()}')
print(f'Calypso rate: {df0[df0.section==cal_section]["rate_weighted_mean"].sum()}')

print("API rate.sum() filtering by rupture ID: `Conditional Participation Rate` (filtered by rupture id or attribute)")
df0 = df0[df0["Rupture Index"].isin(ruptures)]
print(f'Opotiki rate: {df0[df0.section==opo_section]["rate_weighted_mean"].sum()}')
print(f'Calypso rate: {df0[df0.section==cal_section]["rate_weighted_mean"].sum()}')

and in graphql api...

query q3 {
  filter_rupture_sections(filter:
    { model_id: "NSHM_v1.0.4" 
      #location_ids: ["MRO", "WLG"]  
      fault_system:"CRU" 
      radius_km:125
      corupture_fault_names: ["Opotiki 3"]
     filter_set_options:{multiple_locations: INTERSECTION
      }
     
  	}
  ) {
    model_id
    fault_traces
  }
}
@chrisbc
Copy link
Member Author

chrisbc commented Aug 1, 2024

related to #46 which will also need to differentiate which rate is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API for project filtering solvis-graphql-api for project filtering
Projects
None yet
Development

No branches or pull requests

1 participant