PIC-IRIS / PH5

Library of PH5 clients, apis, and utilities
Other
15 stars 9 forks source link

[BUG] ph5api.cut should exit with error or skip trace if data assigned to none type is encountered #417

Closed timronan closed 4 years ago

timronan commented 4 years ago

Describe the bug ph5api.cut exits with the message ERROR: object of type 'NoneType' has no len() it if called on data segment that contains gaps. This error message is confusing and should be replaced with a concise message that explains why the program is exiting or the gap should be skipped and the next gap should be cut.

Environment (please complete the following information):

To Reproduce On expirment 14-032 call ph5toms -p ./ -n master.ph5 --station MG06 --channel HHN --starttime 2014-07-19T00:00:00 --stoptime 2014-07-22T23:59:59

Expected behavior Bets case, gap should be skipped and PH5 cut should continue to operate. Next concise error exception should be thrown.

Traceback (most recent call last): File "/home/PIC/.conda/envs/ph5/bin/ph5toms", line 11, in load_entry_point('ph5', 'console_scripts', 'ph5toms')() File "/home/PIC/ph5_environment/PH5/ph5/clients/ph5toms.py", line 1224, in main for stream in ph5ms.process_all(): File "/home/PIC/ph5_environment/PH5/ph5/clients/ph5toms.py", line 1012, in process_all stream = self.create_trace(cut) File "/home/PIC/ph5_environment/PH5/ph5/clients/ph5toms.py", line 549, in create_trace apply_time_correction=nt, das_t=das) File "/home/PIC/ph5_environment/PH5/ph5/core/ph5api.py", line 1282, in cut calc_stop_fepoch = trace_start_fepoch + (len(data) / sr) TypeError: object of type 'NoneType' has no len() Closing remaining open files:./miniPH5_00096.ph5...done./master.ph5...done