def create_obs_station(self, sta_code, start_date, end_date, sta_longitude, sta_latitude, sta_elevation, creation_date, termination_date, site_name): obs_station = inventory.Station(sta_code, latitude=round(sta_latitude, 6), longitude=round(sta_longitude, 6), start_date=start_date, end_date=end_date, elevation=round(sta_elevation, 1)) obs_station.site = inventory.Site( name=(site_name if site_name else sta_code)) obs_station.creation_date = creation_date obs_station.termination_date = termination_date obs_station.total_number_of_channels = 0 # initialized to 0 obs_station.selected_number_of_channels = 0 # initialized to 0 return obs_station
prev_channel_inv_set = channel_inv_set # if some of the channels dont match then add it to the log file # there is a problem, i.e. sampling rates change for a given station if not len(service_mismatch_list) == 0: for service_mismatch in service_mismatch_list: ASDF_log_file.write("%s.%s_%s" % (FDSNnetwork, station, service_mismatch) + '\t' + "MismatchingChannels\n") # get the start/end dates from dict start_date = UTCDateTime(station_start_end_dict[station][0]) end_date = UTCDateTime(station_start_end_dict[station][1]) site = inventory.Site(name=station) # make the station_level inventory station = inventory.Station(code=station, creation_date=start_date, termination_date=end_date, site=site, latitude=value[0][0][0].latitude, longitude=value[0][0][0].longitude, elevation=value[0][0][0].elevation, vault="Transportable Array", channels=value[0][0]) station_inventories_list.append(station) network_start_end = False
instrument = cha[u'instrument'] sampling = cha[u'sampling_rate'] start_date = cha[u'start_date'] if start_date == '': start_date = UTCDateTime(1970, 1, 1, 0, 0) end_date = cha[u'end_date'] if end_date =='': end_date = UTCDateTime(2999, 1, 1, 0, 0) #create inventory for station stan_channel = inventory.Channel(code=chn_name, location_code=site_name, depth=depth, azimuth=270, dip=0, sample_rate=sampling, clock_drift_in_seconds_per_sample=0, latitude=latitude, longitude=longitude, elevation=elevation) channel_list.append(stan_channel) site = inventory.Site(name=site_name, description=instrument) station = inventory.Station(code=station_code, creation_date=start_date, termination_date=end_date, latitude=latitude, longitude=longitude, elevation=elevation, vault=station_id, channels=channel_list, site=site) station_list.append(station) network = inventory.Network(code=network_code, alternate_code=network_name, start_date=start_date, stations=station_list) network_list.append(network) inv = inventory.Inventory(networks=network_list, source='YN.dataless') #print inv inv.write(path_or_file_object='yn_station' + '.xml', format='STATIONXML')
clock_drift_in_seconds_per_sample=0, latitude=fields[2], longitude=fields[3], elevation=fields[4]) E_channel = inventory.Channel(code='BHE', location_code='', depth=0, azimuth=270, dip=0, sample_rate=50, clock_drift_in_seconds_per_sample=0, latitude=fields[2], longitude=fields[3], elevation=fields[4]) channels = [Z_channel, N_channel, E_channel] site = inventory.Site(name=fields[1], description=fields[10]) station = inventory.Station(code=fields[1], creation_date=start_Date, termination_date=end_Date, latitude=fields[2], longitude=fields[3], elevation=fields[4], vault='Transportable Array', channels=channels, site=site) station_list.append(station) if i == len(data) - 1: network = inventory.Network(code=surv_name, alternate_code=fields[0],