Oil budget

from datetime import timedelta
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.models.openoil import OpenOil

o = OpenOil(loglevel=20, weathering_model='noaa')

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
    '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')
#reader_arome = reader_netCDF_CF_generic.Reader('https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
    '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')
#reader_norkyst = reader_netCDF_CF_generic.Reader('https://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

o.add_reader([reader_norkyst, reader_arome])
08:34:00 INFO    opendrift.models.basemodel:533: OpenDriftSimulation initialised (version 1.11.2 / v1.11.2-45-g6369924)
08:34:00 INFO    opendrift.readers.reader_netCDF_CF_generic:102: Opening dataset: /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc
08:34:00 INFO    opendrift.readers.reader_netCDF_CF_generic:314: Detected dimensions: {'time': 'time', 'x': 'x', 'y': 'y'}
08:34:00 INFO    opendrift.readers.reader_netCDF_CF_generic:102: Opening dataset: /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc
08:34:00 INFO    opendrift.readers.reader_netCDF_CF_generic:314: Detected dimensions: {'x': 'X', 'y': 'Y', 'z': 'depth', 'time': 'time'}

Adjusting some configuration

o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', True)
o.set_config('processes:emulsification', True)
o.set_config('drift:vertical_mixing', True)
o.set_config('vertical_mixing:timestep', 20.) # seconds
#o.set_config('environment:fallback:x_wind', 9)
#o.set_config('environment:fallback:y_wind', 0)
#o.set_config('environment:fallback:x_sea_water_velocity', .7)
#o.set_config('environment:fallback:y_sea_water_velocity', .3)
#o.set_config('environment:fallback:land_binary_mask', 0)

Seed oil elements at defined position and time

oil_type = 'IFO-380LS 2014'
oil_type = 'IFO 300'
oil_type = 'IFO-180NS 2014'
oil_type = 'GENERIC LIGHT CRUDE'
oil_type = 'GENERIC HEAVY CRUDE'
o.seed_elements(lon=4.8, lat=60.0, z=0, radius=3000, number=1000,
                time=reader_arome.start_time, oil_type=oil_type)
08:34:00 INFO    opendrift.models.openoil.adios.dirjs:90: Querying ADIOS database for oil: GENERIC HEAVY CRUDE
08:34:00 INFO    opendrift.models.openoil.openoil:1719: Using density 938.0 and viscosity 0.0010573364220196155 of oiltype GENERIC HEAVY CRUDE
08:34:00 INFO    opendrift.models.basemodel.environment:218: Adding a dynamical landmask with max. priority based on assumed maximum speed of 1.3 m/s. Adding a customised landmask may be faster...
08:34:07 INFO    opendrift.models.basemodel.environment:245: Fallback values will be used for the following variables which have no readers:
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_height: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    upward_sea_water_velocity: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_significant_height: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_x_velocity: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_stokes_drift_y_velocity: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_ice_area_fraction: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_ice_x_velocity: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_ice_y_velocity: 0.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_water_temperature: 10.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_water_salinity: 34.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    sea_floor_depth_below_sea_level: 10000.000000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    ocean_vertical_diffusivity: 0.020000
08:34:07 INFO    opendrift.models.basemodel.environment:248:    ocean_mixed_layer_thickness: 50.000000

Running model

o.run(duration=timedelta(hours=24), time_step=1800)

o.plot_oil_budget(show_watercontent_and_viscosity=True, show_wind_and_current=True)

o.animation(color='viscosity')
GENERIC HEAVY CRUDE (938.0 kg/m3) - 2015-11-16 00:00 to 2015-11-17 00:00
08:34:07 INFO    opendrift.models.basemodel:911: Using existing reader for land_binary_mask
08:34:07 INFO    opendrift.models.basemodel:922: All points are in ocean
08:34:07 INFO    opendrift.models.openoil.openoil:687: Oil-water surface tension is 0.033960 Nm
08:34:07 INFO    opendrift.models.openoil.openoil:700: Max water fraction not available for GENERIC HEAVY CRUDE, using default
08:34:07 INFO    opendrift.models.basemodel:2011: 2015-11-16 00:00:00 - step 1 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 00:30:00 - step 2 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 01:00:00 - step 3 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 01:30:00 - step 4 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 02:00:00 - step 5 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 02:30:00 - step 6 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 03:00:00 - step 7 of 48 - 1000 active elements (0 deactivated)
08:34:08 INFO    opendrift.models.basemodel:2011: 2015-11-16 03:30:00 - step 8 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 04:00:00 - step 9 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 04:30:00 - step 10 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 05:00:00 - step 11 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 05:30:00 - step 12 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 06:00:00 - step 13 of 48 - 1000 active elements (0 deactivated)
08:34:09 INFO    opendrift.models.basemodel:2011: 2015-11-16 06:30:00 - step 14 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 07:00:00 - step 15 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 07:30:00 - step 16 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 08:00:00 - step 17 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 08:30:00 - step 18 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 09:00:00 - step 19 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 09:30:00 - step 20 of 48 - 1000 active elements (0 deactivated)
08:34:10 INFO    opendrift.models.basemodel:2011: 2015-11-16 10:00:00 - step 21 of 48 - 1000 active elements (0 deactivated)
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 10:30:00 - step 22 of 48 - 1000 active elements (0 deactivated)
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 11:00:00 - step 23 of 48 - 1000 active elements (0 deactivated)
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 11:30:00 - step 24 of 48 - 1000 active elements (0 deactivated)
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 12:00:00 - step 25 of 48 - 1000 active elements (0 deactivated)
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 12:30:00 - step 26 of 48 - 1000 active elements (0 deactivated)
/root/project/opendrift/readers/interpolation/interpolators.py:17: RuntimeWarning: overflow encountered in cast
  data[mask] = np.finfo(np.float64).min
08:34:11 INFO    opendrift.models.basemodel:2011: 2015-11-16 13:00:00 - step 27 of 48 - 1000 active elements (0 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 13:30:00 - step 28 of 48 - 999 active elements (1 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 14:00:00 - step 29 of 48 - 999 active elements (1 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 14:30:00 - step 30 of 48 - 998 active elements (2 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 15:00:00 - step 31 of 48 - 995 active elements (5 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 15:30:00 - step 32 of 48 - 995 active elements (5 deactivated)
08:34:12 INFO    opendrift.models.basemodel:2011: 2015-11-16 16:00:00 - step 33 of 48 - 992 active elements (8 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 16:30:00 - step 34 of 48 - 988 active elements (12 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 17:00:00 - step 35 of 48 - 979 active elements (21 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 17:30:00 - step 36 of 48 - 971 active elements (29 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 18:00:00 - step 37 of 48 - 968 active elements (32 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 18:30:00 - step 38 of 48 - 966 active elements (34 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 19:00:00 - step 39 of 48 - 958 active elements (42 deactivated)
08:34:13 INFO    opendrift.models.basemodel:2011: 2015-11-16 19:30:00 - step 40 of 48 - 944 active elements (56 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 20:00:00 - step 41 of 48 - 916 active elements (84 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 20:30:00 - step 42 of 48 - 876 active elements (124 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 21:00:00 - step 43 of 48 - 846 active elements (154 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 21:30:00 - step 44 of 48 - 806 active elements (194 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 22:00:00 - step 45 of 48 - 781 active elements (219 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 22:30:00 - step 46 of 48 - 728 active elements (272 deactivated)
08:34:14 INFO    opendrift.models.basemodel:2011: 2015-11-16 23:00:00 - step 47 of 48 - 658 active elements (342 deactivated)
08:34:15 INFO    opendrift.models.basemodel:2011: 2015-11-16 23:30:00 - step 48 of 48 - 596 active elements (404 deactivated)
08:34:40 INFO    opendrift.models.basemodel:4570: Saving animation to /root/project/docs/source/gallery/animations/example_oil_budget_0.gif...
08:37:03 INFO    opendrift.models.basemodel:3003: Time to make animation: 0:02:47.902492
../_images/example_oil_budget_0.gif

Total running time of the script: (3 minutes 6.933 seconds)

Gallery generated by Sphinx-Gallery