예제 #1
0
 def test_stranding_roms(self):
     o = PelagicEggDrift(loglevel=0)
     reader_arctic = reader_netCDF_CF_generic.Reader(
         o.test_data_folder() +
         '2Feb2016_Nordic_sigma_3d/Arctic20_1to5Feb_2016.nc')
     reader_nordic = reader_ROMS_native.Reader(
         o.test_data_folder() +
         '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc'
     )
     o.add_reader(reader_arctic)
     o.add_reader(reader_nordic)
     o.fallback_values['x_sea_water_velocity'] = 1
     o.seed_elements(
         lon=13.0,
         lat=68.0,
         radius=20000,
         number=100,
         time=[reader_arctic.start_time, reader_nordic.end_time],
         z=-30)
     o.set_config('general:coastline_action', 'previous')
     o.set_config('processes:turbulentmixing', False)
     o.max_speed = 1
     o.run(end_time=reader_nordic.end_time, time_step=3600 * 36)
     self.assertEqual(o.num_elements_scheduled(), 0)
     self.assertEqual(o.num_elements_active(), 100)
     self.assertEqual(o.num_elements_activated(), 100)
     self.assertEqual(o.num_elements_deactivated(), 0)
     self.assertEqual(o.num_elements_total(), 100)
예제 #2
0
    def test_stranding_3d(self):
        o = PelagicEggDrift(loglevel=30)
        reader_nordic = reader_ROMS_native.Reader(
            o.test_data_folder() +
            '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc'
        )
        o.add_reader(reader_nordic)
        o.fallback_values['y_wind'] = 10  # Some wind for mixing
        o.seed_elements(
            lon=14.0,
            lat=68.15,
            radius=2000,
            number=100,
            time=[reader_nordic.start_time, reader_nordic.end_time],
            z=0)
        o.set_config('general:coastline_action', 'stranding')
        o.set_config('turbulentmixing:timestep', 120)

        o.max_speed = .1
        o.run(end_time=reader_nordic.end_time, time_step=3600 * 6)
        self.assertEqual(o.status_categories[1], 'stranded')
        self.assertEqual(o.elements_deactivated.status.min(), 1)
        self.assertEqual(o.elements_deactivated.status.max(), 1)
        self.assertEqual(o.num_elements_scheduled(), 0)
        self.assertEqual(o.num_elements_active(), 79)
        self.assertEqual(o.num_elements_activated(), 100)
        self.assertEqual(o.num_elements_deactivated(), 21)
        self.assertEqual(o.num_elements_total(), 100)
예제 #3
0
    def test_stranding_3d(self):
        o = PelagicEggDrift(loglevel=30)
        reader_nordic = reader_ROMS_native.Reader(
            o.test_data_folder() +
            '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc'
        )
        o.add_reader(reader_nordic)
        o.set_config('environment:fallback:y_wind', 10)  # Some wind for mixing
        o.seed_elements(
            lon=14.0,
            lat=68.15,
            radius=2000,
            number=100,
            time=[reader_nordic.start_time, reader_nordic.end_time],
            z=0)
        o.set_config('general:coastline_action', 'stranding')
        o.set_config('vertical_mixing:timestep', 120)

        o.max_speed = .1
        o.run(end_time=reader_nordic.end_time, time_step=3600 * 6)
        self.assertEqual(o.status_categories[1], 'stranded')
        self.assertEqual(o.elements_deactivated.status.min(), 1)
        self.assertEqual(o.elements_deactivated.status.max(), 1)
        self.assertEqual(o.num_elements_scheduled(), 0)
        self.assertEqual(o.num_elements_active(), 81)
        self.assertEqual(o.num_elements_activated(), 100)
        self.assertEqual(o.num_elements_deactivated(), 19)
        self.assertEqual(o.num_elements_total(), 100)

        # Check calculated trajectory lengths and speeds
        total_length, distances, speeds = o.get_trajectory_lengths()
        self.assertAlmostEqual(total_length.max(), 14978.3, 1)
        self.assertAlmostEqual(total_length.min(), 1225.2, 1)
        self.assertAlmostEqual(speeds.max(), 0.127, 1)
        self.assertAlmostEqual(distances.max(), 2859.0, 1)
예제 #4
0
 def test_stranding_roms(self):
     o = PelagicEggDrift(loglevel=0)
     reader_arctic = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
     '2Feb2016_Nordic_sigma_3d/Arctic20_1to5Feb_2016.nc')
     reader_nordic = reader_ROMS_native.Reader(o.test_data_folder() +
     '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc')
     o.add_reader(reader_arctic)
     o.add_reader(reader_nordic)
     o.fallback_values['x_sea_water_velocity'] = 1
     o.seed_elements(lon=13.0, lat=68.0, radius=20000, number=100,
                     time=[reader_arctic.start_time,
                           reader_nordic.end_time], z=-30)
     o.set_config('general:basemap_resolution', 'c')
     o.set_config('general:coastline_action', 'previous')
     o.set_config('processes:turbulentmixing', False)
     o.max_speed=1
     o.run(end_time=reader_nordic.end_time, time_step=3600*36)
     self.assertEqual(o.num_elements_scheduled(), 0)
     self.assertEqual(o.num_elements_active(), 100)
     self.assertEqual(o.num_elements_activated(), 100)
     self.assertEqual(o.num_elements_deactivated(), 0)
     self.assertEqual(o.num_elements_total(), 100)
예제 #5
0
 def test_stranding_3d(self):
     o = PelagicEggDrift(loglevel=30)
     reader_nordic = reader_ROMS_native.Reader(o.test_data_folder() +
     '2Feb2016_Nordic_sigma_3d/Nordic-4km_SLEVELS_avg_00_subset2Feb2016.nc')
     o.add_reader(reader_nordic)
     o.fallback_values['y_wind'] = 10  # Some wind for mixing
     o.seed_elements(lon=14.0, lat=68.15, radius=2000, number=100,
                     time=[reader_nordic.start_time,
                           reader_nordic.end_time], z=0)
     o.set_config('general:basemap_resolution', 'i')
     o.set_config('general:coastline_action', 'stranding')
     o.set_config('turbulentmixing:timestep', 120)
     o.set_config('turbulentmixing:verticalresolution', 10)
     o.max_speed=.1
     o.run(end_time=reader_nordic.end_time, time_step=3600*6)
     self.assertEqual(o.status_categories[1], 'stranded')
     self.assertEqual(o.elements_deactivated.status.min(), 1)
     self.assertEqual(o.elements_deactivated.status.max(), 1)
     self.assertEqual(o.num_elements_scheduled(), 0)
     self.assertEqual(o.num_elements_active(), 88)
     self.assertEqual(o.num_elements_activated(), 100)
     self.assertEqual(o.num_elements_deactivated(), 12)
     self.assertEqual(o.num_elements_total(), 100)