def test_005_basic_offset(self): """ With station heights """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0)) obs = [] obs.append(AZ(st1, st2, insthgt=2.5, trgthgt=4.1)) obs.append(SD(st1, st2, insthgt=2.5, trgthgt=-4.1)) obs.append(ZD(st1, st2, insthgt=-2.5, trgthgt=4.1)) obs.append(LV(st1, st2, insthgt=-2.5, trgthgt=-4.1)) self.offsetStation(st2, [0.5, 1.0, -0.3]) net = Network.Network() net.addStation(st1) net.addStation(st2) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("fix", "ST1") adj.setConfig("refraction_coefficient", "0.0") self.runAdjustment("Test 5", adj)
def test_252_setup_height_float(self): """ Height setup calculator """ global basedir df = os.path.join(basedir, "data", "testadj1.csv") st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station( "ST2", llh=[171.0024646771, -45.000160237, 15.9343333328]) net = Network.Network() net.addStation(st1, st2) adj = Adjustment.Adjustment(stations=net, verbose=True) adj.setConfig("data_file", '"' + df + '" attributes=eqpt,setup') adj.setConfig("fix", "ST1") adj.setConfig("use_plugin", "setup_height_plugin") adj.setConfig("calculate_setup_heights", "true") adj.setConfig("inst_trgt_setup_attributes", "none setup") adj.setConfig("valid_setup_regex", "[A-Z]") adj.setConfig("fix_setup_height", "A 0.25") adj.setConfig("float_setup_height", "B 0.75 0.0025") adj.setConfig("debug_observation_equations", "true") self.runAdjustment("Test 252", adj, checkListing=True)
def test_051_output_coord_offsets(self): """ Output offset """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.001, -44.995, 20.0)) obs = [] obs.append(AZ(st1, st2, 0.0015)) obs.append(SD(st1, st2, 0.005)) obs.append(LV(st1, st2, 0.025)) self.offsetStation(st2, [0.5, 1.0, -0.3]) net = Network.Network() net.addStation(st1) net.addStation(st2) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("fix", "ST1") adj.setConfig("refraction_coefficient", "0.0") cfname = self.outputFilePath("test53_coords.csv") adj.setConfig("output_coordinate_file", cfname + " offsets") self.runAdjustment("Test 51", adj, outputfiles={"coords": cfname})
def test_002_gx(self): """ Simple XYZ observation """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) obs = [] obs.append(GX(st1)) self.offsetStation(st1, [0.5, 1.0, -0.3]) net = Network.Network() net.addStation(st1) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) self.runAdjustment("Test 2", adj)
def test_200_csv_attribute(self): """ Read CSV file attributes """ global basedir df = os.path.join(basedir, "data", "testadj1.csv") st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0)) net = Network.Network() net.addStation(st1, st2) adj = Adjustment.Adjustment(stations=net, verbose=True) adj.setConfig("data_file", '"' + df + '" attributes=eqpt,setup') adj.setConfig("fix", "ST1 ST2") adj.loadDataFiles() i = 0 for o in adj.observations: for v in o.obsvalues: i += 1 self.check( "Test 200: Observation " + str(i) + " attributes:", [v.attributes.get("eqpt"), v.attributes.get("setup")], )
def test_004_ha(self): """ Simple offset bearing, distance, zenith distance """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.035, -44.982, 20.0)) st3 = Station.Station("ST3", llh=(171.012, -44.972, 20.0)) obs = [] obs.append(HA(st2, [st1, st3])) obs.append(SD(st1, st2)) obs.append(ZD(st1, st2)) self.offsetStation(st2, [0.5, 1.0, -0.3]) net = Network.Network() net.addStation(st1) net.addStation(st2) net.addStation(st3) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("fix", "ST1") adj.setConfig("fix", "ST3") adj.setConfig("refraction_coefficient", "0.0") self.runAdjustment("Test 4", adj)
def test_101_locator_plugin_config_load(self): """ Station locator plugin via configuration """ from Geodetic.StationLocatorPlugin import StationLocatorPlugin st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0)) obs = [] obs.append(AZ(st1, st2)) obs.append(SD(st1, st2)) obs.append(ZD(st1, st2)) self.offsetStation(st2, [0.5, 1.0, -0.3]) net = Network.Network() net.addStation(st1) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("use_plugin", "station_locator_plugin") adj.setConfig("fix", "ST1") adj.setConfig("calculate_missing_stations", "yes") adj.setConfig("debug_calculate_missing_stations", "yes") adj.setConfig("refraction_coefficient", "0.0") self.runAdjustment("Test 101", adj)
def test_075_recode_obs(self): """ Recode observation """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) st2 = Station.Station("ST2", llh=(171.0, -45.001, 20.0)) st3 = Station.Station("ST3", llh=(171.001, -45.0, 15.0)) st4 = Station.Station("ST4", llh=(171.001, -45.001, 80.0)) st1r = Station.Station("AB1", llh=(171.0, -45.0, 10.0)) st2r = Station.Station("AB2", llh=(171.0, -45.001, 20.0)) st3r = Station.Station("SX3", llh=(171.001, -45.0, 15.0)) st4r = Station.Station("SX4", llh=(171.001, -45.001, 80.0)) st5r = Station.Station("AB3", llh=(171.0, -45.0, 10.0)) obs = [] obs.append(SD(st1, st2)) obs.append(SD(st1, st3)) obs.append(SD(st2, st3)) obs.append(SD(st2, st1)) obs.append(SD(st2, st4)) obs.append(SD(st3, st4)) obs.append(HA(st3, [st1, st2, st4])) obs.append(HA(st4, [st1, st2])) net = Network.Network() net.addStation(st1r) net.addStation(st2r) net.addStation(st3r) net.addStation(st4r) net.addStation(st5r) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("fix", "*") cfname = self.outputFilePath("test75_residuals.csv") adj.setConfig("residual_csv_file", cfname) adj.setConfig("recode_observations", "ST1 AB3 inststn=ST1 trgtstn=ST3") adj.setConfig("recode_observations", r"re:ST([12]) AB\1") adj.setConfig("recode_observations", r"re:ST([34]) SX\1") self.runAdjustment("Test 75", adj, outputfiles={"obs": cfname})
def test_002_offsets(self): st1 = Station.Station( "A23C", llh=(172.345, -41.286, 23.5), xieta=(10.0, -4.0), geoidhgt=25.0 ) xyz = st1.xyz() enu = st1.enu() genu = st1.genu() xyz2 = st1.xyz(offset=15.2) self.check("Test2 offset none", (xyz2 - xyz).dot(genu.T)) xyz2 = st1.xyz(offset=23.2, offsettype=st1.OFFSET_H) self.check("Test2 offset h", (xyz2 - xyz).dot(genu.T)) xyz2 = st1.xyz(offset=[-13.2, 19.7, 23.2], offsettype=st1.OFFSET_GENU) self.check("Test2 offset genu", (xyz2 - xyz).dot(genu.T)) xyz2 = st1.xyz(offset=[-15.2, 29.7, 18.2], offsettype=st1.OFFSET_ENU) self.check("Test2 offset enu", (xyz2 - xyz).dot(enu.T)) xyz2 = st1.xyz(offset=[-18.2, -19.7, 8.2], offsettype=st1.OFFSET_XYZ) self.check("Test2 offset xyz", (xyz2 - xyz))
def test_061_float_station(self): """ Float station """ st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0)) obs = [] obs.append(GX(st1, error=0.05)) self.offsetStation(st1, [10.0, 1.0, 20.0]) net = Network.Network() net.addStation(st1) adj = Adjustment.Adjustment(stations=net, observations=obs, verbose=True) adj.setConfig("float", "0.05 0.10 ST1") adj.setConfig("debug_observation_equations", "yes") adj.setConfig("debug_float_stations", "yes") cfname = self.outputFilePath("test61_coords.csv") adj.setConfig("output_coordinate_file", cfname + " offsets") self.runAdjustment("Test 61", adj, outputfiles={"coords": cfname})