usgs / libcomcat

Library of functions and wrapper scripts for accessing ANSS ComCat server data
Other
71 stars 41 forks source link

libcomcat.search fuction get_event_by_id() won't get scenario events #251

Closed cbworden closed 3 years ago

cbworden commented 3 years ago

Describe the bug When requesting a scenario event (e.g., bssc2014903_m6p09_se) get_event_by_id() fails. I don't know if this is because the scenario exists at https://earthquake.usgs.gov/scenarios/eventpage/bssc2014903_m6p09_se/executive rather than at https://earthquake.usgs.gov/earthquakes/eventpage/bssc2014903_m6p09_se/executive or if there is some other issue, but it would be nice if scenario events would be found by get_event_id().

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environmnet (please complete the following information):

Additional context Add any other context about the problem here.

cbworden commented 3 years ago

Fixing this will likely fix ShakeMap issue 1133: https://github.com/usgs/shakemap/issues/1133

jmfee-usgs commented 3 years ago

@cbworden : it appears there is a scenario parameter for that purpose: https://github.com/usgs/libcomcat/blob/bfbc5bfd682cd78a6a08d1e0ba39264f3b122071/libcomcat/search.py#L219

cbworden commented 3 years ago

Okay. It looks like the products come under the label 'scenario-shakemap' rather than just 'shakemap' and a few other little quirks like that, but it basically seems to work.

jmfee-usgs commented 3 years ago

@cbworden : the separate product type and endpoint are by design to make it harder to accidentally process a scenario as an actual event.

cbworden commented 3 years ago

It makes sense, it just requires some poking around to figure out what changes. In this case I was dealing with three packages to get a program to handle both real events and scenarios, so it took a while to find all the places that needed "if" statements. Fun! :roll_eyes: