[bugs fixed and found] dataprocessing doesn't work as expected, np.bool_ substituted by bool
This commit is contained in:
parent
15700b074d
commit
c8d8525c11
@ -353,7 +353,7 @@ def calcsourcespec(wfstream, onset, inventory, vp, delta, azimuth, incidence, qp
|
|||||||
wf_copy = wfstream.copy()
|
wf_copy = wfstream.copy()
|
||||||
|
|
||||||
[cordat, restflag] = restitute_data(wf_copy, inventory)
|
[cordat, restflag] = restitute_data(wf_copy, inventory)
|
||||||
if restflag == 1:
|
if restflag is True:
|
||||||
zdat = cordat.select(component="Z")
|
zdat = cordat.select(component="Z")
|
||||||
if len(zdat) == 0:
|
if len(zdat) == 0:
|
||||||
zdat = cordat.select(component="3")
|
zdat = cordat.select(component="3")
|
||||||
|
@ -155,7 +155,7 @@ def evt_head_check(root_dir, out_dir = None):
|
|||||||
print(nfiles)
|
print(nfiles)
|
||||||
|
|
||||||
|
|
||||||
def restitute_data(data, path_to_inventory, unit='VEL', force=False):
|
def restitute_data(data, path_to_inventory, unit='VEL', force=True):
|
||||||
"""
|
"""
|
||||||
takes a data stream and a path_to_inventory and returns the corrected
|
takes a data stream and a path_to_inventory and returns the corrected
|
||||||
waveform data stream
|
waveform data stream
|
||||||
@ -163,7 +163,7 @@ def restitute_data(data, path_to_inventory, unit='VEL', force=False):
|
|||||||
:param path_to_inventory: path to inventory folder or file
|
:param path_to_inventory: path to inventory folder or file
|
||||||
:param unit: unit to correct for (default: 'VEL')
|
:param unit: unit to correct for (default: 'VEL')
|
||||||
:param force: force restitution for already corrected traces (default:
|
:param force: force restitution for already corrected traces (default:
|
||||||
False)
|
True)
|
||||||
:return: corrected data stream
|
:return: corrected data stream
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -193,6 +193,10 @@ def restitute_data(data, path_to_inventory, unit='VEL', force=False):
|
|||||||
for tr in data:
|
for tr in data:
|
||||||
seed_id = tr.get_id()
|
seed_id = tr.get_id()
|
||||||
# check, whether this trace has already been corrected
|
# check, whether this trace has already been corrected
|
||||||
|
# TODO read actual value of processing key in Trace's stats instead
|
||||||
|
# of just looking for thr key: if processing is setit doesn't
|
||||||
|
# necessarily mean that the trace has been corrected so far but only
|
||||||
|
# processed in some way, e.g. normalized
|
||||||
if 'processing' in tr.stats.keys() and not force:
|
if 'processing' in tr.stats.keys() and not force:
|
||||||
print("Trace {0} has already been corrected!".format(seed_id))
|
print("Trace {0} has already been corrected!".format(seed_id))
|
||||||
continue
|
continue
|
||||||
@ -225,6 +229,9 @@ def restitute_data(data, path_to_inventory, unit='VEL', force=False):
|
|||||||
else:
|
else:
|
||||||
finv = invlist[0]
|
finv = invlist[0]
|
||||||
inventory = read_inventory(finv, format='STATIONXML')
|
inventory = read_inventory(finv, format='STATIONXML')
|
||||||
|
else:
|
||||||
|
restflag.append(False)
|
||||||
|
continue
|
||||||
# apply restitution to data
|
# apply restitution to data
|
||||||
if invtype in ['resp', 'dless']:
|
if invtype in ['resp', 'dless']:
|
||||||
tr.simulate(**kwargs)
|
tr.simulate(**kwargs)
|
||||||
@ -237,7 +244,7 @@ def restitute_data(data, path_to_inventory, unit='VEL', force=False):
|
|||||||
# better try restitution for smaller subsets of data (e.g. station by
|
# better try restitution for smaller subsets of data (e.g. station by
|
||||||
# station)
|
# station)
|
||||||
if len(restflag) > 0:
|
if len(restflag) > 0:
|
||||||
restflag = np.all(restflag)
|
restflag = bool(np.all(restflag))
|
||||||
else:
|
else:
|
||||||
restflag = False
|
restflag = False
|
||||||
return data, restflag
|
return data, restflag
|
||||||
|
Loading…
Reference in New Issue
Block a user