Exemplo n.º 1
0
 def test_add_length(self):
     known_length = 18.0
     h1v1 = {"n_hori_lines": 1, "n_vert_lines": 1}
     gdf = tigernet.generate_lattice(**h1v1)
     gdf["length"] = gdf.geometry.length
     gdf = utils.add_length(gdf, len_col="length", geo_col="geometry")
     observed_length = gdf["length"].sum()
     self.assertEqual(observed_length, known_length)
Exemplo n.º 2
0
    def setUp(self):
        lat = tigernet.generate_lattice(n_hori_lines=1,
                                        n_vert_lines=1,
                                        wbox=True)
        lat = lat[~lat["SegID"].isin([3, 5, 8])]
        rec = {
            "geometry": LineString(((4.5, 9), (4.5, 13.5))),
            "SegID": 13,
            "MTFCC": "S1400",
        }
        barb = lat.append(rec, ignore_index=True)

        # full network
        self.network = tigernet.Network(s_data=barb.copy())
        with self.assertWarns(UserWarning):
            self.network.calc_net_stats()

        # simplified network
        self.graph = self.network.simplify_network()
        with self.assertWarns(UserWarning):
            self.graph.calc_net_stats()
Exemplo n.º 3
0
 def test_generate_lattice_2x2_wbox_neg1neg133(self):
     lat = tigernet.generate_lattice(wbox=True, **self._34_kws)
     observed_length = lat.length.sum()
     known_length = 44.2
     self.assertEqual(observed_length, known_length)
Exemplo n.º 4
0
 def test_generate_lattice_3x4_xbox_neg1neg133(self):
     lat = tigernet.generate_lattice(**self._34_kws)
     observed_length = lat.length.sum()
     known_length = 27.8
     self.assertEqual(observed_length, known_length)
Exemplo n.º 5
0
 def test_generate_lattice_2x2_wbox_0099(self):
     lat = tigernet.generate_lattice(wbox=True)
     observed_length = lat.length.sum()
     known_length = 72.0
     self.assertEqual(observed_length, known_length)
Exemplo n.º 6
0
 def setUp(self):
     self.lat = tigernet.generate_lattice(n_hori_lines=1, n_vert_lines=1)
     self.net = tigernet.Network(s_data=self.lat)
     self.net.cost_matrix()
     self.net.calc_net_stats()
Exemplo n.º 7
0
 def setUp(self):
     self.lat = tigernet.generate_lattice(n_hori_lines=1, n_vert_lines=1)
Exemplo n.º 8
0
 def setUp(self):
     lat1 = tigernet.generate_lattice(n_hori_lines=1, n_vert_lines=1)
     kws = {"n_hori_lines": 1, "n_vert_lines": 1, "bounds": [6, 6, 8, 8]}
     lat2 = tigernet.generate_lattice(**kws)
     self.lats = lat1.append(lat2)
     self.lats.reset_index(drop=True, inplace=True)
Exemplo n.º 9
0
import tigernet

###############################################################################
############################### Synthetic networks ############################
###############################################################################
# --------------------------------------------------------------------------
# One 1x1 lattice network
#   used in:
#       - test_tigernet_synthetic.TestNetworkBuildLattice1x1
#       - test_tigernet_synthetic.TestNetworkTopologyLattice1x1
#       - test_data_generation.TestObservationDataGenerationSynthetic
#       - test_errors.TestObservationsErrors
#       - test_errors.TestUtilsErrors
#       - test_errors.TestStatsErrors
h1v1 = {"n_hori_lines": 1, "n_vert_lines": 1}
lattice = tigernet.generate_lattice(**h1v1)
network_lattice_1x1_no_args = tigernet.Network(lattice)

# --------------------------------------------------------------------------
# Two 1x1 lattices network (both components)
#   used in:
#       - test_tigernet_synthetic.TestNetworkComponentsLattice1x1
lattice1 = tigernet.generate_lattice(**h1v1)
lattice2 = tigernet.generate_lattice(bounds=[6, 6, 8, 8], **h1v1)
lattice = lattice1.append(lattice2)
lattice.reset_index(drop=True, inplace=True)
kws = {"record_components": True}
network_lattice_2x1x1_all = tigernet.Network(lattice, **kws)

# --------------------------------------------------------------------------
# Two 1x1 lattices network (both components) with a calculated cost matrix (and paths)