Skip to content

Commit

Permalink
Recreate variables for longitude, latitude, and elevation
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-falco committed Aug 1, 2019
1 parent 9175ec7 commit 25e5d5c
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions ph5/clients/ph5tostationxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,15 @@ def read_stations(self):
for deployment, station_epoch, station_entry in \
((dk, dv, se) for dk, dv in station_list.items()
for se in dv):

longitude = station_entry['location/X/value_d']
latitude = station_entry['location/Y/value_d']
elevation = station_entry['location/Z/value_d']

if not self.is_lat_lon_match(
sta_xml_obj,
station_entry['location/Y/value_d'],
station_entry['location/X/value_d']):
latitude,
longitude):
continue

if station_entry['seed_station_name_s']:
Expand Down Expand Up @@ -714,9 +719,9 @@ def read_stations(self):
station_code,
start_date,
end_date,
station_entry['location/X/value_d'], # lng
station_entry['location/Y/value_d'], # lat
station_entry['location/Z/value_d'], # elv
longitude,
latitude,
elevation,
station_entry['location/description_s'])
if self.manager.get_obs_station(sta_key):
# station already created and added to metadata
Expand All @@ -727,9 +732,9 @@ def read_stations(self):
station_code,
start_date,
end_date,
station_entry['location/X/value_d'], # lng
station_entry['location/Y/value_d'], # lat
station_entry['location/Z/value_d'], # elv
longitude,
latitude,
elevation,
start_date, # creation_date
end_date, # termination date
station_entry['location/description_s'])
Expand Down Expand Up @@ -759,6 +764,10 @@ def read_channels(self, sta_xml_obj, station_entry, deployment,
component_list_patterns = sta_xml_obj.component_list
receiver_list_patterns = sta_xml_obj.receiver_list
location_patterns = sta_xml_obj.location_list
longitude = station_entry['location/X/value_d']
latitude = station_entry['location/Y/value_d']
elevation = station_entry['location/Z/value_d']

receiver_id = str(station_entry['id_s'])
if not ph5utils.does_pattern_exists(receiver_list_patterns,
receiver_id):
Expand All @@ -785,8 +794,8 @@ def read_channels(self, sta_xml_obj, station_entry, deployment,

if not self.is_lat_lon_match(
sta_xml_obj,
station_entry['location/Y/value_d'],
station_entry['location/X/value_d']):
latitude,
longitude):
continue
start_date = UTCDateTime(station_entry['deploy_time/epoch_l'])
end_date = UTCDateTime(station_entry['pickup_time/epoch_l'])
Expand All @@ -807,9 +816,9 @@ def read_channels(self, sta_xml_obj, station_entry, deployment,

cha_key = self.manager.get_channel_key(
sta_code, loc_code, cha_code, start_date, end_date,
station_entry['location/X/value_d'], # lng
station_entry['location/Y/value_d'], # lat
station_entry['location/Z/value_d'], # elv
longitude,
latitude,
elevation,
station_entry['channel_number_i'], # component
receiver_id,
sample_rate,
Expand Down Expand Up @@ -839,9 +848,9 @@ def read_channels(self, sta_xml_obj, station_entry, deployment,
cha_code,
start_date,
end_date,
station_entry['location/X/value_d'], # lng
station_entry['location/Y/value_d'], # lat
station_entry['location/Z/value_d'], # elv
longitude,
latitude,
elevation,
station_entry['channel_number_i'], # component
receiver_id,
array_code,
Expand Down

0 comments on commit 25e5d5c

Please sign in to comment.