Skip to content

getAvailability changes/deprecation warning message#33

Open
lkeyson-earthscope wants to merge 11 commits into
masterfrom
move-off-getAvailability
Open

getAvailability changes/deprecation warning message#33
lkeyson-earthscope wants to merge 11 commits into
masterfrom
move-off-getAvailability

Conversation

@lkeyson-earthscope

@lkeyson-earthscope lkeyson-earthscope commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

The IRISSeismic package has deprecatde getAvailability, so this MR moves ISPAQ off of any dependency that it has on that function.

  • adds a deprecation warning in getAvailability; mentions the change in behavior in upstream IRISSeismic::getAvailability
  • Uses getChannel for ph5 station service call
  • Uses IRISSeismic v1.9.0
  • removes forced update of obspy, logs warning instead
  • formatting updates
  • updates the way that irisseismic.py retrieves the ispaq version so that it doesn't have to be updated in two locations; requires setting it in init.py

@gillian-earthscope

Copy link
Copy Markdown
Contributor

What is the issue with ObsPy versions?

@lkeyson-earthscope

Copy link
Copy Markdown
Collaborator Author

When running on an older version of python, it prompted me to update obspy -- but then the version of python I was on was old enough that it would fail to update, and then would run the metrics code after that. Because it was failing, every time I ran the code, it prompted me and then wen through the entire try-to-update-but-fail process before running metrics each time. If I decided to not update obspy, it would just quit out of ISPAQ.

Shouldn't be a problem for a newer install like this, but it's possible that in the future the same thing could happen again and I'd rather it give a warning about it than force require an update.

@lkeyson-earthscope lkeyson-earthscope changed the title Move off of getAvailability getAvailability changes/deprecation warning message Jun 18, 2026
@lkeyson-earthscope

Copy link
Copy Markdown
Collaborator Author

Output when running ISPAQ now looks something like this (when running PH5)

(ispaq-1.9) keyson-H5QY61PJL2:ispaq laurakeyson$ ./run_ispaq.py -M basicStats -S 1B.W61..DP* --starttime 2025-02-13
2026-06-17 16:51:09 - INFO - Running ISPAQ version 3.5.0 on Wed Jun 17 16:51:09 2026
2026-06-17 16:51:27 - WARNING - getAvailability will be deprecated in a future release. The upstream IRISSeismic::getAvailability has been altered to remove the 'matchtimeseries' and 'includeavailability' parameters, so its output now matches that of getChannel.
2026-06-17 16:51:28 - INFO - Calculating simple metrics for 3 SNCLs on 2025-02-13
2026-06-17 16:51:28 - INFO - 000 Calculating simple metrics for 1B.W61..DP1
2026-06-17 16:54:50 - INFO - 001 Calculating simple metrics for 1B.W61..DP2
2026-06-17 16:57:55 - INFO - 002 Calculating simple metrics for 1B.W61..DPZ
2026-06-17 17:01:03 - INFO - Writing simple metrics to /Users/laurakeyson/IRIS_TOOLS/ISPAQ/ispaq/csv/basicStats_1B.W61..DPx_2025-02-13_simpleMetrics.csv
2026-06-17 17:01:03 - INFO - ALL FINISHED!
R callback write-console: Warning message:

R callback write-console: In getAvailability.IrisClient(obj, network, station, location, channel,  :
R callback write-console:

R callback write-console:  getAvailability is deprecated. https://service.earthscope.org/fdsnws/station service no longer supports parameters 'matchtimeseries' or 'includeavailability'. These parameters have been removed from this function and it now returns the same result as `getChannel.IrisClient`.

Where we have the ISPAQ messaging at top, and the Rcode messaging at the end

Comment thread ispaq/irisseismic.py Outdated
...
"""
logging.getLogger(__name__).warning(
"getAvailability will be deprecated in a future release. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say it is deprecated now and not in a future release. It will be defunct and removed in a future release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:
"getAvailability is deprecated and will be removed in a future release. The EarthScope fdsnws/station service no longer supports 'matchtimeseries' and 'includeavailability' parameters which are used by getAvailability. Without those parameters, getAvailability currently returns the same results as the getChannel function."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, there is a difference between the getAvailability in ISPAQ and that of IRISSeismic. This one can be deprecated now or could continue to exist while the underlying IRISSeismic::getAvailability has been changed (but not removed yet). The message does currently indicate that the upstream IRISSeismic::getAvailability has been changed to remove the parameters and will return the same as getChannel, but in reality the ISPAQ getAvailability function hasn't changed at all. matchtimeseries and includeavailability aren't even fields that can be passed along in ISPAQ's getAvailability.

I could at this point move ISPAQ off of ISPAQ's getAvailability and deprecate the function, that was my original plan and it's one of the changes I made before reverting back to using IRISSeismic::getAvailability.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matchtimeseries and includeavailability are hardcoded as parameters inside IRISSeismic getAvailability, but skipped if the source is PH5. So it does have this dependency, but it still works because of how ISPAQ is using it (or not using it). We're not intending ISPAQ to be used as a Python library for the CRAN R-code by users, so you're right that it doesn't really matter if it's explicitly deprecated or not. I think the important thing is to replace our use of the function so that when it gets removed from the R-code, ISPAQ does not break.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought that the updated v1.9.0 IRISSeismic::getAvailability removed those hardcoded matchtimeseries and includeavailability so that IRISSeismic::getAvailability no longer included those parameters at all. And then on the ISPAQ side, our only call out of (ISPAQ's) getAvailability includes the following:

 _R_getAvailability(
        r_client,
        network,
        station,
        location,
        channel,
        starttime,
        endtime,
        includerestricted,
        latitude,
        longitude,
        minradius,
        maxradius,
)

And then, yeah all other calls to the station service are done using obspy, which defaults to none for both matchtimeseries and includeavailability -- and ISPAQ doesn't provide either of those parameters for those calls either.

Regardless of the IRISSeismic::getAvailability behavior, I've switch back to having ISPAQ to use ISPAQ's getChannel, which relies on IRISSeismic::getChannel. So we're off of that dependency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, IRISSeismic did remove the parameters. I need more coffee.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, no problem - I think we're all on the same page now and I'm no longer second guessing my understanding of the changes to mustang-metrics

@gillian-earthscope

gillian-earthscope commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

This line 1025 of ispaq/concierge.py should be updated to use getChannel:

df = irisseismic.getAvailability(
to
df = irisseismic.getChannel(

Even though we're keeping the function available in ISPAQ, we shouldn't actually use the deprecated function when there is an alternative that returns the same result. We can just fix it and it will be transparent to the user with no warnings that they can't take action on.

@gillian-earthscope

gillian-earthscope commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The CHANGELOG.txt file needs to be updated. I think this is the best place to communicate the code changes rather than having warnings show up when running run_ispaq.py.

@lkeyson-earthscope

Copy link
Copy Markdown
Collaborator Author

This line 1025 of ispaq/concierge.py should be updated to use getChannel:

df = irisseismic.getAvailability( to df = irisseismic.getChannel(

Even though we're keeping the function available in ISPAQ, we shouldn't actually use the deprecated function when there is an alternative that returns the same result. We can just fix it and it will be transparent to the user with no warnings that they can't take action on.

I had originally made this change and then reverted to use getAvailability again since the underlying IRISSeismic::getAvailability still exists and works. But I can change it back to use ISPAQ's getChannel.

@lkeyson-earthscope lkeyson-earthscope marked this pull request as draft June 18, 2026 15:14
@lkeyson-earthscope lkeyson-earthscope marked this pull request as ready for review June 18, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants