Skip to content

Commit

Permalink
Minor gui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
geojunky committed Apr 24, 2024
1 parent c412b67 commit b4ff260
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions seismic/ASDFdatabase/FederatedASDFViewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from scipy.stats import circmean as cmean
from collections import defaultdict
from shapely import geometry
import traceback

class CustomPPSD(PPSD):
def __init__(self, stats, skip_on_gaps=False,
Expand Down Expand Up @@ -137,6 +138,7 @@ def printException(e: Exception):
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(exc_type, e, fname, exc_tb.tb_lineno)
print(traceback.format_exc())
# end func

class FigureImage(gui.Image):
Expand Down Expand Up @@ -251,7 +253,7 @@ def setMapImage(nc, minLon=None, minLat=None, maxLon=None, maxLat=None):
# end for
lons = np.array(lons)
lats = np.array(lats)

boundsProvided = False
if(minLon is None and minLat is None and maxLon is None and maxLat is None):
minLon = np.min(lons)
Expand Down Expand Up @@ -283,7 +285,7 @@ def setMapImage(nc, minLon=None, minLat=None, maxLon=None, maxLat=None):
if(len(lons)>0):
clon = cmean(lons, high=180, low=-180)
# end if

crs = ccrs.PlateCarree(central_longitude=clon)
left = 0.05
bottom = 0.05
Expand Down Expand Up @@ -312,8 +314,9 @@ def setMapImage(nc, minLon=None, minLat=None, maxLon=None, maxLat=None):
ax.annotate(sc, xy=(pxl, pyl), fontsize=7, zorder=2)
# end for

# set extents only when bounds have been provided
if(boundsProvided):
# set extents only when bounds have been provided or if there's a single
# station to be plotted
if(boundsProvided or len(lons)==1):
ax.set_extent([minLon, maxLon, minLat, maxLat], crs=ccrs.PlateCarree())
# end if

Expand Down
2 changes: 1 addition & 1 deletion seismic/ASDFdatabase/waveform_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def fft_taper(data):
_spec, _ = mlab.psd(stream[i].data.astype('float32'), NFFT=self.NFFT,
Fs=self.sampling_rate,
detrend=mlab.detrend_linear, window=fft_taper,
noverlap=0., sides='onesided',
noverlap=0, sides='onesided',
scale_by_freq=True)
if (spec is None):
spec = _spec
Expand Down

0 comments on commit b4ff260

Please sign in to comment.