jakewalter/easyQuake

if no events detected in time chunk --> error creating gpd_picks.out --> process exits

Opened this issue · 3 comments

Hi Jake, I am falling into an error in which, if no events are detected during one time chunk (With EQTransofrmer as machine picker), the gpd_picks.out file is not created and the process exits without passing to the next time-chunk.

Th error I get is the following:


FileNotFoundError Traceback (most recent call last)
in
27 dirname = single_date.strftime("%Y%m%d")
28 download_mseed(dirname=dirname, project_folder=project_folder, single_date=single_date, minlat=lat_a, maxlat=lat_b, minlon=lon_a, maxlon=lon_b)
---> 29 detection_continuous(dirname=dirname, project_folder=project_folder, project_code=project_code, single_date=single_date, machine=True, machine_picker= 'EQTransformer', local=True)
30 association_continuous(dirname=dirname, project_folder=project_folder, project_code=project_code, maxdist=maxdist, maxkm=maxkm, single_date=single_date, local=True)
31

/usr/local/Caskroom/miniconda/base/envs/easyquake/lib/python3.7/site-packages/easyQuake/easyQuake.py in detection_continuous(dirname, project_folder, project_code, local, machine, machine_picker, single_date, latitude, longitude, max_radius)
530 fullpath2 = pathEQT+'/mseed_predictor.py'
531 os.system(fullpath2+" -I %s -O %s -F %s" % (infile, outfile, pathEQT))
--> 532 gpd_pick_add(dbsession=session,fileinput=fileinassociate,inventory=inv)
533 else:
534 picker = fbpicker.FBPicker(t_long = 5, freqmin = 1, mode = 'rms', t_ma = 20, nsigma = 7, t_up = 0.7, nr_len = 2, nr_coeff = 2, pol_len = 10, pol_coeff = 10, uncert_coeff = 3)

/usr/local/Caskroom/miniconda/base/envs/easyquake/lib/python3.7/site-packages/easyQuake/easyQuake.py in gpd_pick_add(dbsession, fileinput, inventory)
343 def gpd_pick_add(dbsession=None,fileinput=None,inventory=None):
344 filepath = fileinput
--> 345 with open(filepath) as fp:
346 line = fp.readline()
347 cnt = 1

FileNotFoundError: [Errno 2] No such file or directory: 'data/ba2/20140820/gpd_picks.out'

The code I am using is very similar to your Idaho example but changing latitude longitude and timespan, as well as the machine picker. The code is pasted below.

Can you help solve this?

Would adding an exception to the gpd_pick_add definition before file path = file input solve this issue?

Thank you very much,

Mateo

Code:
`from easyQuake import download_mseed
from easyQuake import daterange
from datetime import date
from easyQuake import combine_associated
from easyQuake import detection_continuous
from easyQuake import association_continuous

from easyQuake import magnitude_quakeml
from easyQuake import simple_cat_df

import matplotlib.pyplot as plt
maxkm = 300 #100
maxdist=300 #100
lat_a = 37.5 #37.8
lat_b = 38.5 #38.34
lon_a = -123 #-122.4
lon_b = -122 #-122.0

start_date = date(2014, 8, 20)
end_date = date(2014, 8, 27)

project_code = 'bay_area'
project_folder = 'data/ba2'
for single_date in daterange(start_date, end_date):
print(single_date.strftime("%Y-%m-%d"))
dirname = single_date.strftime("%Y%m%d")
download_mseed(dirname=dirname, project_folder=project_folder, single_date=single_date, minlat=lat_a, maxlat=lat_b, minlon=lon_a, maxlon=lon_b)
detection_continuous(dirname=dirname, project_folder=project_folder, project_code=project_code, single_date=single_date, machine=True, machine_picker= 'EQTransformer', local=True)
association_continuous(dirname=dirname, project_folder=project_folder, project_code=project_code, maxdist=maxdist, maxkm=maxkm, single_date=single_date, local=True)

cat, dfs = combine_associated(project_folder=project_folder, project_code=project_code)
cat = magnitude_quakeml(cat=cat, project_folder=project_folder,plot_event=True)
cat.write('catalog_bayarea_end_08_14.xml',format='QUAKEML')

catdf = simple_cat_df(cat)
plt.figure()
plt.plot(catdf.index,catdf.magnitude,'.')`

I have not encountered this error before. Usually, if there is nothing in the gpd_picks.out file then the picker did not actually run correctly. Can you post the entire output (like from the nohup.out file) or at least the start of the detection?

I also ran into same issue. no gpd_picks.out file.

How do I proceed?

After encountering this with another issue, for the project_folder variable, please make sure to include the full path of the project folder (/data/idaho or /home/user/idaho), otherwise that may lead to some of these types of issues. Does the example on the github landing page for the Idaho example work?