.. 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/sea/norkyst800m/1h/aggregate_be') o.add_reader([reader_norkyst, reader_arome]) .. rst-class:: sphx-glr-script-out .. code-block:: none 17:12:56 INFO opendrift:513: OpenDriftSimulation initialised (version 1.14.2 / v1.14.2-88-gf09b7bd) 17:12:56 INFO opendrift.readers:61: Opening file with xr.open_dataset 17:12:56 INFO opendrift.readers.reader_netCDF_CF_generic:332: Detected dimensions: {'time': 'time', 'x': 'x', 'y': 'y'} 17:12:56 INFO opendrift.readers:61: Opening file with xr.open_dataset 17:12:57 INFO opendrift.readers.reader_netCDF_CF_generic:332: 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 17:12:57 INFO opendrift.models.openoil.adios.dirjs:86: Querying ADIOS database for oil: GENERIC HEAVY CRUDE 17:12:57 INFO opendrift.models.openoil.openoil:1717: Using density 963.50937 and viscosity 0.007984481780964631 of oiltype GENERIC HEAVY CRUDE 17:12:57 INFO opendrift.models.basemodel.environment:206: Adding a global landmask from GSHHG 17:13:01 INFO opendrift.models.basemodel.environment:229: Fallback values will be used for the following variables which have no readers: 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_height: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: upward_sea_water_velocity: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_significant_height: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_x_velocity: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_y_velocity: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_ice_area_fraction: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_ice_x_velocity: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_ice_y_velocity: 0.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_water_temperature: 10.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_water_salinity: 34.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: sea_floor_depth_below_sea_level: 10000.000000 17:13:01 INFO opendrift.models.basemodel.environment:232: ocean_vertical_diffusivity: 0.020000 17:13:01 INFO opendrift.models.basemodel.environment:232: 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 17:13:01 INFO opendrift:1732: Skipping environment variable upward_sea_water_velocity because of condition ['drift:vertical_advection', 'is', False] 17:13:01 INFO opendrift:1743: Storing previous values of element property lon because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 17:13:01 INFO opendrift:1743: Storing previous values of element property lat because of condition (('general:coastline_action', 'in', ['stranding', 'previous']), 'or', ('general:seafloor_action', 'in', ['previous'])) 17:13:01 INFO opendrift:899: Using existing reader for land_binary_mask 17:13:01 INFO opendrift:928: All points are in ocean 17:13:01 INFO opendrift.models.openoil.openoil:692: Oil-water surface tension is 0.035048 Nm 17:13:01 INFO opendrift.models.openoil.openoil:705: Max water fraction not available for GENERIC HEAVY CRUDE, using default 17:13:01 INFO opendrift:2035: 2015-11-16 00:00:00 - step 1 of 48 - 1000 active elements (0 deactivated) 17:13:01 INFO opendrift:2035: 2015-11-16 00:30:00 - step 2 of 48 - 1000 active elements (0 deactivated) 17:13:01 INFO opendrift:2035: 2015-11-16 01:00:00 - step 3 of 48 - 1000 active elements (0 deactivated) 17:13:01 INFO opendrift:2035: 2015-11-16 01:30:00 - step 4 of 48 - 1000 active elements (0 deactivated) 17:13:01 INFO opendrift:2035: 2015-11-16 02:00:00 - step 5 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 02:30:00 - step 6 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 03:00:00 - step 7 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 03:30:00 - step 8 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 04:00:00 - step 9 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 04:30:00 - step 10 of 48 - 1000 active elements (0 deactivated) 17:13:02 INFO opendrift:2035: 2015-11-16 05:00:00 - step 11 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 05:30:00 - step 12 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 06:00:00 - step 13 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 06:30:00 - step 14 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 07:00:00 - step 15 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 07:30:00 - step 16 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 08:00:00 - step 17 of 48 - 1000 active elements (0 deactivated) 17:13:03 INFO opendrift:2035: 2015-11-16 08:30:00 - step 18 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 09:00:00 - step 19 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 09:30:00 - step 20 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 10:00:00 - step 21 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 10:30:00 - step 22 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 11:00:00 - step 23 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 11:30:00 - step 24 of 48 - 1000 active elements (0 deactivated) 17:13:04 INFO opendrift:2035: 2015-11-16 12:00:00 - step 25 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 12:30:00 - step 26 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 13:00:00 - step 27 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 13:30:00 - step 28 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 14:00:00 - step 29 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 14:30:00 - step 30 of 48 - 1000 active elements (0 deactivated) 17:13:05 INFO opendrift:2035: 2015-11-16 15:00:00 - step 31 of 48 - 1000 active elements (0 deactivated) 17:13:07 INFO opendrift:2035: 2015-11-16 15:30:00 - step 32 of 48 - 1000 active elements (0 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 16:00:00 - step 33 of 48 - 998 active elements (2 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 16:30:00 - step 34 of 48 - 995 active elements (5 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 17:00:00 - step 35 of 48 - 995 active elements (5 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 17:30:00 - step 36 of 48 - 993 active elements (7 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 18:00:00 - step 37 of 48 - 992 active elements (8 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 18:30:00 - step 38 of 48 - 991 active elements (9 deactivated) 17:13:09 INFO opendrift:2035: 2015-11-16 19:00:00 - step 39 of 48 - 989 active elements (11 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 19:30:00 - step 40 of 48 - 969 active elements (31 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 20:00:00 - step 41 of 48 - 936 active elements (64 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 20:30:00 - step 42 of 48 - 900 active elements (100 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 21:00:00 - step 43 of 48 - 861 active elements (139 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 21:30:00 - step 44 of 48 - 829 active elements (171 deactivated) 17:13:10 INFO opendrift:2035: 2015-11-16 22:00:00 - step 45 of 48 - 789 active elements (211 deactivated) 17:13:11 INFO opendrift:2035: 2015-11-16 22:30:00 - step 46 of 48 - 749 active elements (251 deactivated) 17:13:11 INFO opendrift:2035: 2015-11-16 23:00:00 - step 47 of 48 - 673 active elements (327 deactivated) 17:13:11 INFO opendrift:2035: 2015-11-16 23:30:00 - step 48 of 48 - 605 active elements (395 deactivated) 17:13:22 INFO opendrift:4553: Saving animation to /root/project/docs/source/gallery/animations/example_oil_budget_0.gif... 17:13:49 INFO opendrift:2994: Time to make animation: 0:00:37.775631 .. 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 1.006 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 `_