def inputs(stations): dataobj_list=[]; offsetobj_list=[]; eqobj_list=[]; for station_name in stations: [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, 'pbo'); dataobj_list.append(myData); offsetobj_list.append(offset_obj); eqobj_list.append(eq_obj); return [dataobj_list, offsetobj_list, eqobj_list];
def get_detrended_gps_station(station_name): datasource = 'pbo' [newData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, datasource) newData = offsets.remove_antenna_offsets(newData, offset_obj) newData = gps_ts_functions.remove_outliers(newData, 5) # mm for outliers newData = offsets.remove_earthquakes(newData, eq_obj) trend_out = gps_seasonal_removals.make_detrended_ts(newData, 1, 'notch') return trend_out
def inputs(station_names): dataobj_list = [] offsetobj_list = [] eqobj_list = [] for station_name in station_names: [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, 'pbo') dataobj_list.append(myData) offsetobj_list.append(offset_obj) eqobj_list.append(eq_obj) return [dataobj_list, offsetobj_list, eqobj_list]
def inputs(infile): DataAll = [] OffsetAll = [] EQAll = [] ifile = open(infile, 'r') for line in ifile: temp = line.split() station_name = temp[0] [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, 'pbo') DataAll.append(myData) OffsetAll.append(offset_obj) EQAll.append(eq_obj) ifile.close() return [DataAll, OffsetAll, EQAll]
def inputs(station_names, network, refframe): dataobj_list = [] offsetobj_list = [] eqobj_list = [] for station_name in station_names: [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, network, refframe) if myData == []: continue else: dataobj_list.append(myData) offsetobj_list.append(offset_obj) eqobj_list.append(eq_obj) return [dataobj_list, offsetobj_list, eqobj_list]
def input_data(st_name, datasource, refframe, data_config_file): [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(st_name, datasource, data_config_file, refframe) # First, we embed the data with the eq object (always useful) myData = gps_io_functions.Timeseries(name=myData.name, coords=myData.coords, dtarray=myData.dtarray, dN=myData.dN, dE=myData.dE, dU=myData.dU, Sn=myData.Sn, Se=myData.Se, Su=myData.Su, EQtimes=eq_obj.evdts) return [myData, offset_obj, eq_obj]
def input_data(station_name, datasource, refframe): [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station_name, datasource, refframe) return [myData, offset_obj, eq_obj]
#!/usr/bin/env python """ Example driver for individual time series reading and writing. Read, Process a little, and Write Back Out. """ import gps_input_pipeline import offsets import gps_io_functions station = "P325" data_config_file = "/Users/kmaterna/Documents/B_Research/GEOPHYS_DATA/GPS_POS_DATA/config.txt" outfile = station + "_noearthquake.pos" [myData, offset_obj, eq_obj] = gps_input_pipeline.get_station_data(station, 'unr', data_config_file, refframe='ITRF') newobj = offsets.remove_offsets(myData, offset_obj) # remove antenna changes and instrument changes newobj = offsets.remove_offsets(newobj, eq_obj) # remove earthquakes gps_io_functions.write_pbo_pos_file(newobj, outfile, comment="Writing a station's .pos file")
def read_station_ts(gps_bbox, gps_reference, remove_coseismic=0): """A reading function specific to Brawley right now. """ blacklist = [] network = 'pbo' station_names, _, _ = stations_within_radius.get_stations_within_box( gnss_object.gps_data_config_file, coord_box=gps_bbox, network=network) print(station_names) [dataobj_list, offsetobj_list, eqobj_list, _] = \ gps_input_pipeline.multi_station_inputs(station_names, blacklist, network, "NA", gnss_object.gps_data_config_file) # Importing BRAW [myData, offset_obj, eq_obj ] = gps_input_pipeline.get_station_data("BRAW", "unr", gnss_object.gps_data_config_file, refframe="NA") myData = gps_ts_functions.impose_time_limits( myData, dt.datetime.strptime("20080505", "%Y%m%d"), dt.datetime.strptime("20200101", "%Y%m%d")) dataobj_list.append(myData) offsetobj_list.append(offset_obj) eqobj_list.append(eq_obj) # Now we are doing a bit of adjustments, for seasonal corrections and base station. cleaned_objects = [] for i in range(len(dataobj_list)): one_object = dataobj_list[i] newobj = offsets.remove_offsets(one_object, offsetobj_list[i]) # will remove antenna offsets from everything if newobj.name == 'BRAW': newobj = gps_seasonal_removals.make_detrended_ts( newobj, seasonals_remove=1, seasonals_type="lssq", data_config_file=gnss_object.gps_data_config_file, remove_trend=0) else: newobj = gps_seasonal_removals.make_detrended_ts( newobj, seasonals_remove=1, seasonals_type="nldas", data_config_file=gnss_object.gps_data_config_file, remove_trend=0) if remove_coseismic: print("Removing coseismic offsets") newobj = offsets.remove_offsets(newobj, eqobj_list[i]) newobj = gps_ts_functions.remove_outliers(newobj, 20) # 20mm outlier definition # Here we detrend using pre-2010 velocities, # assuming tectonic strain accumulation won't contribute to geothermal field deformation. # Remove the postseismic by the Hines model endtime = dt.datetime.strptime("2010-04-01", "%Y-%m-%d") [east_slope, north_slope, vert_slope, _, _, _] = gps_ts_functions.get_slope(newobj, endtime=endtime, missing_fraction=0.2) east_params = [east_slope, 0, 0, 0, 0] north_params = [north_slope, 0, 0, 0, 0] vert_params = [vert_slope, 0, 0, 0, 0] newobj = gps_postseismic_remove.remove_by_model( newobj, gnss_object.gps_data_config_file) # This will actually remove the coseismic offset if within the window. newobj = gps_ts_functions.detrend_data_by_value( newobj, east_params, north_params, vert_params) cleaned_objects.append(newobj) # Subtracting the reference GPS station. ref_dataobjlist = [] reference_station = [ x for x in cleaned_objects if x.name == gps_reference ][0] for one_object in cleaned_objects: refobj = gps_ts_functions.get_referenced_data(one_object, reference_station) ref_dataobjlist.append(refobj) return ref_dataobjlist