Satellite

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

o = OpenOil(loglevel=20)  # Set loglevel to 0 for debug information

# Arome
reader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
    '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')

# Norkyst
reader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() +
    '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')

o.add_reader([reader_norkyst, reader_arome])
13:58:54 INFO    opendrift.models.basemodel:539: OpenDriftSimulation initialised (version 1.10.7 / v1.10.6-119-g1da5bec)
13:58:54 INFO    opendrift.readers.reader_netCDF_CF_generic:92: Opening dataset: /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc
/opt/conda/envs/opendrift/lib/python3.11/site-packages/pyproj/crs/crs.py:1286: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj = self._crs.to_proj4(version=version)
13:58:55 INFO    opendrift.readers.reader_netCDF_CF_generic:92: Opening dataset: /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc
/opt/conda/envs/opendrift/lib/python3.11/site-packages/pyproj/crs/crs.py:1286: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
  proj = self._crs.to_proj4(version=version)

Seed oil particles within contour detected from satellite

o.seed_from_gml(o.test_data_folder() + 'radarsat_oil_satellite_observation/RS2_20151116_002619_0127_SCNB_HH_SGF_433012_9730_12182143_Oil.gml',
    num_elements=2000)
13:58:55 INFO    opendrift.models.openoil.openoil:1645: Oil type not specified, using default: GENERIC BUNKER C
13:58:55 INFO    opendrift.models.openoil.openoil:1462: setting oil_type to: GENERIC BUNKER C
13:58:55 INFO    opendrift.models.openoil.adios.dirjs:71: Querying ADIOS database for oil: GENERIC BUNKER C
13:58:55 INFO    opendrift.models.openoil.openoil:1652: Using density 971.1 and viscosity 0.0005020658058702914 of oiltype GENERIC BUNKER C

Adjusting some configuration

o.set_config('drift:vertical_mixing', False)
o.set_config('processes:dispersion', True)
o.set_config('processes:evaporation', False)
o.set_config('processes:emulsification', True)
o.set_config('drift:current_uncertainty', .1)  # Diffusion
o.set_config('drift:wind_uncertainty', 1)

Running model for 6 hours

o.run(steps=6*4, time_step=900)
13:58:55 INFO    opendrift.models.basemodel:2591: Fallback values will be used for the following variables which have no readers:
13:58:55 INFO    opendrift.models.basemodel:2594:       upward_sea_water_velocity: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_surface_wave_significant_height: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_surface_wave_stokes_drift_x_velocity: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_surface_wave_stokes_drift_y_velocity: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_surface_wave_period_at_variance_spectral_density_maximum: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_ice_area_fraction: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_ice_x_velocity: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_ice_y_velocity: 0.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_water_temperature: 10.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_water_salinity: 34.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       sea_floor_depth_below_sea_level: 10000.000000
13:58:55 INFO    opendrift.models.basemodel:2594:       ocean_vertical_diffusivity: 0.020000
13:58:55 INFO    opendrift.models.basemodel:2594:       ocean_mixed_layer_thickness: 50.000000
13:58:55 INFO    opendrift.models.basemodel:2753: Adding a dynamical landmask with max. priority based on assumed maximum speed of 1.3 m/s. Adding a customised landmask may be faster...
13:59:01 INFO    opendrift.models.basemodel:1701: Using existing reader for land_binary_mask
13:59:01 INFO    opendrift.models.basemodel:1713: All points are in ocean
13:59:01 INFO    opendrift.models.openoil.openoil:646: Oil-water surface tension is 0.035282 Nm
13:59:01 INFO    opendrift.models.basemodel:2882: 2015-11-16 00:26:18.770000 - step 1 of 24 - 1990 active elements (0 deactivated)
13:59:01 INFO    opendrift.models.basemodel:2882: 2015-11-16 00:41:18.770000 - step 2 of 24 - 1990 active elements (0 deactivated)
13:59:01 INFO    opendrift.models.basemodel:2882: 2015-11-16 00:56:18.770000 - step 3 of 24 - 1990 active elements (0 deactivated)
13:59:01 INFO    opendrift.models.basemodel:2882: 2015-11-16 01:11:18.770000 - step 4 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 01:26:18.770000 - step 5 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 01:41:18.770000 - step 6 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 01:56:18.770000 - step 7 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 02:11:18.770000 - step 8 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 02:26:18.770000 - step 9 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 02:41:18.770000 - step 10 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 02:56:18.770000 - step 11 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 03:11:18.770000 - step 12 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 03:26:18.770000 - step 13 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 03:41:18.770000 - step 14 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 03:56:18.770000 - step 15 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 04:11:18.770000 - step 16 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 04:26:18.770000 - step 17 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 04:41:18.770000 - step 18 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 04:56:18.770000 - step 19 of 24 - 1990 active elements (0 deactivated)
13:59:02 INFO    opendrift.models.basemodel:2882: 2015-11-16 05:11:18.770000 - step 20 of 24 - 1990 active elements (0 deactivated)
13:59:03 INFO    opendrift.models.basemodel:2882: 2015-11-16 05:26:18.770000 - step 21 of 24 - 1990 active elements (0 deactivated)
13:59:03 INFO    opendrift.models.basemodel:2882: 2015-11-16 05:41:18.770000 - step 22 of 24 - 1990 active elements (0 deactivated)
13:59:03 INFO    opendrift.models.basemodel:2882: 2015-11-16 05:56:18.770000 - step 23 of 24 - 1990 active elements (0 deactivated)
13:59:03 INFO    opendrift.models.basemodel:2882: 2015-11-16 06:11:18.770000 - step 24 of 24 - 1990 active elements (0 deactivated)

Print and plot results

print(o)
o.animation(fast=True, buffer=0.1)
===========================
--------------------
Reader performance:
--------------------
/root/project/tests/test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc
 0:00:00.3  total
 0:00:00.0  preparing
 0:00:00.0  reading
 0:00:00.0  interpolation
 0:00:00.0  interpolation_time
 0:00:00.2  rotating vectors
 0:00:00.0  masking
--------------------
/root/project/tests/test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc
 0:00:00.2  total
 0:00:00.0  preparing
 0:00:00.0  reading
 0:00:00.0  interpolation
 0:00:00.0  interpolation_time
 0:00:00.2  rotating vectors
 0:00:00.0  masking
--------------------
global_landmask
 0:00:00.0  total
 0:00:00.0  preparing
 0:00:00.0  reading
 0:00:00.0  masking
--------------------
Performance:
    8.8 total time
    0.8 configuration
    6.5 preparing main loop
      6.4 making dynamical landmask
      0.0 moving elements to ocean
      0.8 readers
        0.0 global_landmask
        0.1 postprocessing
    1.4 main loop
        0.3 /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc
        0.3 /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc
      0.1 updating elements
        0.0 oil weathering
          0.0 updating viscosities
          0.0 updating densities
          0.0 emulsification
          0.0 dispersion
    0.0 cleaning up
--------------------
===========================
Model:  OpenOil     (OpenDrift version 1.10.7)
        1990 active Oil particles  (0 deactivated, 0 scheduled)
-------------------
Environment variables:
  -----
  x_sea_water_velocity
  y_sea_water_velocity
     1) /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc
  -----
  x_wind
  y_wind
     1) /root/project/tests/test_data/16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc
  -----
  land_binary_mask
     1) global_landmask
  -----
Readers not added for the following variables:
  ocean_mixed_layer_thickness
  ocean_vertical_diffusivity
  sea_floor_depth_below_sea_level
  sea_ice_area_fraction
  sea_ice_x_velocity
  sea_ice_y_velocity
  sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment
  sea_surface_wave_period_at_variance_spectral_density_maximum
  sea_surface_wave_significant_height
  sea_surface_wave_stokes_drift_x_velocity
  sea_surface_wave_stokes_drift_y_velocity
  sea_water_salinity
  sea_water_temperature
  upward_sea_water_velocity

Time:
        Start: 2015-11-16 00:26:18.770000 UTC
        Present: 2015-11-16 06:26:18.770000 UTC
        Calculation steps: 24 * 0:15:00 - total time: 6:00:00
        Output steps: 25 * 0:15:00
===========================

13:59:03 WARNING opendrift.models.basemodel:3226: Plotting fast. This will make your plots less accurate.
/opt/conda/envs/opendrift/lib/python3.11/site-packages/cartopy/mpl/geoaxes.py:1696: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
  result = super().scatter(*args, **kwargs)
13:59:04 INFO    opendrift.models.basemodel:5350: Saving animation to /root/project/docs/source/gallery/animations/example_satellite_0.gif...
13:59:10 INFO    opendrift.models.basemodel:3848: Time to make animation: 0:00:06.809493
../_images/example_satellite_0.gif
o.plot(fast=True, buffer=0.1)
OpenDrift - OpenOil (GENERIC BUNKER C) 2015-11-16 00:26 to 2015-11-16 06:26 UTC (25 steps)
13:59:10 WARNING opendrift.models.basemodel:3226: Plotting fast. This will make your plots less accurate.
0.16004453469760524 ALPHA

(<GeoAxes: title={'center': 'OpenDrift - OpenOil (GENERIC BUNKER C)\n2015-11-16 00:26 to 2015-11-16 06:26 UTC (25 steps)'}>, <Figure size 895.307x1100 with 1 Axes>)

Total running time of the script: (0 minutes 24.134 seconds)

Gallery generated by Sphinx-Gallery