@@ -21,6 +21,8 @@ def section(streams: tp.List[obspy.Stream], *args,
2121 align : bool = False ,
2222 absmax : float | None = None ,
2323 window : bool = False ,
24+ plot_geometry : bool = True ,
25+ plot_amplitudes : bool = True ,
2426 ** kwargs ):
2527 """Plots a section of seismograms of given stream or stream set. The
2628 stream(s) need(s) to contain traces which have the distance parameter
@@ -153,9 +155,10 @@ def section(streams: tp.List[obspy.Stream], *args,
153155 maxs .append (streammaxs )
154156
155157 if absmax is None :
156- absmax = np .max (maxs )
158+ absmax = np .max (np . max ( maxs ) )
157159
158160 # Plot overall max amplitude label
161+ print (maxs )
159162 plot_label (ax , f'max|u|: { absmax :.5g} m' ,
160163 fontsize = 'small' , box = False , dist = 0.0 , location = 4 )
161164
@@ -169,11 +172,13 @@ def section(streams: tp.List[obspy.Stream], *args,
169172 # Define ylabels on the left axis to station info
170173 ylabels = []
171174 for tr in pstreams [0 ]:
172- ylabel = f"{ tr .stats .network } .{ tr .stats .station } \n " \
173- f"D:{ tr .stats .distance :>6.2f} "
175+ ylabel = f"{ tr .stats .network } .{ tr .stats .station } "
176+
177+ if plot_geometry :
178+ f"\n D:{ tr .stats .distance :>6.2f} "
174179
175- if hasattr (tr .stats , 'azimuth' ):
176- ylabel += f"\n Az: { tr .stats .azimuth :>5.1f} "
180+ if hasattr (tr .stats , 'azimuth' ):
181+ ylabel += f"\n Az: { tr .stats .azimuth :>5.1f} "
177182
178183 ylabels .append (ylabel )
179184
@@ -187,29 +192,36 @@ def section(streams: tp.List[obspy.Stream], *args,
187192 # Set y values on the right axis to max values
188193 ax2 = ax .secondary_yaxis ("right" )
189194
190- # Make ticks contain the absolute max value of each trace
191- ticks = []
192- for _i in range (Ntraces ):
193- label = ""
194- for _j in range (Nstreams ):
195- label += f"{ labels [_j ][0 ].upper ()} :{ maxs [_j ][_i ]:>10.4g} "
196- # Add newline if not last trace
197- if Nstreams > 1 and _j != Nstreams - 1 :
198- label += "\n "
199- ticks .append (label )
200-
201- # Set tick labels
202- ax2 .set_yticks (y , ticks ,
203- verticalalignment = 'center' ,
204- horizontalalignment = 'left' ,
205- fontsize = 'small' )
206-
207- # Remove spine
195+ # Remove spine
208196 ax2 .spines .right .set_visible (False )
209197
210198 # Remove ticks
211199 ax2 .tick_params (left = False , right = False )
212200
201+ if plot_amplitudes :
202+
203+ # Make ticks contain the absolute max value of each trace
204+ ticks = []
205+ for _i in range (Ntraces ):
206+ label = ""
207+ for _j in range (Nstreams ):
208+ label += f"{ labels [_j ][0 ].upper ()} :{ maxs [_j ][_i ]:>10.4g} "
209+ # Add newline if not last trace
210+ if Nstreams > 1 and _j != Nstreams - 1 :
211+ label += "\n "
212+ ticks .append (label )
213+
214+ # Set tick labels
215+ ax2 .set_yticks (y , ticks ,
216+ verticalalignment = 'center' ,
217+ horizontalalignment = 'left' ,
218+ fontsize = 'small' )
219+
220+ else :
221+
222+ # Remove ticks
223+ ax2 .tick_params (left = False , right = False , labelright = False )
224+
213225 # Set time arguments for the plotting
214226 if origin_time is not None :
215227 time_args = dict (type = 'relative' , reftime = origin_time )
0 commit comments