.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_coastline_options.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_coastline_options.py: Coastline interaction ====================== Example to illustrate stranding options using an artificial east-west oscillating current field Knut-Frode Dagestad, Feb 2017 .. GENERATED FROM PYTHON SOURCE LINES 10-23 .. code-block:: Python from datetime import datetime from opendrift.readers import reader_oscillating from opendrift.models.oceandrift import OceanDrift o = OceanDrift(loglevel=50) # Set loglevel to 0 for debug information reader_osc = reader_oscillating.Reader('x_sea_water_velocity', amplitude=1, zero_time=datetime.utcnow()) o.add_reader([reader_osc]) # Oscillating east-west current component o.set_config('environment:fallback:y_sea_water_velocity', .2) # Adding northwards drift .. GENERATED FROM PYTHON SOURCE LINES 24-25 Try different options: 'previous', 'stranding', 'none' .. GENERATED FROM PYTHON SOURCE LINES 25-31 .. code-block:: Python o.set_config('general:coastline_action', 'previous') o.seed_elements(lon=12.2, lat=67.7, radius=5000, number=25, time=reader_osc.zero_time) o.run(steps=36*4, time_step=900, time_step_output=1800) .. GENERATED FROM PYTHON SOURCE LINES 32-33 Print and plot results .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python print(o) o.animation() o.plot() .. image-sg:: /gallery/images/sphx_glr_example_coastline_options_001.png :alt: OpenDrift - OceanDrift 2024-04-24 11:42 to 2024-04-25 23:42 UTC (73 steps) :srcset: /gallery/images/sphx_glr_example_coastline_options_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none =========================== -------------------- Reader performance: -------------------- oscillating_reader 0:00:00.0 total 0:00:00.0 preparing 0:00:00.0 reading 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: 6.7 total time 5.5 configuration 0.0 preparing main loop 0.0 moving elements to ocean 1.2 main loop 0.0 updating elements 0.0 cleaning up -------------------- =========================== Model: OceanDrift (OpenDrift version 1.11.2) 25 active Lagrangian3DArray particles (0 deactivated, 0 scheduled) ------------------- Environment variables: ----- x_sea_water_velocity 1) oscillating_reader ----- 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_surface_height sea_surface_swell_wave_peak_period_from_variance_spectral_density sea_surface_swell_wave_significant_height sea_surface_swell_wave_to_direction 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_surface_wind_wave_mean_period sea_surface_wind_wave_significant_height sea_surface_wind_wave_to_direction surface_downward_x_stress surface_downward_y_stress turbulent_generic_length_scale turbulent_kinetic_energy upward_sea_water_velocity x_wind y_sea_water_velocity y_wind Discarded readers: Time: Start: 2024-04-24 11:42:38.948222 UTC Present: 2024-04-25 23:42:38.948222 UTC Calculation steps: 144 * 0:15:00 - total time: 1 day, 12:00:00 Output steps: 73 * 0:30:00 =========================== /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) (,
) .. GENERATED FROM PYTHON SOURCE LINES 38-39 .. image:: /gallery/animations/example_coastline_options_0.gif .. rst-class:: sphx-glr-timing **Total running time of the script:** (3 minutes 15.563 seconds) .. _sphx_glr_download_gallery_example_coastline_options.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_coastline_options.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_coastline_options.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_