Using obspy at colab.research?

Hi,

I often have issues with students using ObsPy. As each student has its own computer, anaconda version, etc, it’s not easy to solve all problems and I’ve been exploring using python online platforms, like Google’s Colab (https://colab.research.google.com).

It works mostly well, but maps are not generated, I suspect due to some problem with Cartopy (although simple cartopy maps are well plotted). For example, the code below will not generate the map of stations.

Does anyone have any idea of how to fix this? Or alternatively, do you recommend a better online platform for shared python editing and running?

Many thanks!
Susana

… Code

!pip install cartopy obspy

from obspy.clients.fdsn import Client
from obspy import Catalog, UTCDateTime

client = Client(“USGS”)

ti = UTCDateTime(“2022-01-01”)
tf = UTCDateTime(“2023-01-01”)
minMag = 7

cat = client.get_events(starttime=ti, endtime=tf, minmagnitude=minMag)

print(cat)
cat.plot()

I was able reproduce your issue, but I could not resolve it.

Hi Susana, we have had some tickets towards colab in the past, maybe you can find something there: Issues · obspy/obspy · GitHub

Especially this one looks like it might have input:

Aside from those, you could try if seismo live works for your classes. It has been a bit wonky over the years but currently the binder servers seem quite good again.
https://seismo-live.github.io/

(click through to any notebook and then “open in binder” at the top)

Hi Tobias, that suggestion by Chu-Te-Ethan-Chen that you sent solved it for me - many thanks! :slight_smile:

I will also give SeismoLive a try!

1 Like