.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_shipdrift.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_shipdrift.py: Ship drift ================================== .. GENERATED FROM PYTHON SOURCE LINES 6-18 .. code-block:: Python from datetime import datetime from opendrift.models.shipdrift import ShipDrift o = ShipDrift(loglevel=20) o.add_readers_from_list([ 'https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml', 'https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc', 'https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml' ]) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:15:09 INFO opendrift.models.basemodel:529: OpenDriftSimulation initialised (version 1.11.2 / v1.11.2-11-g21e4c60) .. GENERATED FROM PYTHON SOURCE LINES 19-21 Seed ship elements at defined position and time Note: beam/length ratio is larger than allowed, but is then clipped internally .. GENERATED FROM PYTHON SOURCE LINES 21-25 .. code-block:: Python o.seed_elements(lon=5.0, lat=63.0, radius=1000, number=1000, time=datetime.utcnow(), length=80.0, beam=20.0, height=9.0, draft=4.0) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:15:09 WARNING opendrift.models.shipdrift:181: Ratio of beam to length should be in range 0.12 to 0.18, given range is 0.25-0.25. Using border value. 13:15:09 INFO opendrift.models.basemodel.environment:220: Adding a dynamical landmask with max. priority based on assumed maximum speed of 2.0 m/s. Adding a customised landmask may be faster... 13:15:15 INFO opendrift.models.basemodel.environment:247: Fallback values will be used for the following variables which have no readers: 13:15:15 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_stokes_drift_x_velocity: 0.000000 13:15:15 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_stokes_drift_y_velocity: 0.000000 13:15:15 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_significant_height: 0.000000 13:15:15 INFO opendrift.models.basemodel.environment:250: sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment: 0.000000 .. GENERATED FROM PYTHON SOURCE LINES 26-27 Running model .. GENERATED FROM PYTHON SOURCE LINES 27-29 .. code-block:: Python o.run(steps=24, stop_on_error=True) .. rst-class:: sphx-glr-script-out .. code-block:: none 13:15:15 INFO opendrift.models.basemodel:908: Using existing reader for land_binary_mask 13:15:15 INFO opendrift.models.basemodel:920: All points are in ocean 13:15:15 INFO opendrift.models.basemodel:2011: 2024-04-12 13:15:09.854004 - step 1 of 24 - 1000 active elements (0 deactivated) 13:15:15 INFO opendrift.readers.reader_netCDF_CF_generic:102: Opening dataset: https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml /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:15:34 INFO opendrift.readers.reader_netCDF_CF_generic:314: Detected dimensions: {'x': 'x', 'y': 'y', 'time': 'time'} 13:15:35 INFO opendrift.readers.reader_netCDF_CF_generic:102: Opening dataset: https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.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:15:36 INFO opendrift.readers.reader_netCDF_CF_generic:314: Detected dimensions: {'time': 'time', 'x': 'x', 'y': 'y'} 13:15:36 INFO opendrift.readers.reader_netCDF_CF_generic:102: Opening dataset: https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml /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:15:40 INFO opendrift.readers.reader_netCDF_CF_generic:314: Detected dimensions: {'y': 'rlat', 'x': 'rlon', 'time': 'time'} 13:15:43 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:43 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:45 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:45 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:47 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:15:47 INFO opendrift.models.basemodel:2011: 2024-04-12 14:15:09.854004 - step 2 of 24 - 1000 active elements (0 deactivated) 13:15:50 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:50 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:50 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:15:50 INFO opendrift.models.basemodel:2011: 2024-04-12 15:15:09.854004 - step 3 of 24 - 1000 active elements (0 deactivated) 13:15:53 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:53 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:54 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:15:54 INFO opendrift.models.basemodel:2011: 2024-04-12 16:15:09.854004 - step 4 of 24 - 1000 active elements (0 deactivated) 13:15:57 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:57 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:15:58 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:15:58 INFO opendrift.models.basemodel:2011: 2024-04-12 17:15:09.854004 - step 5 of 24 - 1000 active elements (0 deactivated) 13:16:00 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:00 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:00 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:00 INFO opendrift.models.basemodel:2011: 2024-04-12 18:15:09.854004 - step 6 of 24 - 1000 active elements (0 deactivated) 13:16:03 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:03 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:03 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:03 INFO opendrift.models.basemodel:2011: 2024-04-12 19:15:09.854004 - step 7 of 24 - 1000 active elements (0 deactivated) 13:16:06 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:06 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:06 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:06 INFO opendrift.models.basemodel:2011: 2024-04-12 20:15:09.854004 - step 8 of 24 - 1000 active elements (0 deactivated) 13:16:12 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:12 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:13 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:13 INFO opendrift.models.basemodel:2011: 2024-04-12 21:15:09.854004 - step 9 of 24 - 1000 active elements (0 deactivated) 13:16:15 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:15 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:16 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:16 INFO opendrift.models.basemodel:2011: 2024-04-12 22:15:09.854004 - step 10 of 24 - 1000 active elements (0 deactivated) 13:16:18 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:18 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:19 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:19 INFO opendrift.models.basemodel:2011: 2024-04-12 23:15:09.854004 - step 11 of 24 - 1000 active elements (0 deactivated) 13:16:21 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:21 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:22 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:22 INFO opendrift.models.basemodel:2011: 2024-04-13 00:15:09.854004 - step 12 of 24 - 1000 active elements (0 deactivated) 13:16:24 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:24 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:24 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:24 INFO opendrift.models.basemodel:2011: 2024-04-13 01:15:09.854004 - step 13 of 24 - 1000 active elements (0 deactivated) 13:16:27 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:27 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:27 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:27 INFO opendrift.models.basemodel:2011: 2024-04-13 02:15:09.854004 - step 14 of 24 - 1000 active elements (0 deactivated) 13:16:29 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:29 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:30 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:30 INFO opendrift.models.basemodel:2011: 2024-04-13 03:15:09.854004 - step 15 of 24 - 1000 active elements (0 deactivated) 13:16:31 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:31 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:32 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:32 INFO opendrift.models.basemodel:2011: 2024-04-13 04:15:09.854004 - step 16 of 24 - 1000 active elements (0 deactivated) 13:16:33 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:33 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:34 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:34 INFO opendrift.models.basemodel:2011: 2024-04-13 05:15:09.854004 - step 17 of 24 - 1000 active elements (0 deactivated) 13:16:36 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:36 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:37 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:37 INFO opendrift.models.basemodel:2011: 2024-04-13 06:15:09.854004 - step 18 of 24 - 1000 active elements (0 deactivated) 13:16:38 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:38 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:39 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:39 INFO opendrift.models.basemodel:2011: 2024-04-13 07:15:09.854004 - step 19 of 24 - 1000 active elements (0 deactivated) 13:16:40 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:40 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:41 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:41 INFO opendrift.models.basemodel:2011: 2024-04-13 08:15:09.854004 - step 20 of 24 - 1000 active elements (0 deactivated) 13:16:42 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:42 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:43 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:43 INFO opendrift.models.basemodel:2011: 2024-04-13 09:15:09.854004 - step 21 of 24 - 1000 active elements (0 deactivated) 13:16:44 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:44 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:44 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:44 INFO opendrift.models.basemodel:2011: 2024-04-13 10:15:09.854004 - step 22 of 24 - 1000 active elements (0 deactivated) 13:16:46 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:46 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:46 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:46 INFO opendrift.models.basemodel:2011: 2024-04-13 11:15:09.854004 - step 23 of 24 - 1000 active elements (0 deactivated) 13:16:48 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:48 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:49 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction 13:16:49 INFO opendrift.models.basemodel:2011: 2024-04-13 12:15:09.854004 - step 24 of 24 - 1000 active elements (0 deactivated) 13:16:50 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:50 WARNING opendrift.readers.interpolation.structured:46: Ensemble data currently not extrapolated towards seafloor 13:16:51 INFO opendrift.models.shipdrift:311: Using Stokes drift direction as wave direction .. GENERATED FROM PYTHON SOURCE LINES 30-31 Print and plot results .. GENERATED FROM PYTHON SOURCE LINES 31-36 .. code-block:: Python print(o) o.plot(linecolor='orientation') #o.animation(color='orientation', markersize=20, filename="orientation.gif", legend=['left','right'],colorbar=False,cmap='bwr') o.animation(color='orientation', legend=['left','right'], markersize=20, colorbar=False, cmap='bwr') .. image-sg:: /gallery/images/sphx_glr_example_shipdrift_001.png :alt: OpenDrift - ShipDrift 2024-04-12 13:15 to 2024-04-13 13:15 UTC (25 steps) :srcset: /gallery/images/sphx_glr_example_shipdrift_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none =========================== -------------------- Reader performance: -------------------- global_landmask 0:00:00.0 total 0:00:00.0 preparing 0:00:00.0 reading 0:00:00.0 masking -------------------- https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml 0:00:23.4 total 0:00:00.0 preparing 0:00:23.3 reading 0:00:00.0 interpolation 0:00:00.0 interpolation_time 0:00:00.0 rotating vectors 0:00:00.0 masking -------------------- https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc 0:00:28.1 total 0:00:00.0 preparing 0:00:27.9 reading 0:00:00.2 interpolation 0:00:00.0 interpolation_time 0:00:00.1 rotating vectors 0:00:00.0 masking -------------------- https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml 0:00:17.9 total 0:00:00.0 preparing 0:00:17.7 reading 0:00:00.0 interpolation 0:00:00.0 interpolation_time 0:00:00.2 rotating vectors 0:00:00.0 masking -------------------- Performance: 1:41.6 total time 5.6 configuration 0.0 preparing main loop 0.0 moving elements to ocean 1:35.9 main loop 0.7 updating elements 0.0 cleaning up -------------------- =========================== Model: ShipDrift (OpenDrift version 1.11.2) 1000 active ShipObject particles (0 deactivated, 0 scheduled) ------------------- Environment variables: ----- land_binary_mask 1) global_landmask ----- x_sea_water_velocity y_sea_water_velocity 1) https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml 2) https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml ----- x_wind y_wind 1) https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc ----- sea_surface_wave_mean_period_from_variance_spectral_density_second_frequency_moment sea_surface_wave_significant_height sea_surface_wave_stokes_drift_x_velocity sea_surface_wave_stokes_drift_y_velocity 1) https://thredds.met.no/thredds/dodsC/cmems/mywavewam3km/dataset-wam-arctic-1hr3km-be.ncml Discarded readers: Time: Start: 2024-04-12 13:15:09.854004 UTC Present: 2024-04-13 13:15:09.854004 UTC Calculation steps: 24 * 1:00:00 - total time: 1 day, 0:00:00 Output steps: 25 * 1:00:00 =========================== 13:17:24 INFO opendrift.models.basemodel:4562: Saving animation to /root/project/docs/source/gallery/animations/example_shipdrift_0.gif... 13:18:26 INFO opendrift.models.basemodel:3002: Time to make animation: 0:01:04.291184 .. GENERATED FROM PYTHON SOURCE LINES 37-38 .. image:: /gallery/animations/example_shipdrift_0.gif .. rst-class:: sphx-glr-timing **Total running time of the script:** (3 minutes 20.953 seconds) .. _sphx_glr_download_gallery_example_shipdrift.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_shipdrift.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_shipdrift.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_