Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rizac committed Jul 19, 2023
1 parent ae5ddcc commit 1d1cf12
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions mecompute/base-config/segments_selection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# More info at: https://github.com/rizac/stream2segment/wiki/The-Segment-object

# event.time': this key will be overwritten by the program, leave it commented
has_valid_data': 'true'
maxgap_numsamples': '(-0.5, 0.5)'
event_distance_deg': '[20, 97.5]' # should match the bounds of 'freq_dist_table.distances' in process.yaml
has_valid_data: 'true'
maxgap_numsamples: '(-0.5, 0.5)'
event_distance_deg: '[20, 97.5]' # should match the bounds of 'freq_dist_table.distances' in process.yaml
4 changes: 0 additions & 4 deletions mecompute/event_me.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from collections import OrderedDict
from os.path import join, dirname

import pandas as pd
import numpy as np
import math
Expand Down Expand Up @@ -131,7 +128,6 @@ def get_html_report_rows(station_me: pd.DataFrame, events: dict):
dist_deg if np.isfinite(dist_deg) else None])

yield events[ev_db_id], stas
# yield row


class Score2Weight:
Expand Down
2 changes: 1 addition & 1 deletion mecompute/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def write_quakemls(events: dict, dest_dir):
quakeml_file = join(dest_dir, ev_catalog_id + '.xml')
_write_quekeml(quakeml_file, ev_catalog_url,
e_mag, e_mag_u, evt['Me_waveforms_used'],
author_uri)
author_uri, force_overwrite=True)
except (OSError, HTTPError, HTTPException, URLError) as exc:
logger.warning(f'Unable to create QuakeML for {ev_catalog_id}: {exc}')

Expand Down
4 changes: 2 additions & 2 deletions test/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_process(params, capsys):
csv = join(TEST_TMP_ROOT_DIR, base_name + '.csv')
log = join(TEST_TMP_ROOT_DIR, base_name + '.log')
html = join(TEST_TMP_ROOT_DIR, base_name + '.html')
xml = join(TEST_TMP_ROOT_DIR, 'gfz2022juqz.xml')
xml = join(TEST_TMP_ROOT_DIR, 'events', 'gfz2022juqz.xml')
# get modification times to check we overwrote those files
# (if files do not exist, set yesterday as modification time):
m_times = {
Expand All @@ -81,7 +81,7 @@ def test_process(params, capsys):
assert os.stat(f).st_mtime > t

d = pd.read_hdf(s_hdf)
assert len(d) == 3 # noqa
assert len(d) == 1 # noqa

d = pd.read_csv(csv)
assert len(d) == 1 # noqa
Expand Down

0 comments on commit 1d1cf12

Please sign in to comment.