Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMKG to PHA: consider events not having phase data #1

Open
yudhastyawan opened this issue Nov 30, 2022 · 1 comment
Open

BMKG to PHA: consider events not having phase data #1

yudhastyawan opened this issue Nov 30, 2022 · 1 comment

Comments

@yudhastyawan
Copy link
Member

image

This is an example of the event not having phase data. Errors in the terminal would be like the outcomes below:

Traceback (most recent call last):
  File ".../convertBMKGtoPHA.py", line 112, in <module>
    main.write(filename)
  File ".../convertBMKGtoPHA.py", line 91, in write
    pha_list.append("# " + " ".join([str(e[key][i]) for key in list(e.keys())]))
  File ".../convertBMKGtoPHA.py", line 91, in <listcomp>
    pha_list.append("# " + " ".join([str(e[key][i]) for key in list(e.keys())]))
IndexError: list index out of range
@yudhastyawan
Copy link
Member Author

....
def __init__(self, filename):
        ....
        self.bug_events = {key:[] for key in ['ID']}
        ....
    
    def read(self):
        ....
        with open(self.filename, 'r') as file:
            for item in file:
                currLine = item.split()
                if ev == True:
                    ....
                    
                    # for bug purposes only
                    self.bug_events["ID"].append(item)

                    ....
....

Storing each "item" would be good enough for detecting this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant