[bugfixes] location/magnitude w ludger

This commit is contained in:
Marcel Paffrath 2018-06-28 15:22:40 +02:00
parent 5870843a03
commit 4cb3f72ba8
4 changed files with 18 additions and 44 deletions

View File

@ -2498,7 +2498,6 @@ class MainWindow(QMainWindow):
'iplot': 0,
'fig_dict': None,
'fig_dict_wadatijack': self.fig_dict_wadatijack,
'locflag': 0,
'savexml': False,
'obspyDMT_wfpath': wfpath}
# init pick thread
@ -2756,55 +2755,28 @@ class MainWindow(QMainWindow):
"""
if not self.okToContinue():
return
settings = QSettings()
# get location tool hook
loctool = settings.value("loc/tool", "nll")
parameter = self._inputs
loctool = 'nll'
lt = locateTool[loctool]
# get working directory
locroot = settings.value("{0}/rootPath".format(loctool), None)
locroot = parameter['nllocroot']
if locroot is None:
self.PyLoTprefs()
self.locate_event()
infile = settings.value("{0}/inputFile".format(loctool), None)
ctrfile = parameter['ctrfile']
if not infile:
caption = 'Select {0} input file'.format(loctool)
filt = "Supported file formats" \
" (*.in *.ini *.conf *.cfg)"
ans = QFileDialog().getOpenFileName(self, caption=caption,
filter=filt, dir=locroot)
if ans[0]:
infile = ans[0]
else:
QMessageBox.information(self,
self.tr('No infile selected'),
self.tr('Inputfile necessary for localization.'))
return
settings.setValue("{0}/inputFile".format(loctool), infile)
settings.sync()
if loctool == 'nll':
ttt = settings.value("{0}/travelTimeTables", None)
ok = False
if ttt is None:
while not ok:
text, ok = QInputDialog.getText(self, 'Pattern for travel time tables',
'Base name of travel time tables',
echo=QLineEdit.Normal,
text="ttime")
ttt = text
outfile = settings.value("{0}/outputFile".format(loctool),
os.path.split(os.tempnam())[-1])
ttt = parameter['ttpatter']
outfile = parameter['outpatter']
eventname = self.get_current_event_name()
obsdir = os.path.join(self._inputs['rootpath'], self._inputs['datapath'], self._inputs['database'], eventname)
self.saveData(event=self.get_current_event(), directory=obsdir, outformats='.obs')
filename = 'PyLoT_' + eventname
locpath = os.path.join(locroot, 'loc', filename)
phasefile = os.path.join(obsdir, filename + '.obs')
lt.modify_inputs(infile, locroot, filename, phasefile, ttt)
lt.modify_inputs(ctrfile, locroot, filename, phasefile, ttt)
try:
lt.locate(infile)
lt.locate(ctrfile)
except RuntimeError as e:
print(e.message)
#finally:

View File

@ -94,7 +94,6 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
fig_dict = None
fig_dict_wadatijack = None
locflag = 1
if input_dict and isinstance(input_dict, dict):
if 'parameter' in input_dict:
parameter = input_dict['parameter']
@ -110,8 +109,6 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
eventid = input_dict['eventid']
if 'iplot' in input_dict:
iplot = input_dict['iplot']
if 'locflag' in input_dict:
locflag = input_dict['locflag']
if 'savexml' in input_dict:
savexml = input_dict['savexml']
if 'obspyDMT_wfpath' in input_dict:
@ -153,7 +150,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
datastructure.setExpandFields(exf)
# check if default location routine NLLoc is available
if real_None(parameter['nllocbin']) and locflag:
if real_None(parameter['nllocbin']):
locflag = 1
# get NLLoc-root path
nllocroot = parameter.get('nllocroot')
# get path to NLLoc executable
@ -178,7 +176,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
print(" !!! ")
wfpath_extension = ''
if obspyDMT_wfpath not in [None, False, 'False']:
if obspyDMT_wfpath not in [None, False, 'False', '']:
wfpath_extension = obspyDMT_wfpath
print('Using obspyDMT structure. There will be no restitution, as pre-processed data are expected.')
if wfpath_extension != 'processed':

View File

@ -122,7 +122,13 @@ class Magnitude(object):
def net_magnitude(self, magscaling=None):
if self:
if magscaling is not None and str(magscaling) is not '[0.0, 0.0]':
if magscaling == None:
scaling = False
elif magscaling[0] != 0 and magscaling[1] != 0:
scaling = False
else:
scaling = True
if scaling:
# scaling necessary
print("Scaling network magnitude ...")
mag = ope.Magnitude(
@ -141,7 +147,6 @@ class Magnitude(object):
station_count=len(self.magnitudes),
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
return mag
return None
class LocalMagnitude(Magnitude):

View File

@ -3419,7 +3419,6 @@ class TuneAutopicker(QWidget):
'eventid': [self.get_current_event_fp()],
'iplot': 2,
'fig_dict': self.fig_dict,
'locflag': 0,
'savexml': False,
'obspyDMT_wfpath': wfpath}
for key in self.fig_dict.keys():