Compare commits
No commits in common. "71d4269a4ff698bf418f1f07be9436961870eeda" and "d7ee820de3e3a14cd1e4d9b3bf4d9fa45b4b4033" have entirely different histories.
71d4269a4f
...
d7ee820de3
6
PyLoT.py
Executable file → Normal file
6
PyLoT.py
Executable file → Normal file
@ -3590,7 +3590,7 @@ class MainWindow(QMainWindow):
|
|||||||
def calc_magnitude(self):
|
def calc_magnitude(self):
|
||||||
self.init_metadata()
|
self.init_metadata()
|
||||||
if not self.metadata:
|
if not self.metadata:
|
||||||
return []
|
return None
|
||||||
|
|
||||||
wf_copy = self.get_data().getWFData().copy()
|
wf_copy = self.get_data().getWFData().copy()
|
||||||
|
|
||||||
@ -3599,10 +3599,6 @@ class MainWindow(QMainWindow):
|
|||||||
for station in np.unique(list(self.getPicks('manual').keys()) + list(self.getPicks('auto').keys())):
|
for station in np.unique(list(self.getPicks('manual').keys()) + list(self.getPicks('auto').keys())):
|
||||||
wf_select += wf_copy.select(station=station)
|
wf_select += wf_copy.select(station=station)
|
||||||
|
|
||||||
if not wf_select:
|
|
||||||
logging.warning('Empty Stream in calc_magnitude. Return.')
|
|
||||||
return []
|
|
||||||
|
|
||||||
corr_wf = restitute_data(wf_select, self.metadata)
|
corr_wf = restitute_data(wf_select, self.metadata)
|
||||||
# calculate moment magnitude
|
# calculate moment magnitude
|
||||||
moment_mag = MomentMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('vp'),
|
moment_mag = MomentMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('vp'),
|
||||||
|
@ -268,6 +268,9 @@ class Metadata(object):
|
|||||||
if not fnames:
|
if not fnames:
|
||||||
# search for station name in filename
|
# search for station name in filename
|
||||||
fnames = glob.glob(os.path.join(path_to_inventory, '*' + station + '*'))
|
fnames = glob.glob(os.path.join(path_to_inventory, '*' + station + '*'))
|
||||||
|
if not fnames:
|
||||||
|
# search for network name in filename
|
||||||
|
fnames = glob.glob(os.path.join(path_to_inventory, '*' + network + '*'))
|
||||||
if not fnames:
|
if not fnames:
|
||||||
if self.verbosity:
|
if self.verbosity:
|
||||||
print('Could not find filenames matching station name, network name or seed id')
|
print('Could not find filenames matching station name, network name or seed id')
|
||||||
@ -279,7 +282,7 @@ class Metadata(object):
|
|||||||
continue
|
continue
|
||||||
invtype, robj = self._read_metadata_file(os.path.join(path_to_inventory, fname))
|
invtype, robj = self._read_metadata_file(os.path.join(path_to_inventory, fname))
|
||||||
try:
|
try:
|
||||||
robj.get_coordinates(station_seed_id)
|
# robj.get_coordinates(station_seed_id) # TODO: Commented out, failed with Parser, is this needed?
|
||||||
self.inventory_files[fname] = {'invtype': invtype,
|
self.inventory_files[fname] = {'invtype': invtype,
|
||||||
'data': robj}
|
'data': robj}
|
||||||
if station_seed_id in self.seed_ids.keys():
|
if station_seed_id in self.seed_ids.keys():
|
||||||
@ -287,7 +290,6 @@ class Metadata(object):
|
|||||||
self.seed_ids[station_seed_id] = fname
|
self.seed_ids[station_seed_id] = fname
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(e)
|
|
||||||
continue
|
continue
|
||||||
print('Could not find metadata for station_seed_id {} in path {}'.format(station_seed_id, path_to_inventory))
|
print('Could not find metadata for station_seed_id {} in path {}'.format(station_seed_id, path_to_inventory))
|
||||||
|
|
||||||
@ -652,8 +654,6 @@ def restitute_data(data, metadata, unit='VEL', force=False, ncores=0):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# data = remove_underscores(data)
|
# data = remove_underscores(data)
|
||||||
if not data:
|
|
||||||
return
|
|
||||||
|
|
||||||
# loop over traces
|
# loop over traces
|
||||||
input_tuples = []
|
input_tuples = []
|
||||||
@ -661,11 +661,6 @@ def restitute_data(data, metadata, unit='VEL', force=False, ncores=0):
|
|||||||
input_tuples.append((tr, metadata, unit, force))
|
input_tuples.append((tr, metadata, unit, force))
|
||||||
data.remove(tr)
|
data.remove(tr)
|
||||||
|
|
||||||
if ncores == 0:
|
|
||||||
result = []
|
|
||||||
for input_tuple in input_tuples:
|
|
||||||
result.append(restitute_trace(input_tuple))
|
|
||||||
else:
|
|
||||||
pool = gen_Pool(ncores)
|
pool = gen_Pool(ncores)
|
||||||
result = pool.imap_unordered(restitute_trace, input_tuples)
|
result = pool.imap_unordered(restitute_trace, input_tuples)
|
||||||
pool.close()
|
pool.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user