Skip to content

Commit

Permalink
mwcs plot for msnoise2
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLecocq committed Dec 9, 2023
1 parent 02eb9bd commit 5e5891d
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions msnoise/plots/mwcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,27 @@ def plot_lags(minlag, maxlag):
id = []
alldt = []
allcoh = []
for day in datelist:
fname = os.path.join('MWCS', "%02i" % filterid, "%03i_DAYS" %
mov_stack, components, pair, '%s.txt' % day)
if os.path.isfile(fname):
df = pd.read_csv(fname, delimiter=' ', header=None, index_col=0,
names=['t', 'dt', 'err', 'coh'])
alldt.append(df["dt"])
allcoh.append(df["coh"])
id.append(day)
del df

alldt = pd.DataFrame(alldt, index=pd.DatetimeIndex(id))
allcoh = pd.DataFrame(allcoh, index=pd.DatetimeIndex(id))
# for day in datelist:
# fname = os.path.join('MWCS', "%02i" % filterid, "%03i_DAYS" %
# mov_stack, components, pair, '%s.txt' % day)
# if os.path.isfile(fname):
# df = pd.read_csv(fname, delimiter=' ', header=None, index_col=0,
# names=['t', 'dt', 'err', 'coh'])
# alldt.append(df["dt"])
# allcoh.append(df["coh"])
# id.append(day)
# del df

try:
mwcs = xr_get_mwcs(sta1, sta2, components, filterid, mov_stack)
except FileNotFoundError as fullpath:
logger.error("FILE DOES NOT EXIST: %s, skipping" % fullpath)
return

alldt = mwcs.M
allcoh = mwcs.MCOH
id = mwcs.index
print(mwcs.M)

alldt = alldt.resample('D').mean()
allcoh = allcoh.resample('D').mean()
Expand Down

0 comments on commit 5e5891d

Please sign in to comment.