Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
79seismo
@79seismo
@vivigb I have a feeling that you're doing something wrong with SAC. As @ThomasLecocq mentioned, your channel codes haven't changed after the rotation. SAC does change these codes. Are you using "rotate to GCP"?
vivigb
@vivigb
@ThomasLecocq @79seismo I think SAC won't rename the components when using the rotate command.
Please see this link
@79seismo yeah i am using " rotate to GCP"
brioglade
@brioglade_gitlab
from obspy.imaging.radpattern import plot_3drpattern
mt = [0.91, -0.89, -0.02, 1.78, -1.55, 0.47]
plot_3drpattern(mt,kind='p_sphere')

ModuleNotFoundError Traceback (most recent call last)

<ipython-input-2-4718903f829c> in <module>
1 import obspy
----> 2 from obspy.imaging.radpattern import plot_3drpattern
3 mt = [0.91, -0.89, -0.02, 1.78, -1.55, 0.47]
4 plot_3drpattern(mt,kind='p_sphere')

ModuleNotFoundError: No module named 'obspy.imaging.radpattern'

hi,how can I fix it?
Elliott Sales de Andrade
@QuLogic
What is radpattern? There's no such thing in ObsPy
brioglade
@brioglade_gitlab
Elliott Sales de Andrade
@QuLogic
That is very old, and never released like that, which you can see in that PR
brioglade
@brioglade_gitlab
@QuLogic So what's the right way to write to do seismic source ridiation pattern?I am a new hand.Thank you very much.
What's the CMTSOLUTION file format to write?Do you have an example?Thank you.
Calum Chamberlain
@calum-chamberlain
This first thing that comes up when I google "obspy radiation plot" is this which is what appears to have been the merged change in PR #1192. It looks like you might want to check that page of the obspy docs out and see if that is what you want.
Calum Chamberlain
@calum-chamberlain

For your second question, CMTSOLUTION is a standard format that looks like this.

However, the Event.plot() with defaults to kind=('beachball', 'p_sphere', 's_sphere') calls the obspy.imaging.source.plot_radiation_pattern under the hood, which if you have the moment-tensor and no Event might be simpler to call.

Calum Chamberlain
@calum-chamberlain
I didn't know about this though - they look like really cool plots!
brioglade
@brioglade_gitlab
@calum-chamberlain Thank you very much!
79seismo
@79seismo
@vivigb yes, you are right, KCMPNM has to be changed manually. However, you should read in only the horizontal components for rotate to GCP. The fact that your Z is also changing after the rotation suggests that you're doing something additional to rotating? Rotate to GCP is only a horizontal operation.
Emmanuel D. Castillo Taborda
@ecastillot

Good moorning!
I tried to install obspy with miniconda in google collab. Apparently, it was installed ok. However, when I wanted to use ' obspy.read() ' appears this error: 'TypeError: Unknown format for file /usr/local/lib/python3.6/site-packages/obspy/core/data/BW_RJOB.xml'

can you help me please? Maybe obspy can't be installed with conda in google collab? When I installed with pip, it does his job ok. But for certain reasons I need to install it with conda.

In the next link, you can see the collab notebook that I'm using:
https://colab.research.google.com/drive/1eXNROuqsYeWjHqEyCbIDbZFlgSlPKNMS?usp=sharing

Calum Chamberlain
@calum-chamberlain
Kia Ora, this is the same as obspy/obspy#2547 - the solution then was to use pip and restart the run-time. I don't know if simply restarting the run-time is enough with conda installs, but it is worth a try.
Emmanuel D. Castillo Taborda
@ecastillot
@calum-chamberlain Regards,
I usually use this solution for pip. However, with conda installs are not the same. The error persists.
Thomas Lecocq
@ThomasLecocq
you have to restart the runtime/kernel
the install is likely correct, but obspy doens't find the 'entry points' (=all format readers are defined via entry points) if the kernels are not restarted
Emmanuel D. Castillo Taborda
@ecastillot
@ThomasLecocq have you tried it with conda? Just like I told to @calum-chamberlain , this solution is ok for pip. However, when I restart the kernel after the conda installation, nothing happens.
Thomas Lecocq
@ThomasLecocq
I never used google collab. but it shouldn't be different (and I didn't understand from your answer that it actually worked for you)
and are you working in the right env ?
Emmanuel D. Castillo Taborda
@ecastillot
Yes, I'm agree with you, it shouldn't be different. For this reason I don't understand what is the mistake... I guess that I am working in the right env because
as you can see in the link that I posted, obspy is well imported.
Thomas Lecocq
@ThomasLecocq
So when you restart the kernel, do you actually reinit the conda env? Could you deactivate and activate, evne if it is the base env?
uky-jps
@uky-jps
MLMC.20200928T0000-20200928T0059.spectrogram.png
I am creating 1x3 plots with each component (1,2,Z) hour long spectrograms using Obspy, but I am creating each hour long plot to be compared to other hour long plots. I want to set the cmap scale to be based on a min/max value that I hard code as opposed to the "clip=[0.0-1.0]" scaled option that is currently available, because that "clip" for the cmapping range is based on the min/max values calculated from that hour specifically (as far as I can tell). Is there a way with Trace.spectrogram() that I can set the values that cmap is based on, as opposed to the min/max from the current hour? any help here is appreciated! ( https://docs.obspy.org/packages/autogen/obspy.imaging.spectrogram.spectrogram.html ). As an aside, here is a current example of my plot. above.
my current code that plots one of these individual spectrograms looks like
stm[ii].spectrogram(show=False, axes=ax[ii], clip=[0.35, 0.95], dbscale=True, cmap='jet')
Emmanuel D. Castillo Taborda
@ecastillot

@ThomasLecocq Thanks a lot!, with your comment I could recognize that if I restart the kernel, collab doesn't reinit the conda env.
With this help https://datascience.stackexchange.com/questions/75948/how-to-setup-and-run-conda-on-google-colab . I could find the way to correct it, but only it's ok if I run all my python code in one cell, you can see the way in the next link: https://github.com/ecastillot/notebooks/blob/master/test_obspy_condainstall.ipynb

Due to run all my python notebook code in one cell is uncomfortable, then I tried to type "!conda deactivate" or "!conda activate" for deactivate or activate the env . However, this error appears :
"CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.
To initialize your shell, run

$ conda init <SHELL_NAME>

Currently supported shells are:

  • bash
  • fish
  • tcsh
  • xonsh
  • zsh
  • powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'."

Emmanuel D. Castillo Taborda
@ecastillot
For now I am satisfied with the solution that I showed. If someone finds a better way that would be great!
Thomas Lecocq
@ThomasLecocq
Top!!??
Top!!!
Tobias Megies
@megies

generic question related to "best practice": how far away from each other could you have two sensors sharing net+sta , but not loc ids ? I imagine on a field with up to 100m apart, logged on a single unit? or borehole strings with different sensors at different depths ?

I think SEED manual says something about it, pretty sure officially its less than 100m, more like 20m or something, but personally I wouldnt be too picky, most important what fits your workflow

Thomas Lecocq
@ThomasLecocq
Trueeeeeee
Thomas Lecocq
@ThomasLecocq
did some loading time tests in #2748 ; I initially thought that the matplotlib stack was the culprit, but it's interesting to see that it's not !
vivigb
@vivigb
Hi ,everyone
Me again with the doubts related to obspy rotate command.
Why I can't rotate the files with component names such as BH1 & BH2 ? it seems like there is no change after using rotate command on such files!! Also there is no change in component's name after applying rotation!
Thomas Lecocq
@ThomasLecocq
did you apply the changes (1,2,etc) shown in the doc ?https://docs.obspy.org/packages/autogen/obspy.core.stream.Stream.rotate.html
Tobias Megies
@megies
it will get passed down from your stream.rotate() call
vivigb
@vivigb
@ThomasLecocq @megies No I didn't try those changes shown in the docs.I am little confused in that part .
Should I first rotate to ->ZNE and then use rotate to'NE->RT'?
and I am little confused with the syntax also.
st.rotate('->ZNE',back_azimuth=st[0].stats.sac.baz,["Z", "1", "2"])
Thomas Lecocq
@ThomasLecocq
dunno, I never used 1,2 traces in rotations
but it would make sense, Z12->orientation_from_response->ZNE , then ZNE->baz->ZRT
Tobias Megies
@megies
@vivigb if you want to go from unoriented to RT, indeed you need to do ->ZNE first, which will solely rely on the sensor orientation specified in your Inventory. Your Traces should then be rotated and relabled to ZNE. Then do a second rotate call with NE->RT, specifying the back azimuth.
vivigb
@vivigb
@megies Thank you very much... <3
vivigb
@vivigb
Is there any option to mass download stationXML files alone? (since I already have the IRIS data and need statioXML files to rotate BH1 BH2 components to BHR and BHT components)
Tobias Megies
@megies
if it's from IRIS just get the metadata through their FDSN WS? they can serve huge amounts of metadata without problems (goin into double digit GB), so just be sure your means of downloading can handle that
or be selective and assemble an appropriate "bulk" file indicating what exactly you need based on your downloaded waveform data
vivigb
@vivigb
How to resolve this issue?
>>> inv.plot(projection="local")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "c:\python37\lib\site-packages\obspy\core\inventory\inventory.py", line 959, in plot
    from obspy.imaging.maps import plot_map
  File "c:\python37\lib\site-packages\obspy\imaging\maps.py", line 33, in <module>
    from mpl_toolkits.basemap import Basemap
  File "c:\python37\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 42, in <module>
    from .proj import Proj
  File "c:\python37\lib\site-packages\mpl_toolkits\basemap\proj.py", line 6, in <module>
    from matplotlib.cbook import dedent
ImportError: cannot import name 'dedent' from 'matplotlib.cbook' (c:\python37\lib\site-packages\matplotlib\cbook\__init__.py)