.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_oil_budget.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_example_oil_budget.py: Oil budget ================================== .. GENERATED FROM PYTHON SOURCE LINES 6-25 .. code-block:: Python from datetime import timedelta from opendrift import test_data_folder as tdf 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(tdf + '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(tdf + '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc') #reader_norkyst = reader_netCDF_CF_generic.Reader('https://thredds.met.no/thredds/dodsC/fou-hi/norkystv3_800m_m00_be') o.add_reader([reader_norkyst, reader_arome]) .. rst-class:: sphx-glr-script-out .. code-block:: none 14:09:42 INFO opendrift:568: OpenDriftSimulation initialised (version 1.14.9 / v1.14.9-43-g22dbf7d) 14:09:42 INFO opendrift.readers:64: Opening file with xr.open_dataset 14:09:43 INFO opendrift.readers.reader_netCDF_CF_generic:340: Detected dimensions: {'time': 'time', 'x': 'x', 'y': 'y'} 14:09:43 INFO opendrift.readers:64: Opening file with xr.open_dataset 14:09:43 INFO opendrift.readers.reader_netCDF_CF_generic:340: Detected dimensions: {'x': 'X', 'y': 'Y', 'z': 'depth', 'time': 'time'} .. GENERATED FROM PYTHON SOURCE LINES 26-27 Adjusting some configuration .. GENERATED FROM PYTHON SOURCE LINES 27-38 .. code-block:: Python 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) .. GENERATED FROM PYTHON SOURCE LINES 39-40 Seed oil elements at defined position and time .. GENERATED FROM PYTHON SOURCE LINES 40-48 .. code-block:: Python 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) .. rst-class:: sphx-glr-script-out .. code-block:: none 14:09:43 INFO opendrift.models.openoil.adios.dirjs:86: Querying ADIOS database for oil: GENERIC HEAVY CRUDE 14:09:43 INFO opendrift.models.openoil.openoil:1731: Using density 963.50937 and viscosity 0.007984481780964631 of oiltype GENERIC HEAVY CRUDE 14:09:43 INFO opendrift.models.basemodel.environment:203: Adding a global landmask from GSHHG 14:09:47 INFO opendrift.models.basemodel.environment:227: Fallback values will be used for the following variables which have no readers: 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_height: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: upward_sea_water_velocity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_significant_height: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_x_velocity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_stokes_drift_y_velocity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_ice_area_fraction: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_ice_x_velocity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_ice_y_velocity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_water_temperature: 10.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_water_salinity: 34.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: sea_floor_depth_below_sea_level: 10000.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: horizontal_diffusivity: 0.000000 14:09:47 INFO opendrift.models.basemodel.environment:230: ocean_vertical_diffusivity: 0.020000 14:09:47 INFO opendrift.models.basemodel.environment:230: ocean_mixed_layer_thickness: 50.000000 .. GENERATED FROM PYTHON SOURCE LINES 49-50 Running model .. GENERATED FROM PYTHON SOURCE LINES 50-56 .. code-block:: Python 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') .. image-sg:: /gallery/images/sphx_glr_example_oil_budget_001.png :alt: GENERIC HEAVY CRUDE (963.5 kg/m3) - 2015-11-16 00:00 to 2015-11-17 00:00 :srcset: /gallery/images/sphx_glr_example_oil_budget_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 14:09:47 INFO opendrift:1894: Skipping environment variable upward_sea_water_velocity because of condition ['drift:vertical_advection', 'is', False] 14:09:47 INFO opendrift:1905: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 14:09:47 INFO opendrift:1905: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 14:09:47 INFO opendrift:947: Using existing reader for land_binary_mask to move elements to ocean 14:09:47 INFO opendrift:978: All points are in ocean 14:09:47 INFO opendrift.models.openoil.openoil:697: Oil-water surface tension is 0.035048 Nm 14:09:47 INFO opendrift.models.openoil.openoil:710: Max water fraction not available for GENERIC HEAVY CRUDE, using default 14:09:47 INFO opendrift:2202: 2015-11-16 00:00:00 - step 1 of 48 - 1000 active elements (0 deactivated) 14:09:47 INFO opendrift:2202: 2015-11-16 00:30:00 - step 2 of 48 - 1000 active elements (0 deactivated) 14:09:47 INFO opendrift:2202: 2015-11-16 01:00:00 - step 3 of 48 - 1000 active elements (0 deactivated) 14:09:47 INFO opendrift:2202: 2015-11-16 01:30:00 - step 4 of 48 - 1000 active elements (0 deactivated) 14:09:47 INFO opendrift:2202: 2015-11-16 02:00:00 - step 5 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 02:30:00 - step 6 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 03:00:00 - step 7 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 03:30:00 - step 8 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 04:00:00 - step 9 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 04:30:00 - step 10 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 05:00:00 - step 11 of 48 - 1000 active elements (0 deactivated) 14:09:48 INFO opendrift:2202: 2015-11-16 05:30:00 - step 12 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 06:00:00 - step 13 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 06:30:00 - step 14 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 07:00:00 - step 15 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 07:30:00 - step 16 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 08:00:00 - step 17 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 08:30:00 - step 18 of 48 - 1000 active elements (0 deactivated) 14:09:49 INFO opendrift:2202: 2015-11-16 09:00:00 - step 19 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 09:30:00 - step 20 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 10:00:00 - step 21 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 10:30:00 - step 22 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 11:00:00 - step 23 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 11:30:00 - step 24 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 12:00:00 - step 25 of 48 - 1000 active elements (0 deactivated) 14:09:50 INFO opendrift:2202: 2015-11-16 12:30:00 - step 26 of 48 - 1000 active elements (0 deactivated) 14:09:51 INFO opendrift:2202: 2015-11-16 13:00:00 - step 27 of 48 - 1000 active elements (0 deactivated) 14:09:51 INFO opendrift:2202: 2015-11-16 13:30:00 - step 28 of 48 - 1000 active elements (0 deactivated) 14:09:51 INFO opendrift:2202: 2015-11-16 14:00:00 - step 29 of 48 - 1000 active elements (0 deactivated) 14:09:54 INFO opendrift:2202: 2015-11-16 14:30:00 - step 30 of 48 - 999 active elements (1 deactivated) 14:09:54 INFO opendrift:2202: 2015-11-16 15:00:00 - step 31 of 48 - 999 active elements (1 deactivated) 14:09:54 INFO opendrift:2202: 2015-11-16 15:30:00 - step 32 of 48 - 997 active elements (3 deactivated) 14:09:54 INFO opendrift:2202: 2015-11-16 16:00:00 - step 33 of 48 - 993 active elements (7 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 16:30:00 - step 34 of 48 - 992 active elements (8 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 17:00:00 - step 35 of 48 - 989 active elements (11 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 17:30:00 - step 36 of 48 - 988 active elements (12 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 18:00:00 - step 37 of 48 - 987 active elements (13 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 18:30:00 - step 38 of 48 - 987 active elements (13 deactivated) 14:09:55 INFO opendrift:2202: 2015-11-16 19:00:00 - step 39 of 48 - 982 active elements (18 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 19:30:00 - step 40 of 48 - 966 active elements (34 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 20:00:00 - step 41 of 48 - 928 active elements (72 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 20:30:00 - step 42 of 48 - 894 active elements (106 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 21:00:00 - step 43 of 48 - 855 active elements (145 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 21:30:00 - step 44 of 48 - 820 active elements (180 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 22:00:00 - step 45 of 48 - 784 active elements (216 deactivated) 14:09:56 INFO opendrift:2202: 2015-11-16 22:30:00 - step 46 of 48 - 732 active elements (268 deactivated) 14:09:57 INFO opendrift:2202: 2015-11-16 23:00:00 - step 47 of 48 - 684 active elements (316 deactivated) 14:09:57 INFO opendrift:2202: 2015-11-16 23:30:00 - step 48 of 48 - 606 active elements (394 deactivated) 14:10:09 INFO opendrift:4768: Saving animation to /root/project/docs/source/gallery/animations/example_oil_budget_0.gif... 14:10:45 INFO opendrift:3191: Time to make animation: 0:00:47.997496 .. GENERATED FROM PYTHON SOURCE LINES 57-58 .. image:: /gallery/animations/example_oil_budget_0.gif .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 9.532 seconds) .. _sphx_glr_download_gallery_example_oil_budget.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_oil_budget.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_oil_budget.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_oil_budget.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_