def test_remove_pump(self):
     with SubgridWrapper(mdu=self._mdu_path('1dpumps')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 1)
         id = df['id'].irow(0)
         logger.info(id)
         # This deletes a structure, a pump is a structure
         subgrid.discard_structure(id)
         # Now if we get the pumps again it should be empty
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 0)
Example #2
0
 def test_remove_pump(self):
     with SubgridWrapper(mdu=self._mdu_path('1dpumps')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 1)
         id = df['id'].irow(0)
         logger.info(id)
         # This deletes a structure, a pump is a structure
         subgrid.discard_structure(id)
         # Now if we get the pumps again it should be empty
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 0)
    def test_pump_and_manhole(self):
        with SubgridWrapper(mdu=self._mdu_path('duifpolder')) as subgrid:
            subgrid.initmodel()

            # add manhole with capacity of 50m3/s
            subgrid.discharge(80968.2596081587, 443068.9399839948, "flush", 1,
                              50)
            # after 10 timesteps, pump should have a discharge of 0.2
            for i in range(22):
                q = subgrid.get_nd('q', sliced=True)
                logger.warn("q: %s", q[22008])

                subgrid.update(-1)

            df = subgrid.get_nd('pumps')
            logger.info("pumps: %s", df)
            pump = df[df['id'] == 'pumpstation-11']
            self.assertEqual(1, len(pump))
            npt.assert_equal(22008, pump.link_number.item() - 1)
            npt.assert_almost_equal(0.2, pump.capacity.item())

            q = subgrid.get_nd('q', sliced=True)
            npt.assert_almost_equal(0.2, q[22008])
Example #4
0
    def test_pump_and_manhole(self):
        with SubgridWrapper(mdu=self._mdu_path('duifpolder')) as subgrid:
            subgrid.initmodel()

            # add manhole with capacity of 50m3/s
            subgrid.discharge(80968.2596081587, 443068.9399839948,
                              "flush", 1, 50)
            # after 10 timesteps, pump should have a discharge of 0.2
            for i in range(22):
                q = subgrid.get_nd('q', sliced=True)
                logger.warn("q: %s", q[22008])

                subgrid.update(-1)

            df = subgrid.get_nd('pumps')
            logger.info("pumps: %s", df)
            pump = df[df['id'] == 'pumpstation-11']
            self.assertEqual(1, len(pump))
            npt.assert_equal(22008, pump.link_number.item()-1)
            npt.assert_almost_equal(0.2, pump.capacity.item())

            q = subgrid.get_nd('q', sliced=True)
            npt.assert_almost_equal(0.2, q[22008])
 def test_compound_getnd(self):
     with SubgridWrapper(mdu=self._mdu_path('1dpumps')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 1)
         logger.info(df.to_string())
 def test_culvert_verpulverd(self):
     with SubgridWrapper(mdu=self._mdu_path('1d-democase')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('culverts')
         logger.info('Culverts are NOT being verpulverd')
         self.assertGreater(len(df), 0)
Example #7
0
 def test_compound_getnd(self):
     with SubgridWrapper(mdu=self._mdu_path('1dpumps')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('pumps')
         self.assertEqual(len(df), 1)
         logger.info(df.to_string())
Example #8
0
 def test_culvert_verpulverd(self):
     with SubgridWrapper(mdu=self._mdu_path('1d-democase')) as subgrid:
         subgrid.initmodel()
         df = subgrid.get_nd('culverts')
         logger.info('Culverts are NOT being verpulverd')
         self.assertGreater(len(df), 0)