.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_water_column_stretching.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_water_column_stretching.py: Water column stretching ======================== .. GENERATED FROM PYTHON SOURCE LINES 6-14 .. code-block:: Python from datetime import datetime, timedelta import numpy as np import matplotlib.pyplot as plt from opendrift.readers import reader_oscillating from opendrift.models.oceandrift import OceanDrift .. GENERATED FROM PYTHON SOURCE LINES 15-22 In OpenDrift, the vertical position of elements ("z") is defined as relative to actual surface, and not an absolute reference level (e.g. mean sea surface height). Thus if sea surface elevation changes with time (e.g. tides), we need to add a "correction / perturbation" to z, otherwise elements at/near seafloor will be lifted if surface elevation increases and z (relative to surface) remains unchanged. This correction is presently only implemented for OceanDrift, and must be switched on with config setting "drift:water:column_stretching" .. GENERATED FROM PYTHON SOURCE LINES 22-29 .. code-block:: Python # To illustrate, we add a reader with oscillating sea surface elevation (tidal) # with amplitude of 1m and peroid of 6 hours time = datetime.now() reader_tidal = reader_oscillating.Reader('sea_surface_height', amplitude=-1, period=timedelta(hours=6), zero_time=time) .. GENERATED FROM PYTHON SOURCE LINES 30-31 First an illustration withouth this correction. .. GENERATED FROM PYTHON SOURCE LINES 31-41 .. code-block:: Python o = OceanDrift(loglevel=20) o.add_reader(reader_tidal) o.set_config('drift:water_column_stretching', False) o.set_config('environment:constant:sea_floor_depth_below_sea_level', 10) z = np.arange(0, -11, -1) # Seeding one particle every meter from surface to 10m depth o.seed_elements(lon=0, lat=0, time=time, z=z, number=11) o.run(duration=timedelta(hours=24), time_step=1800) o.result.z.plot.line(x='time', add_legend=False) plt.show() .. image-sg:: /gallery/images/sphx_glr_example_water_column_stretching_001.png :alt: example water column stretching :srcset: /gallery/images/sphx_glr_example_water_column_stretching_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 17:16:25 INFO opendrift:513: OpenDriftSimulation initialised (version 1.14.2 / v1.14.2-88-gf09b7bd) 17:16:25 INFO opendrift.models.basemodel.environment:206: Adding a global landmask from GSHHG 17:16:30 INFO opendrift.models.basemodel.environment:229: Fallback values will be used for the following variables which have no readers: 17:16:30 INFO opendrift.models.basemodel.environment:232: x_sea_water_velocity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: y_sea_water_velocity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: x_wind: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: y_wind: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: upward_sea_water_velocity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: ocean_vertical_diffusivity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_significant_height: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_x_velocity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_y_velocity: 0.000000 17:16:30 INFO opendrift.models.basemodel.environment:232: ocean_mixed_layer_thickness: 50.000000 17:16:30 INFO opendrift:1732: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 17:16:30 INFO opendrift:1732: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 17:16:30 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:16:30 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:16:30 INFO opendrift:1751: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 17:16:30 INFO opendrift:899: Using existing reader for land_binary_mask 17:16:30 INFO opendrift:928: All points are in ocean 17:16:30 INFO opendrift:2035: 2025-07-11 17:16:25.472655 - step 1 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 17:46:25.472655 - step 2 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 18:16:25.472655 - step 3 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 18:46:25.472655 - step 4 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 19:16:25.472655 - step 5 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 19:46:25.472655 - step 6 of 48 - 11 active elements (0 deactivated) 17:16:30 INFO opendrift:2035: 2025-07-11 20:16:25.472655 - step 7 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 20:46:25.472655 - step 8 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 21:16:25.472655 - step 9 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 21:46:25.472655 - step 10 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 22:16:25.472655 - step 11 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 22:46:25.472655 - step 12 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 23:16:25.472655 - step 13 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-11 23:46:25.472655 - step 14 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 00:16:25.472655 - step 15 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 00:46:25.472655 - step 16 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 01:16:25.472655 - step 17 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 01:46:25.472655 - step 18 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 02:16:25.472655 - step 19 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 02:46:25.472655 - step 20 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 03:16:25.472655 - step 21 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 03:46:25.472655 - step 22 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 04:16:25.472655 - step 23 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 04:46:25.472655 - step 24 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 05:16:25.472655 - step 25 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 05:46:25.472655 - step 26 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 06:16:25.472655 - step 27 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 06:46:25.472655 - step 28 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 07:16:25.472655 - step 29 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 07:46:25.472655 - step 30 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 08:16:25.472655 - step 31 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 08:46:25.472655 - step 32 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 09:16:25.472655 - step 33 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 09:46:25.472655 - step 34 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 10:16:25.472655 - step 35 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 10:46:25.472655 - step 36 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 11:16:25.472655 - step 37 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 11:46:25.472655 - step 38 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 12:16:25.472655 - step 39 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 12:46:25.472655 - step 40 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 13:16:25.472655 - step 41 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 13:46:25.472655 - step 42 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 14:16:25.472655 - step 43 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 14:46:25.472655 - step 44 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 15:16:25.472655 - step 45 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 15:46:25.472655 - step 46 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 16:16:25.472655 - step 47 of 48 - 11 active elements (0 deactivated) 17:16:31 INFO opendrift:2035: 2025-07-12 16:46:25.472655 - step 48 of 48 - 11 active elements (0 deactivated) .. GENERATED FROM PYTHON SOURCE LINES 42-46 We see that the particles remain at their initial depths (since we have no vertical advection or mixing), except for the element starting at seafloor, which is lifted up when sea level rises, since the config setting `drift:seafloor_action` is `lift_to_seafloor` by default. This lifting is in this case unphysical. .. GENERATED FROM PYTHON SOURCE LINES 48-49 We then make a simulation wih correction for the stretching/contraction of the water column. .. GENERATED FROM PYTHON SOURCE LINES 49-58 .. code-block:: Python o = OceanDrift(loglevel=20) o.add_reader(reader_tidal) o.set_config('drift:water_column_stretching', True) o.set_config('environment:constant:sea_floor_depth_below_sea_level', 10) o.seed_elements(lon=0, lat=0, time=time, z=z, number=11) o.run(duration=timedelta(hours=24), time_step=1800) o.result.z.plot.line(x='time', add_legend=False) plt.show() .. image-sg:: /gallery/images/sphx_glr_example_water_column_stretching_002.png :alt: example water column stretching :srcset: /gallery/images/sphx_glr_example_water_column_stretching_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 17:16:32 INFO opendrift:513: OpenDriftSimulation initialised (version 1.14.2 / v1.14.2-88-gf09b7bd) 17:16:32 INFO opendrift.models.basemodel.environment:206: Adding a global landmask from GSHHG 17:16:32 INFO opendrift.models.basemodel.environment:229: Fallback values will be used for the following variables which have no readers: 17:16:32 INFO opendrift.models.basemodel.environment:232: x_sea_water_velocity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: y_sea_water_velocity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: x_wind: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: y_wind: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: upward_sea_water_velocity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: ocean_vertical_diffusivity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_significant_height: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_x_velocity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: sea_surface_wave_stokes_drift_y_velocity: 0.000000 17:16:32 INFO opendrift.models.basemodel.environment:232: ocean_mixed_layer_thickness: 50.000000 17:16:32 INFO opendrift:1732: Skipping environment variable ocean_vertical_diffusivity because of condition ['drift:vertical_mixing', 'is', False] 17:16:32 INFO opendrift:1732: Skipping environment variable ocean_mixed_layer_thickness because of condition ['drift:vertical_mixing', 'is', False] 17:16:32 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:16:32 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:16:32 INFO opendrift:1751: Storing previous values of environment variable sea_surface_height because of condition ['drift:vertical_advection', 'is', True] 17:16:32 INFO opendrift:899: Using existing reader for land_binary_mask 17:16:32 INFO opendrift:928: All points are in ocean 17:16:32 INFO opendrift:2035: 2025-07-11 17:16:25.472655 - step 1 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 17:46:25.472655 - step 2 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 18:16:25.472655 - step 3 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 18:46:25.472655 - step 4 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 19:16:25.472655 - step 5 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 19:46:25.472655 - step 6 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 20:16:25.472655 - step 7 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 20:46:25.472655 - step 8 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 21:16:25.472655 - step 9 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 21:46:25.472655 - step 10 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 22:16:25.472655 - step 11 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 22:46:25.472655 - step 12 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 23:16:25.472655 - step 13 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-11 23:46:25.472655 - step 14 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 00:16:25.472655 - step 15 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 00:46:25.472655 - step 16 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 01:16:25.472655 - step 17 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 01:46:25.472655 - step 18 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 02:16:25.472655 - step 19 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 02:46:25.472655 - step 20 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 03:16:25.472655 - step 21 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 03:46:25.472655 - step 22 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 04:16:25.472655 - step 23 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 04:46:25.472655 - step 24 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 05:16:25.472655 - step 25 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 05:46:25.472655 - step 26 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 06:16:25.472655 - step 27 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 06:46:25.472655 - step 28 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 07:16:25.472655 - step 29 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 07:46:25.472655 - step 30 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 08:16:25.472655 - step 31 of 48 - 11 active elements (0 deactivated) 17:16:32 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:32 INFO opendrift:2035: 2025-07-12 08:46:25.472655 - step 32 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 09:16:25.472655 - step 33 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 09:46:25.472655 - step 34 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 10:16:25.472655 - step 35 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 10:46:25.472655 - step 36 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 11:16:25.472655 - step 37 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 11:46:25.472655 - step 38 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 12:16:25.472655 - step 39 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 12:46:25.472655 - step 40 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 13:16:25.472655 - step 41 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 13:46:25.472655 - step 42 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 14:16:25.472655 - step 43 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 14:46:25.472655 - step 44 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 15:16:25.472655 - step 45 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 15:46:25.472655 - step 46 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 16:16:25.472655 - step 47 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation 17:16:33 INFO opendrift:2035: 2025-07-12 16:46:25.472655 - step 48 of 48 - 11 active elements (0 deactivated) 17:16:33 INFO opendrift.models.oceandrift:305: Compensating for change in surface elevation .. GENERATED FROM PYTHON SOURCE LINES 59-62 Here we see that element depth (z, relative to surface) is changed so that elements at surface and seafloor remain at resp surface (z=0) and seafloor (z = sea_floor_depth + sea_surface_elevation) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 14.041 seconds) .. _sphx_glr_download_gallery_example_water_column_stretching.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_water_column_stretching.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_water_column_stretching.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_water_column_stretching.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_