Merge branch 'master' into develop
Conflicts: pylot/core/read/data.py
This commit is contained in:
commit
7785bd1900
16
QtPyLoT.py
16
QtPyLoT.py
@ -42,7 +42,8 @@ from pylot.core.read.data import Data
|
|||||||
from pylot.core.read.inputs import FilterOptions, AutoPickParameter
|
from pylot.core.read.inputs import FilterOptions, AutoPickParameter
|
||||||
from pylot.core.pick.autopick import autopickevent
|
from pylot.core.pick.autopick import autopickevent
|
||||||
from pylot.core.util.defaults import FILTERDEFAULTS
|
from pylot.core.util.defaults import FILTERDEFAULTS
|
||||||
from pylot.core.util.errors import FormatError, DatastructureError
|
from pylot.core.util.errors import FormatError, DatastructureError,\
|
||||||
|
OverwriteError
|
||||||
from pylot.core.util.connection import checkurl
|
from pylot.core.util.connection import checkurl
|
||||||
from pylot.core.util.utils import fnConstructor, createEvent, getLogin,\
|
from pylot.core.util.utils import fnConstructor, createEvent, getLogin,\
|
||||||
createCreationInfo, getGlobalTimes
|
createCreationInfo, getGlobalTimes
|
||||||
@ -399,7 +400,18 @@ class MainWindow(QMainWindow):
|
|||||||
def saveData(self):
|
def saveData(self):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
exform = settings.value('data/exportFormat', 'QUAKEML')
|
exform = settings.value('data/exportFormat', 'QUAKEML')
|
||||||
|
try:
|
||||||
self.getData().applyEVTData(self.getPicks())
|
self.getData().applyEVTData(self.getPicks())
|
||||||
|
except OverwriteError:
|
||||||
|
msgBox = QMessageBox()
|
||||||
|
msgBox.setText("Picks have been modified!")
|
||||||
|
msgBox.setInformativeText("Do you want to overwrite the picks and save?")
|
||||||
|
msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard |
|
||||||
|
QMessageBox.Cancel)
|
||||||
|
msgBox.setDefaultButton(QMessageBox.Save)
|
||||||
|
ret = msgBox.exec_()
|
||||||
|
if ret == QMessageBox.Save:
|
||||||
|
print('Overwrite and Save')
|
||||||
try:
|
try:
|
||||||
self.getData().exportEvent(self.fname, exform)
|
self.getData().exportEvent(self.fname, exform)
|
||||||
except FormatError:
|
except FormatError:
|
||||||
@ -407,7 +419,7 @@ class MainWindow(QMainWindow):
|
|||||||
except AttributeError, e:
|
except AttributeError, e:
|
||||||
print 'warning: {0}'.format(e)
|
print 'warning: {0}'.format(e)
|
||||||
directory = os.path.join(self.getRoot(), self.getEventFileName())
|
directory = os.path.join(self.getRoot(), self.getEventFileName())
|
||||||
file_filter = "Seismic observation files (*.cnv *.obs *.xml)"
|
file_filter = "QuakeML file (*.xml);;VELEST observation file format (*.cnv);;NonLinLoc observation file (*.obs)"
|
||||||
fname = QFileDialog.getSaveFileName(self, 'Save event data ...',
|
fname = QFileDialog.getSaveFileName(self, 'Save event data ...',
|
||||||
directory, file_filter)
|
directory, file_filter)
|
||||||
fbasename, exform = os.path.splitext(fname[0])
|
fbasename, exform = os.path.splitext(fname[0])
|
||||||
|
@ -12,7 +12,7 @@ from obspy.core.event import Event, ResourceIdentifier, Pick, WaveformStreamID
|
|||||||
|
|
||||||
from pylot.core.read.io import readPILOTEvent
|
from pylot.core.read.io import readPILOTEvent
|
||||||
from pylot.core.util.utils import fnConstructor, getGlobalTimes
|
from pylot.core.util.utils import fnConstructor, getGlobalTimes
|
||||||
from pylot.core.util.errors import FormatError
|
from pylot.core.util.errors import FormatError, OverwriteError
|
||||||
|
|
||||||
|
|
||||||
class Data(object):
|
class Data(object):
|
||||||
@ -146,6 +146,9 @@ class Data(object):
|
|||||||
self.wfdata = self.getOriginalWFData().copy()
|
self.wfdata = self.getOriginalWFData().copy()
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
|
|
||||||
|
def resetPicks(self):
|
||||||
|
self.getEvtData().picks = []
|
||||||
|
|
||||||
def restituteWFData(self, invdlpath, prefilt):
|
def restituteWFData(self, invdlpath, prefilt):
|
||||||
st = self.getWFData()
|
st = self.getWFData()
|
||||||
for tr in st:
|
for tr in st:
|
||||||
@ -197,6 +200,8 @@ class Data(object):
|
|||||||
|
|
||||||
def applyPicks(picks):
|
def applyPicks(picks):
|
||||||
firstonset = None
|
firstonset = None
|
||||||
|
if self.getEvtData().picks:
|
||||||
|
raise OverwriteError('Actual picks would be overwritten!')
|
||||||
for station, onsets in picks.items():
|
for station, onsets in picks.items():
|
||||||
print 'Reading picks on station %s' % station
|
print 'Reading picks on station %s' % station
|
||||||
for label, phase in onsets.items():
|
for label, phase in onsets.items():
|
||||||
|
@ -16,3 +16,7 @@ class FormatError(Exception):
|
|||||||
|
|
||||||
class DatastructureError(Exception):
|
class DatastructureError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class OverwriteError(IOError):
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user