How to download restricted data from IRIS with access token

Hey, I am granted access to restricted data on IRIS and have my username and an access token.

I am wondering how do I use this to download data with Obspy? I tried Client.set_credentials() as well as specifying the username and password directly in Client(). Either worked. I still got no data from the stations. Is there an example showing the correct usage?

Thanks

I’m not aware of standard FDSN using a “token”. As far as I know you need a username and password. Setting it when initializing the client should be the way, I believe.

Can you use Client(..., user=.., password=.., debug=True)? That will show the URLs that are requested from the server.
To make sure your credentials are OK, you could also try to do a request through your browser directly, either using one of the URLs that get printed on screen when using the debug option like mentioned above, or go to https://service.iris.edu/fdsnws/dataselect/1/ and see at the bottom the mention of the .../queryauth?.. endpoint.

Sorry by “token” I meant a password. It is being referred to as an access token on certain pages of IRIS though.
I saw an example usage with the mass downloader, so I am quite sure my usage should be correct. But does this work with get_waveforms()?
Here is what I have:

client = Client("IRIS", user="username", password="password")
client.get_waveforms(...)

but there is no data for many events I have tried.

I am completely unfamiliar with the queryauth approach so I would really like to use my go-to which is Obspy. When I followed your advice to check the website, I was prompted to enter my username and password, after which I got an error but it’s about not specifying any details on my data request. So it seems the credentials are correct.

Did you add Client(..., debug=True)? It prints out queryauth URLs that you could try in your browser with your credentials as a double check.
As long as you do not have a reproducible case where you can get a certain piece of data through the FDSN web interface but not through obspy there’s just too many other reasons for a failed request to rule out (bad request, no data for request, etc etc).

As it stands, we can’t easily verify ad-hoc test the restricted data access, sadly. I’ve asked IRIS/SAGE before if the could set up some dummy restricted data so we are able to test it, but that sadly didn’t happen, so we’re kinda left in the dark in terms of testing.

I did try the debug option but it only printed out a standard IRIS URL.

I just figured out my issues though. I had hard-coded channel codes for a previous work which are different for this new array, and that was the reason why I kept getting no data.

Sorry for the trouble!

1 Like