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

Snuffling Quick Save #25

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 26 additions & 29 deletions quick_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def parse_markers(self):
self.ae_name = self.active_event.name

elif not self.save_asc_markers and self.save_sel_markers:
self.selected_markers = self.get_selected_markers
self.selected_markers = self.get_selected_markers()

else:
self.selected_markers = self.get_markers()
Expand Down Expand Up @@ -123,35 +123,31 @@ def save_markers(self):
Marker.save_markers(self.selected_markers, self.save_path)

def save_velest(self):
if self.save_asc_markers and not self.save_sel_markers:
start_time = datetime.datetime(1970, 1, 1)
event_time = self.active_event.time
event_date = start_time.utcfromtimestamp(event_time)

event_year = int(str(event_date.year)[2:])
event_month = event_date.month
event_day = event_date.day
event_hour = event_date.hour
event_min = event_date.minute
event_sec = event_date.second + (
round(event_date.microsecond / 10**6, 2))
event_lat = round(self.active_event.lat, 4)
event_lon = round(self.active_event.lon, 4)
event_depth = round(self.active_event.depth / 10**3, 2)
event_mag = round(self.active_event.magnitude, 2)

if event_lat >= 0:
event_NS = "N"
else:
event_NS = "S"
start_time = datetime.datetime(1970, 1, 1)
event_time = self.active_event.time
event_date = start_time.utcfromtimestamp(event_time)
event_year = int(str(event_date.year)[2:])
event_month = event_date.month
event_day = event_date.day
event_hour = event_date.hour
event_min = event_date.minute
event_sec = event_date.second + (
round(event_date.microsecond / 10**6, 2))
event_lat = round(self.active_event.lat, 4)
event_lon = round(self.active_event.lon, 4)
event_depth = round(self.active_event.depth / 10**3, 2)
event_mag = round(self.active_event.magnitude, 2)

if event_lat >= 0:
event_NS = "N"
else:
event_NS = "S"

if event_lon >= 0:
event_EW = "E"
else:
event_EW = "W"
if event_lon >= 0:
event_EW = "E"
else:
pass
event_EW = "W"

event_line = "{:02d}{:02d}{:02d} {:02d}{:02d} {:05.2f} {:7.4f}{} \
{:8.4f}{}{:8.2f}{:7.2f} 99 0.0 0.00 1.0 1.0 \n".format(
event_year, event_month, event_day, event_hour, event_min,
Expand Down Expand Up @@ -216,6 +212,7 @@ def call(self):

if self.velest_format:
self.save_asc_markers = True
self.save_sel_markers = False
self.parse_markers()
self.save_velest()
print('Velest format saved to: {}.'.format(self.save_path_velest))
Expand All @@ -225,5 +222,5 @@ def call(self):
def __snufflings__():
"""Returns a list of snufflings to be exported by this module."""

return[QuickSave()]
return[ QuickSave() ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing whitespace, please remove the added white spaces again. this does not follow pep8 ...