Gracefully handle missing availability service - #13
Conversation
…se merging for gaps
gillian-earthscope
left a comment
There was a problem hiding this comment.
Mostly just comments about updating IRIS references to EarthScope
| testURL = ( | ||
| f"https://service.earthscope.org/mustang/measurements/1/query?" | ||
| f"metric=ts_percent_availability_total&net=IU&sta=ANMO&loc=00&chan=BHZ&" | ||
| f"format=text&timewindow={startDate},{endDate}&nodata=404" |
There was a problem hiding this comment.
Suggest using the metrics web service for a query that is not dependent on a network or time window:
https://service.earthscope.org/mustang/metrics/1/query?metric=ts_percent_availability_total&output=html&nodata=404
| except urllib.error.HTTPError as e: | ||
| if e.code == 410: | ||
| print( | ||
| f"WARNING: {serviceKey}-availability service is down, falling back to MUSTANG percent_availability for data extents" |
There was a problem hiding this comment.
HTTP code 410 is specific for the reason "Gone". Suggest this warning instead of "down":
"WARNING: EarthScope {serviceKey}-availability service is gone, falling back to MUSTANG percent_availability for data extents"
| @@ -1728,8 +1792,8 @@ | |||
| f"This report is intended as a quick, broad overview of the quality of the data archived for the network " | |||
| f"and time period specified above. IRIS' goal in generating these reports is to give PIs for temporary " | |||
There was a problem hiding this comment.
EarthScope's goal
| f"and time period specified above. IRIS' goal in generating these reports is to give PIs for temporary " | ||
| f"experiments better insight into the quality of their data archived at the DMC, as well as to demonstrate " | ||
| f'the utility provided by the IRIS DMC quality assurance system <a href="http://service.iris.edu/mustang/?" target="_blank">MUSTANG</a> ' | ||
| f'the utility provided by the IRIS DMC quality assurance system <a href="http://service.earthscope.org/mustang/?" target="_blank">MUSTANG</a> ' |
There was a problem hiding this comment.
EarthScope quality assurance system
| @@ -1768,7 +1839,7 @@ | |||
| f"are from the IRIS DMC {availabilityServiceLink}. " | |||
There was a problem hiding this comment.
IRIS DMC -> EarthScope
| f"<br/><br/>" | ||
| f"The report will include selected channels if specified, or all available channels if not. To see the complete metadata holdings for this experiment, visit this link:" | ||
| f'<p><a href="http://ds.iris.edu/mda/{network}/?starttime={startDate}T00:00:00&endtime={endDate}T23:59:59" target="_blank"> ' | ||
| f"IRIS Metadata Aggregator (MDA) for {network}: {startDate} to {endDate}</a></p>\n" |
There was a problem hiding this comment.
EarthScope Metadata Aggregator
| f"and the many metrics and products it generates. " | ||
| f"For PIs, we hope that these reports will " | ||
| f"inform the range of data availability, continuity, and noise levels existing across the network and potentially " | ||
| f"which stations are problematic and might be avoided for ongoing data analysis. For PASSCAL, these reports may provide lessons " |
There was a problem hiding this comment.
PASSCAL -> the EarthScope Primary Instrument Center (EPIC)
| @@ -1728,8 +1792,8 @@ | |||
| f"This report is intended as a quick, broad overview of the quality of the data archived for the network " | |||
| f"and time period specified above. IRIS' goal in generating these reports is to give PIs for temporary " | |||
| f"experiments better insight into the quality of their data archived at the DMC, as well as to demonstrate " | |||
There was a problem hiding this comment.
archived at EarthScope
| f"<li> Available data extents in blue </li> " | ||
| f"<li> Gaps in black </li>" | ||
| f"</ol>" | ||
| f"The metadata extents are retrieved from the IRIS DMC {stationServiceLink}, " |
There was a problem hiding this comment.
IRIS DMC -> EarthScope
| if not services: | ||
| availabilityIntroText = ( | ||
| f"{availabilityIntroText} <br/><br/>" | ||
| f"<b>Note:</b> the availability service was unavailable when this report was generated, " |
There was a problem hiding this comment.
The EarthScope availability service ...
The FDSN fdsnws-availability service and MUSTANG's ts_* time-series metrics (e.g. ts_percent_availability_total, ts_num_gaps) are currently down for an undetermined period. Though their return will likely occur at the same time, these two services could go down and come back independently of each other. This PR lets PIQQA reports keep generating while either or both are unavailable, and switch back onto them automatically (no manual flag/config change) once they recover.
What changed
Independent health checks, one per service, run once per report:
Fallback paths when a service is down:
Updated urls:
This MR also bumps python to 3.12, off of end-of-life 3.9.
Example report that was run on the latest code:
UW_2026.zip