def test_071_reweight_obs(self):
        """
        Reweight 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))
        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(st1)
        net.addStation(st2)
        net.addStation(st3)
        net.addStation(st4)

        adj = Adjustment.Adjustment(stations=net,
                                    observations=obs,
                                    verbose=True)
        adj.setConfig("fix", "*")
        cfname = self.outputFilePath("test71_residuals.csv")
        adj.setConfig("residual_csv_file", cfname)
        adj.setConfig("reweight_observations", "2.0 inststn=ST1")
        adj.setConfig("reweight_observations", "3 trgtstn=re:ST[34] type=HA")
        self.runAdjustment("Test 71", adj, outputfiles={"obs": cfname})
Exemple #2
0
 def test_006_unoriented_traverse(self):
     """
     Angle connected at each end
     """
     net = Network.Network()
     st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0))
     st2 = Station.Station("ST2", llh=(171.008, -44.995, 20.0))
     st3 = Station.Station("ST3", llh=(171.004, -44.995, 40.0))
     net.addStation(st1)
     net.addStation(st3)
     obs = Traverse([st1, st2, st3])
     self.checkLocator(net, obs, [st2])
Exemple #3
0
 def test_007_unoriented_traverse2(self):
     """
     Traverse connected at each end
     """
     net = Network.Network()
     st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0))
     st2 = Station.Station("ST2", llh=(171.004, -44.995, 40.0))
     st3 = Station.Station("ST3", llh=(171.0, -44.995, 20.0))
     st4 = Station.Station("ST4", llh=(171.0083, -44.9965, 50.0))
     net.addStation(st1)
     net.addStation(st2)
     obs = Traverse([st1, st4, st3, st2])
     self.checkLocator(net, obs, [st3, st4])
Exemple #4
0
 def test_001_basic_offset_lv(self):
     """
     Simple offset bearing, distance, height difference 
     """
     net = Network.Network()
     st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0))
     st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0))
     net.addStation(st1)
     obs = []
     obs.append(AZ(st1, st2))
     obs.append(SD(st1, st2))
     obs.append(LV(st1, st2))
     self.checkLocator(net, obs, [st2])
Exemple #5
0
 def test_004_basic_offset_with_GX(self):
     """
     Simple using GX fixed station plus bearing, distance, zenith distance
     """
     net = Network.Network()
     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(GX(st1))
     obs.append(AZ(st1, st2))
     obs.append(SD(st1, st2))
     obs.append(ZD(st1, st2))
     self.checkLocator(net, obs, [st1, st2])
 def test_003_calculations(self):
     st1 = Station.Station(
         "A23C", llh=(172.345, -41.286, 23.5), xieta=(10.0, -4.0), geoidhgt=25.0
     )
     st2 = Station.Station(
         "A23D", llh=(172.3421, -41.287, 118.27), xieta=(3.0, 1.5), geoidhgt=35.0
     )
     for f in (
         st1.distanceTo,
         st1.azimuthTo,
         st1.geodeticAzimuthTo,
         st1.heightDifferenceTo,
     ):
         name = f.__name__
         self.check("Test3 " + name, f(st2))
         fdata = f(st2, ddxyz=True)
         self.check("Test3 " + name + " ddxyz", fdata)
         # Check differentials
         fdiff = []
         for i in range(3):
             offset = [0.0, 0.0, 0.0]
             offset[i] = 1.0
             fcalc = f(st2, instofst=offset, offsettype=st1.OFFSET_XYZ)
             fdiff.append(fcalc - fdata[0])
         maxerror = np.max(np.abs(np.subtract(fdata[1], fdiff)))
         # Tolerance because currently heightDifferenceTo differentials do not
         # factor in slope of geoid (which is significant in this extreme test case)
         tolerance = 5.0e-3 if name != "heightDifferenceTo" else 0.15
         if maxerror > tolerance:
             self.reportFail(
                 "Test3 {0} inst station differentials in error by {1}\n  {2} {3}".format(
                     name, maxerror, fdata[1], fdiff
                 )
             )
         fdiff = []
         for i in range(3):
             offset = [0.0, 0.0, 0.0]
             offset[i] = 1.0
             fcalc = f(st2, trgtofst=offset, offsettype=st1.OFFSET_XYZ)
             fdiff.append(fcalc - fdata[0])
         maxerror = np.max(np.abs(np.subtract(fdata[2], fdiff)))
         # Tolerance because currently heightDifferenceTo differentials do not
         # factor in slope of geoid (which is significant in this extreme test case)
         tolerance = 5.0e-3 if name != "heightDifferenceTo" else 0.15
         if maxerror > tolerance:
             self.reportFail(
                 "Test3 {0} trgt station differentials in error by {1}\n  {2} {3}".format(
                     name, maxerror, fdata[2], fdiff
                 )
             )
Exemple #7
0
 def test_003_basic_offset_ha(self):
     """
     Simple offset angle, distance, zenith distance
     """
     net = Network.Network()
     st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0))
     st3 = Station.Station("ST3", llh=(171.02, -45.01, 10.0))
     st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0))
     net.addStation(st1)
     net.addStation(st3)
     obs = []
     obs.append(HA(st1, [st3, st2]))
     obs.append(SD(st1, st2))
     obs.append(ZD(st1, st2))
     self.checkLocator(net, obs, [st2])
Exemple #8
0
 def test_005_traverse(self):
     """
     Extending network along a traversej
     """
     net = Network.Network()
     st1 = Station.Station("ST1", llh=(171.0, -45.0, 10.0))
     st2 = Station.Station("ST2", llh=(171.35, -44.82, 20.0))
     st3 = Station.Station("ST3", llh=(171.348, -44.825, 40.0))
     st4 = Station.Station("ST4", llh=(171.3589, -44.8262, 310.0))
     stations = [st1, st2, st3, st4]
     net.addStation(st1)
     obs = []
     obs.append(AZ(st1, st2))
     obs.extend(Traverse(stations))
     self.checkLocator(net, obs, stations[1:])
 def test_003_gb(self):
     """
     Simple DXYZ observation
     """
     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(GB(st1, st2))
     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 3", adj)
 def test_001_attributes(self):
     st1 = Station.Station("A23C", llh=(172.345, -41.286, 23.5))
     self.checkStation("Test1a", st1, checkGrav=True, checkEnu=True)
     st2 = Station.Station(
         "A23-C", xyz=(-4754070.1304, 625885.2064, -4191614.0057), name="A23 mark C"
     )
     self.checkStation("Test1b", st2, checkGrav=True, checkEnu=True)
     st3 = Station.Station(
         "A23C", llh=(172.345, -41.286, 23.5), xieta=(0.1, 0.4), geoidhgt=25.0
     )
     self.checkStation("Test1c", st3, checkGrav=True, checkEnu=True)
     enu = st3.enu()
     genu = st3.genu()
     self.check(
         "Test1_genu",
         np.degrees(genu[2].dot(enu.T)),
         "Gravitational vertical not correct",
         0.00001,
     )
 def test_001_basic_offset(self):
     """
     Simple offset bearing, distance, zenith distance
     """
     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))
     obs.append(LV(st1, st2))
     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 1", adj)
    def test_150_geoid_plugin_config_load(self):
        """
        Local geoid plugin via configuration
        """
        from Geodetic.StationLocatorPlugin import StationLocatorPlugin

        st1 = Station.Station("ST1", llh=(171.0, -45.0, 100.0))
        st2 = Station.Station("ST2", llh=(171.05, -45.0, 100.0))
        st3 = Station.Station("ST3", llh=(171.0, -44.93, 100.0))
        st4 = Station.Station("ST4", llh=(171.0, -44.80, 100.0))
        obs = Traverse([st1, st2, st3, st4])
        net = Network.Network()
        net.addStation(st1, st2, st3, st4)
        adj = Adjustment.Adjustment(stations=net,
                                    observations=obs,
                                    verbose=True)
        adj.setConfig("use_plugin", "local_geoid_model_plugin")
        adj.setConfig("fix", "ST1 ST2 ST3 ST4")
        adj.setConfig("local_geoid", "ST1 25.6 30.0 -45.0 15000")
        adj.setConfig("refraction_coefficient", "0.0")
        self.runAdjustment("Test 150", adj, checkListing=True, checkGeoid=True)
 def test_053_output_coord_ellipse(self):
     """
     Output ellipses
     """
     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))
     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("test52_coords.csv")
     adj.setConfig("output_coordinate_file", cfname + " ellipses")
     self.runAdjustment("Test 53", adj, outputfiles={"coords": cfname})
 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_251_setup_height_re(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", "re:[AB] 0.25")
     adj.setConfig("debug_observation_equations", "true")
     self.runAdjustment("Test 251", adj, checkListing=True)
 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_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_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})